dgram-uv: black hole incoming messages after closing
authorBert Belder <bertbelder@gmail.com>
Mon, 5 Sep 2011 01:30:12 +0000 (03:30 +0200)
committerBert Belder <bertbelder@gmail.com>
Mon, 5 Sep 2011 01:30:12 +0000 (03:30 +0200)
Fixes test/simple/test-dgram-pingpong.js on windows

lib/dgram_uv.js

index 117f871..4356447 100644 (file)
@@ -285,7 +285,11 @@ Socket.prototype._stopReceiving = function() {
   if (!this._receiving)
     return;
 
-  this._handle.onmessage = null;
+  // Black hole messages coming in when reading is stopped. Libuv might do
+  // this, but node applications (e.g. test/simple/test-dgram-pingpong) may
+  // not expect it.
+  this._handle.onmessage = noop;
+
   this._handle.recvStop();
   this._receiving = false;
   this.fd = null; // compatibility hack