net_uv: fix test-net-connect-timeout.js test
authorHenry Rawas <henryr@schakra.com>
Fri, 1 Jul 2011 19:01:12 +0000 (12:01 -0700)
committerRyan Dahl <ry@tinyclouds.org>
Sat, 2 Jul 2011 00:53:48 +0000 (17:53 -0700)
lib/net_uv.js
lib/timers_uv.js

index 92a2d1e..484e61e 100644 (file)
@@ -67,7 +67,7 @@ exports.Stream = Socket; // Legacy naming.
 Socket.prototype.setTimeout = function(msecs, callback) {
   if (msecs > 0) {
     timers.enroll(this, msecs);
-    if (typeof this.fd === 'number') { timers.active(this); }
+    timers.active(this);
     if (callback) {
       this.once('timeout', callback);
     }
@@ -77,6 +77,11 @@ Socket.prototype.setTimeout = function(msecs, callback) {
 };
 
 
+Socket.prototype._onTimeout = function() {
+  this.emit('timeout');
+};
+
+
 Socket.prototype.setNoDelay = function() {
   /* TODO implement me */
 };
index 75580f1..2c37787 100644 (file)
@@ -129,7 +129,7 @@ exports.active = function(item) {
   var msecs = item._idleTimeout;
   if (msecs >= 0) {
     var list = lists[msecs];
-    if (item._idleNext == item) {
+    if (!list || L.isEmpty(list)) {
       insert(item, msecs);
     } else {
       item._idleStart = new Date();