Fix TCP timeouts and debugging *again*

This commit is contained in:
Michael Morrison 2014-02-02 06:44:39 -06:00
parent 321580e3bb
commit 422a316853

View file

@ -230,7 +230,7 @@ module.exports = Class.extend(EventEmitter,{
if(self.debug) console.log(address+':'+port+" <--TCP "+data.toString('hex')); if(self.debug) console.log(address+':'+port+" <--TCP "+data.toString('hex'));
received = Buffer.concat([received,data]); received = Buffer.concat([received,data]);
if(self.tcpCallback(received)) { if(self.tcpCallback(received)) {
clearTimeout(this.tcpTimeoutTimer); clearTimeout(self.tcpTimeoutTimer);
self.tcpCallback = false; self.tcpCallback = false;
received = new Buffer(0); received = new Buffer(0);
} }
@ -242,7 +242,7 @@ module.exports = Class.extend(EventEmitter,{
if(self.tcpCallback) return self.fatal('Attempted to send TCP packet while still waiting on a managed response'); if(self.tcpCallback) return self.fatal('Attempted to send TCP packet while still waiting on a managed response');
self._tcpConnect(function(socket) { self._tcpConnect(function(socket) {
socket.write(buffer); socket.write(buffer);
if(this.debug) console.log(socket.remoteAddress+':'+socket.remotePort+" TCP--> "+buffer.toString('hex')); if(self.debug) console.log(socket.remoteAddress+':'+socket.remotePort+" TCP--> "+buffer.toString('hex'));
}); });
if(!ondata) return; if(!ondata) return;