From: Bert Belder Date: Mon, 5 Sep 2011 01:30:12 +0000 (+0200) Subject: dgram-uv: black hole incoming messages after closing X-Git-Tag: v0.5.6~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5d58f11cb9e5a56a590631a8b87a5b99e942365;p=platform%2Fupstream%2Fnodejs.git dgram-uv: black hole incoming messages after closing Fixes test/simple/test-dgram-pingpong.js on windows --- diff --git a/lib/dgram_uv.js b/lib/dgram_uv.js index 117f871..4356447 100644 --- a/lib/dgram_uv.js +++ b/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