Browse files

Throw exception if pcap_dispatch returns an error.

  • Loading branch information...
1 parent 69ae171 commit 318162b4a02b68a10b7183d848e96076ff188427 @rgulewich committed Jun 6, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 pcap_binding.cc
View
3 pcap_binding.cc
@@ -132,6 +132,9 @@ Dispatch(const Arguments& args)
int packet_count, total_packets = 0;
do {
packet_count = pcap_dispatch(pcap->pcap_handle, 1, PacketReady, (u_char *)pcap);
+ if (packet_count < 0) {
+ return ThrowException(Exception::Error(String::New(pcap_geterr(pcap->pcap_handle))));
+ }
total_packets += packet_count;
} while (packet_count > 0 && pcap->opened);

0 comments on commit 318162b

Please sign in to comment.