dgram: make send cb act as "error" event handler
authorMatteo Collina <hello@matteocollina.com>
Tue, 26 May 2015 07:17:00 +0000 (09:17 +0200)
committerRod Vagg <rod@vagg.org>
Tue, 4 Aug 2015 18:56:12 +0000 (11:56 -0700)
commitef2c8cd4ece424bf02048921b6709da411301c59
tree866f683b40a68c6170c96d588b9cdecefe2b1ead
parent3da057fef672da0d1f0173a2c8b4f64737917e19
dgram: make send cb act as "error" event handler

Modifies the dgram send() method to not emit errors when a DNS
lookup fails if there is a callback. Given that the same UDP
socket can be used to send messages to different hosts, the socket
can be reused even if one of those send() fails.

This slightly changes the behavior of a stable API, so that it behaves
as users would expect to.

This is based on https://github.com/joyent/node/pull/7738, which
landed in 77266d7fadd8dfefb107ccb1e3fe97f9620f1288.

Fixes: https://github.com/joyent/node/issues/4846
Refs: https://github.com/joyent/node/pull/7738
PR-URL: https://github.com/nodejs/io.js/pull/1796
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
doc/api/dgram.markdown
lib/dgram.js
test/internet/test-dgram-send-cb-quelches-error.js [new file with mode: 0644]
test/simple/test-dgram-send-cb-quelches-error.js [deleted file]