diff --git a/lib/server.js b/lib/server.js index 8028ac4..335b9bc 100644 --- a/lib/server.js +++ b/lib/server.js @@ -23,7 +23,7 @@ Server.init = function(port, host, options) { var self = this; if (!parseInt(port)) { - throw new Error('in node-nc server the port is mandatory!'); + throw new Error('in node-nc server the port is mandatory!'); } // check args @@ -36,16 +36,17 @@ Server.init = function(port, host, options) { this._port = port; this._host = host || 'localhost'; this.timeout = (options && options.timeout) || 3600000; + var _Server = this; function handler(socket) { var client = socket.remoteAddress + ':' + socket.remotePort; // socket configurations socket.setKeepAlive(true, 60000); - socket.setTimeout(this._timeout); + socket.setTimeout(_Server.timeout); if (options && options.readEncoding) { - socket.setEncoding(options.readEncoding); + socket.setEncoding(options.readEncoding); } // @@ -153,7 +154,7 @@ Server.prototype.send = function(client, msg, end, cb) { new Error(), client, msg); - cb(); + cb(); } };