Add hack to get error event on socket timeout
authorRyan Dahl <ry@tinyclouds.org>
Tue, 23 Feb 2010 06:12:21 +0000 (22:12 -0800)
committerRyan Dahl <ry@tinyclouds.org>
Tue, 23 Feb 2010 21:05:15 +0000 (13:05 -0800)
See
http://groups.google.com/group/nodejs/browse_thread/thread/4898a1ed3b99dcf0

deps/evcom/evcom.c

index 0f48ab0..1ee02a1 100644 (file)
@@ -1018,6 +1018,11 @@ on_timeout (EV_P_ ev_timer *watcher, int revents)
 
   if (stream->on_timeout) stream->on_timeout(stream);
 
+  // Hack to get error in Node on 'close' event.
+  // should probably be made into a proper error code.
+  stream->errorno = 1;
+
+  ev_timer_stop(EV_A_ watcher);
   evcom_stream_force_close(stream);
 
   if (stream->on_close) stream->on_close(stream);