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

lib: fix behavior with util.inspect #72

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;

let nextConnectionId = 0;

// Mapping of packet types to handler function names (forward declaration, see
// definition below the Connection class).
//
let PACKET_HANDLERS; // eslint-disable-line prefer-const

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

const handler = Connection.PACKET_HANDLERS[kind];
const handler = PACKET_HANDLERS[kind];
if (handler) {
handler.call(this, packet, keys);
} else {
Expand Down Expand Up @@ -619,9 +624,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