Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(v0.5 backport) lib: fix behavior with util.inspect #114

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ module.exports = Connection;

var nextConnectionId = 0;

// Mapping of packet types to handler function names (forward declaration, see
// definition below the Connection class).
//
var PACKET_HANDLERS;

// JSTP connection class
// transport - an abstract socket
// server - JSTP server instance, used only for server-side parts
Expand Down Expand Up @@ -331,7 +336,7 @@ Connection.prototype._processPacket = function(packet) {
return;
}

var handler = Connection.PACKET_HANDLERS[kind];
var handler = PACKET_HANDLERS[kind];
if (handler) {
handler.call(this, packet, keys);
} else {
Expand Down Expand Up @@ -631,9 +636,7 @@ Connection.prototype._emitPacketEvent = function(kind, packet, packetId, args) {
this.emit(kind, eventArgs);
};

// Mapping of packet types to handler function names
//
Connection.PACKET_HANDLERS = {
PACKET_HANDLERS = {
handshake: Connection.prototype._processHandshakePacket,
call: Connection.prototype._processCallPacket,
callback: Connection.prototype._processCallbackPacket,
Expand Down