summaryrefslogtreecommitdiff
path: root/lib/dgram.js
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2015-05-04 14:40:25 -0400
committerBrian White <mscdex@mscdex.net>2015-05-25 10:14:18 -0400
commit5abd4ac079b390467360d671a186a061b5aba736 (patch)
tree5965f0c339836e6e50da1e44dd16f91746e2cf8c /lib/dgram.js
parenta74c2c94584aea67276ee15a67d9165bfd4ee9a5 (diff)
downloadnodejs-5abd4ac079b390467360d671a186a061b5aba736.tar.gz
nodejs-5abd4ac079b390467360d671a186a061b5aba736.tar.bz2
nodejs-5abd4ac079b390467360d671a186a061b5aba736.zip
lib: simplify nextTick() usage
This commit removes unnecessary nextTick() closures and adds some shared nextTick() callbacks for better re-use. PR-URL: https://github.com/nodejs/io.js/pull/1612 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
Diffstat (limited to 'lib/dgram.js')
-rw-r--r--lib/dgram.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/dgram.js b/lib/dgram.js
index f95b44926..f30e562c3 100644
--- a/lib/dgram.js
+++ b/lib/dgram.js
@@ -320,19 +320,14 @@ Socket.prototype.send = function(buffer,
!!callback);
if (err && callback) {
// don't emit as error, dgram_legacy.js compatibility
- process.nextTick(sendEmitErrorNT, err, address, port, callback);
+ var ex = exceptionWithHostPort(err, 'send', address, port);
+ process.nextTick(callback, ex);
}
}
});
};
-function sendEmitErrorNT(err, address, port, callback) {
- var ex = exceptionWithHostPort(err, 'send', address, port);
- callback(ex);
-}
-
-
function afterSend(err) {
if (err) {
err = exceptionWithHostPort(err, 'send', this.address, this.port);