Skip to content

Commit

Permalink
Throw exception if pcap_dispatch returns an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Gulewich committed Jun 6, 2011
1 parent 69ae171 commit 318162b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pcap_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 318162b

Please sign in to comment.