Skip to content

Commit 0555339

Browse files
authored
fix: constrain ip6 ws listener to ip6 stack (#3011)
Applies fix from #3010 to ws listener
1 parent 22e62d0 commit 0555339

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/transport-websockets/src/listener.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,13 @@ export class WebSocketListener extends TypedEventEmitter<ListenerEvents> impleme
249249
}
250250

251251
this.listeningMultiaddr = ma
252-
const { host, port } = ma.toOptions()
253-
this.addr = `${host}:${port}`
252+
const options = ma.toOptions()
253+
this.addr = `${options.host}:${options.port}`
254254

255-
this.server.listen(port, host)
255+
this.server.listen({
256+
...options,
257+
ipv6Only: options.family === 6
258+
})
256259

257260
await new Promise<void>((resolve, reject) => {
258261
const onListening = (): void => {

0 commit comments

Comments
 (0)