Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
fix arg order for socket.setTimeout, introduced by commit e3ab2db
Browse files Browse the repository at this point in the history
Change-Id: Ie50d22a83141c397d3bb6e3991d5a1ad23bee656
  • Loading branch information
cynron committed Mar 22, 2015
1 parent b2c499e commit fd647a7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/connectors/hybrid/switcher.js
Expand Up @@ -24,7 +24,7 @@ var Switcher = function(server, opts) {
this.wsprocessor = new WSProcessor();
this.tcpprocessor = new TCPProcessor(opts.closeMethod);
this.id = 1;
this.timeout = (timeout || DEFAULT_TIMEOUT) * 1000;
this.timeout = (opts.timeout || DEFAULT_TIMEOUT) * 1000;
this.setNoDelay = opts.setNoDelay;

if (!opts.ssl) {
Expand All @@ -49,11 +49,12 @@ Switcher.prototype.newSocket = function(socket) {
if(this.state !== ST_STARTED) {
return;
}
// if set connection timeout
socket.setTimeout(function() {
logger.warn('connection is timeout without communication, the remote ip is %s && port is %s', socket.remoteAddress, socket.remotePort);

socket.setTimeout(this.timeout, function() {
logger.warn('connection is timeout without communication, the remote ip is %s && port is %s',
socket.remoteAddress, socket.remotePort);
socket.destroy();
}, this.timeout)
});

var self = this;

Expand Down

0 comments on commit fd647a7

Please sign in to comment.