serve: avoid fake socket listener port
This commit is contained in:
parent
3caba56bd9
commit
91d148d95f
1 changed files with 3 additions and 3 deletions
|
|
@ -119,7 +119,7 @@ const listenEffect: (opts: ListenOptions) => Effect.Effect<EffectListener, unkno
|
||||||
function* (opts: ListenOptions) {
|
function* (opts: ListenOptions) {
|
||||||
const state = yield* startWithPortFallback(opts)
|
const state = yield* startWithPortFallback(opts)
|
||||||
if (opts.type === "socket") {
|
if (opts.type === "socket") {
|
||||||
const listenerUrl = makeURL("localhost", 0)
|
const listenerUrl = makeURL("localhost")
|
||||||
url = listenerUrl
|
url = listenerUrl
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -194,10 +194,10 @@ function tcpAddress(state: ListenerState) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeURL(hostname: string, port: number) {
|
function makeURL(hostname: string, port?: number) {
|
||||||
const result = new URL("http://localhost")
|
const result = new URL("http://localhost")
|
||||||
result.hostname = hostname
|
result.hostname = hostname
|
||||||
result.port = String(port)
|
if (port !== undefined) result.port = String(port)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue