Browse files

dgram-uv: black hole incoming messages after closing

Fixes test/simple/test-dgram-pingpong.js on windows
  • Loading branch information...
1 parent 01bf209 commit b5d58f11cb9e5a56a590631a8b87a5b99e942365 @piscisaureus piscisaureus committed Sep 5, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/dgram_uv.js
View
6 lib/dgram_uv.js
@@ -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

0 comments on commit b5d58f1

Please sign in to comment.