|
|
@ -14,9 +14,8 @@ timer.callback = function () { |
|
|
|
for (var i = 0, l = sockets.length; i < l; i++) { |
|
|
|
var socket = sockets[i]; |
|
|
|
var s = parseInt(socket, 10); |
|
|
|
channel.processFD( watchers[socket].read ? s : dns.SOCKET_BAD |
|
|
|
, watchers[socket].write ? s : dns.SOCKET_BAD |
|
|
|
); |
|
|
|
channel.processFD(watchers[socket].read ? s : dns.SOCKET_BAD, |
|
|
|
watchers[socket].write ? s : dns.SOCKET_BAD); |
|
|
|
} |
|
|
|
updateTimer(); |
|
|
|
}; |
|
|
@ -46,20 +45,19 @@ var channel = new dns.Channel({SOCK_STATE_CB: function (socket, read, write) { |
|
|
|
}; |
|
|
|
|
|
|
|
watcher.callback = function(read, write) { |
|
|
|
channel.processFD( read ? socket : dns.SOCKET_BAD |
|
|
|
, write ? socket : dns.SOCKET_BAD |
|
|
|
); |
|
|
|
channel.processFD(read ? socket : dns.SOCKET_BAD, |
|
|
|
write ? socket : dns.SOCKET_BAD); |
|
|
|
updateTimer(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
watcher.set(socket, read == 1, write == 1); |
|
|
|
watcher.stop(); |
|
|
|
|
|
|
|
if (!(read || write)) { |
|
|
|
watcher.stop(); |
|
|
|
delete activeWatchers[socket]; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
watcher.set(socket, read == 1, write == 1); |
|
|
|
watcher.start(); |
|
|
|
activeWatchers[socket] = watcher; |
|
|
|
} |
|
|
|