Skip to content

Commit

Permalink
add error/timeout tracing for nodeSP
Browse files Browse the repository at this point in the history
  • Loading branch information
kaven276 committed Sep 5, 2012
1 parent 318094c commit 1e33b4b
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions lib/nodes/nodeSP.js
Expand Up @@ -38,6 +38,24 @@ SP.prototype.connect = function(){
, client = me.socket = new net.Socket()
, bound = false
;

client.on('close', function(){
me.linkStatus = false;
console.log('SMG server close');
});
client.on('end', function(){
me.linkStatus = false;
console.log('SMG server end');
});
client.on('error', function(){
console.log('SMG connection has error!');
console.log(me);
});
client.on('timeout', function(){
console.log('SMG connection has timeout!');
});

console.log('try to connect to SMG with %s:%s', me.SMGHost, me.SMGPort);
client.connect(me.SMGPort, me.SMGHost, function(){
console.log('SMG connected');
var bind = new Bind(1, me.SMGUser, me.SMGPass);
Expand Down Expand Up @@ -67,15 +85,6 @@ SP.prototype.connect = function(){
}
}
});

client.on('close', function(){
this.linkStatus = false;
console.log('SMG server close');
});
client.on('end', function(){
this.linkStatus = false;
console.log('SMG server end');
});
});
};

Expand Down

0 comments on commit 1e33b4b

Please sign in to comment.