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