From b5d58f11cb9e5a56a590631a8b87a5b99e942365 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 5 Sep 2011 03:30:12 +0200 Subject: [PATCH] dgram-uv: black hole incoming messages after closing Fixes test/simple/test-dgram-pingpong.js on windows --- lib/dgram_uv.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/dgram_uv.js b/lib/dgram_uv.js index 117f871d1db..43564470977 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