Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Network.Pcap.statistics to throw on non-live Pcap handles #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vlm
Copy link

@vlm vlm commented Oct 17, 2015

Avoid making Haskell treat C int as long (Haskell's Int). Without this patch:

Prelude Network.Pcap> openOffline "test/empty.pcap" >>= statistics 
Statistics {statReceived = 129485792, statDropped = 1, statIfaceDropped = 129485816}
Prelude Network.Pcap> openOffline "test/empty.pcap" >>= statistics 
Statistics {statReceived = 129683784, statDropped = 1, statIfaceDropped = 115781272}
Prelude Network.Pcap> 

(returns different garbage every time it is called).

With this patch:
> cabal repl --ghc-options="-lpcap"

Prelude Network.Pcap> openOffline "test/empty.pcap" >>= statistics
*** Exception: user error (Statistics aren't available from savefiles)
Prelude Network.Pcap> 

Bryan, thank you for maintaining this package!

Avoid making Haskell treat C int as long (Haskell's Int)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant