added debug output for read/written packet ids

This commit is contained in:
Xabier de Zuazo 2013-04-06 05:04:47 +02:00
parent b699d5506a
commit 936ba5832d
2 changed files with 3 additions and 0 deletions

View File

@ -79,6 +79,7 @@ Client.prototype.end = function(reason) {
Client.prototype.write = function(packetId, params) { Client.prototype.write = function(packetId, params) {
var buffer = createPacketBuffer(packetId, params, this.isServer); var buffer = createPacketBuffer(packetId, params, this.isServer);
debug("writing packetId " + packetId + " (0x" + packetId.toString(16) + ")");
var out = this.encryptionEnabled ? new Buffer(this.cipher.update(buffer), 'binary') : buffer; var out = this.encryptionEnabled ? new Buffer(this.cipher.update(buffer), 'binary') : buffer;
this.socket.write(out); this.socket.write(out);
}; };

View File

@ -1256,6 +1256,8 @@ function parsePacket(buffer, isServer) {
return { return {
error: new Error("Unrecognized packetId: " + packetId + " (0x" + packetId.toString(16) + ")") error: new Error("Unrecognized packetId: " + packetId + " (0x" + packetId.toString(16) + ")")
} }
} else {
debug("read packetId " + packetId + " (0x" + packetId.toString(16) + ")");
} }
var i, fieldInfo, read, readResults; var i, fieldInfo, read, readResults;
for (i = 0; i < packetInfo.length; ++i) { for (i = 0; i < packetInfo.length; ++i) {