TCP timeout opt-in instead of opt-out
For speed, idle connections are super cheap.
This commit is contained in:
parent
b94af8d6b1
commit
3adf7a3dcf
@ -145,6 +145,7 @@ var timeout = new (function () {
|
|||||||
|
|
||||||
|
|
||||||
var unenroll = this.unenroll = function (socket) {
|
var unenroll = this.unenroll = function (socket) {
|
||||||
|
if (socket._idleNext) {
|
||||||
socket._idleNext._idlePrev = socket._idlePrev;
|
socket._idleNext._idlePrev = socket._idlePrev;
|
||||||
socket._idlePrev._idleNext = socket._idleNext;
|
socket._idlePrev._idleNext = socket._idleNext;
|
||||||
|
|
||||||
@ -155,6 +156,7 @@ var timeout = new (function () {
|
|||||||
//sys.puts('unenroll: list empty');
|
//sys.puts('unenroll: list empty');
|
||||||
list.stop();
|
list.stop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -256,8 +258,6 @@ function _doFlush () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initSocket (self) {
|
function initSocket (self) {
|
||||||
timeout.enroll(self, 60*1000); // default timeout, 60 seconds
|
|
||||||
|
|
||||||
self._readWatcher = ioWatchers.alloc();
|
self._readWatcher = ioWatchers.alloc();
|
||||||
self._readWatcher.callback = function () {
|
self._readWatcher.callback = function () {
|
||||||
// If this is the first recv (recvBuffer doesn't exist) or we've used up
|
// If this is the first recv (recvBuffer doesn't exist) or we've used up
|
||||||
|
Loading…
x
Reference in New Issue
Block a user