summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-11-01 19:50:16 +0100
committerAnna Henningsen <anna@addaleax.net>2019-11-07 00:54:59 +0100
commit99e874e545b7c69bbd22c93b7546037290a727d3 (patch)
treef35a04918872db1ac89226da43111fc178d612e6 /lib
parentd4b2cc7ead4ffdbe8091c7cb0e6a621be712a79b (diff)
downloadandroid-node-v8-99e874e545b7c69bbd22c93b7546037290a727d3.tar.gz
android-node-v8-99e874e545b7c69bbd22c93b7546037290a727d3.tar.bz2
android-node-v8-99e874e545b7c69bbd22c93b7546037290a727d3.zip
dgram: reset bind state before emitting error
This was previously done inconsistently, sometimes before, sometimes after emitting the event. PR-URL: https://github.com/nodejs/node/pull/30210 Fixes: https://github.com/nodejs/node/issues/30209 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/dgram.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/dgram.js b/lib/dgram.js
index d29d1e7b19..35d414320a 100644
--- a/lib/dgram.js
+++ b/lib/dgram.js
@@ -240,8 +240,8 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
}, (err) => {
// Callback to handle error.
const ex = errnoException(err, 'open');
- this.emit('error', ex);
state.bindState = BIND_STATE_UNBOUND;
+ this.emit('error', ex);
});
return this;
}
@@ -309,8 +309,8 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
}, (err) => {
// Callback to handle error.
const ex = exceptionWithHostPort(err, 'bind', ip, port);
- this.emit('error', ex);
state.bindState = BIND_STATE_UNBOUND;
+ this.emit('error', ex);
});
} else {
if (!state.handle)
@@ -319,8 +319,8 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
const err = state.handle.bind(ip, port || 0, flags);
if (err) {
const ex = exceptionWithHostPort(err, 'bind', ip, port);
- this.emit('error', ex);
state.bindState = BIND_STATE_UNBOUND;
+ this.emit('error', ex);
// Todo: close?
return;
}