Comparing version 1.1.0 to 1.2.0
Changelog | ||
========= | ||
## v1.2.0 - February 28, 2014 | ||
Fixed issue with opening offline files in linux | ||
## v1.1.0 - January 13, 2013 | ||
@@ -5,0 +9,0 @@ |
{ | ||
"name" : "pcap", | ||
"version" : "1.1.0", | ||
"version" : "1.2.0", | ||
"description" : "raw packet capture, decoding, and analysis", | ||
@@ -5,0 +5,0 @@ "author": "Matt Ranney <mjr@ranney.com>", |
42
pcap.js
@@ -55,26 +55,26 @@ /*global process require exports console */ | ||
me.opened = true; | ||
me.readWatcher = new SocketWatcher(); | ||
me.empty_reads = 0; | ||
me.buf = new Buffer(65535); | ||
if ( live ) { | ||
me.readWatcher = new SocketWatcher(); | ||
me.empty_reads = 0; | ||
// readWatcher gets a callback when pcap has data to read. multiple packets may be readable. | ||
me.readWatcher.callback = function pcap_read_callback() { | ||
var packets_read = me.session.dispatch(me.buf); | ||
if (packets_read < 1) { | ||
// according to pcap_dispatch documentation if 0 is returned when reading | ||
// from a savefile there will be no more packets left. this check ensures | ||
// we stop reading. Under certain circumstances SocketWatcher will get caught | ||
// in a loop and continue to signal us causing the program to be flooded | ||
// with events. | ||
if (!me.live) { | ||
me.readWatcher.stop(); | ||
me.emit('complete'); | ||
// readWatcher gets a callback when pcap has data to read. multiple packets may be readable. | ||
me.readWatcher.callback = function pcap_read_callback() { | ||
var packets_read = me.session.dispatch(me.buf); | ||
if (packets_read < 1) { | ||
// TODO - figure out what is causing this, and if it is bad. | ||
me.empty_reads += 1; | ||
} | ||
// TODO - figure out what is causing this, and if it is bad. | ||
me.empty_reads += 1; | ||
} | ||
}; | ||
me.readWatcher.set(me.fd, true, false); | ||
me.readWatcher.start(); | ||
}; | ||
me.readWatcher.set(me.fd, true, false); | ||
me.readWatcher.start(); | ||
} else { | ||
setImmediate(function() { | ||
var packets = 0; | ||
do { | ||
packets = me.session.dispatch(me.buf); | ||
} while ( packets > 0 ) | ||
me.emit('complete'); | ||
}); | ||
} | ||
}; | ||
@@ -81,0 +81,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
308099
3567