node_pcap icon indicating copy to clipboard operation
node_pcap copied to clipboard

Pcap.close() broken?

Open thegreatape opened this issue 15 years ago • 1 comments

If I close a pcap session, it appears to not actually be closing - packets continue to be captured and callbacks fired. Test case here: https://gist.github.com/815123 (both session 1 and session 2 's callbacks are fired when this is run, both on 0.2.x and 0.3.8)

thegreatape avatar Feb 07 '11 20:02 thegreatape

I have written an implementation of close()

https://github.com/xkjyeah/node_pcap.git

  1. close() calls pcap_breakloop()
  2. The dispatch method detects that the loop was forcibly broken. It checks that the handle should be invalidated
  3. dispatch method invalidates the handle and closes the connection.

A more complete events system will emit a 'close' event when Dispatch finally closes the connection.

Other methods check for invalid pcap_handle()

xkjyeah avatar Mar 30 '14 18:03 xkjyeah