Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit 9cdf8d9

Browse files
committed
quic: allow .connect() when socket is already bound
1 parent bbd5631 commit 9cdf8d9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/internal/quic/core.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -910,13 +910,18 @@ class QuicSocket extends EventEmitter {
910910
if (typeof callback === 'function')
911911
session.on('ready', callback);
912912

913-
this[kMaybeBind](
914-
connectAfterBind.bind(
915-
this,
916-
session,
917-
this.#lookup,
918-
address,
919-
getSocketType(type)));
913+
const afterBind =
914+
connectAfterBind.bind(
915+
this,
916+
session,
917+
this.#lookup,
918+
address,
919+
getSocketType(type));
920+
if (this.#state === kSocketBound) {
921+
afterBind();
922+
} else {
923+
this[kMaybeBind](afterBind);
924+
}
920925

921926
return session;
922927
}

0 commit comments

Comments
 (0)