mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-17 12:56:41 +02:00
serve: avoid fake socket listener port
This commit is contained in:
@@ -119,7 +119,7 @@ const listenEffect: (opts: ListenOptions) => Effect.Effect<EffectListener, unkno
|
||||
function* (opts: ListenOptions) {
|
||||
const state = yield* startWithPortFallback(opts)
|
||||
if (opts.type === "socket") {
|
||||
const listenerUrl = makeURL("localhost", 0)
|
||||
const listenerUrl = makeURL("localhost")
|
||||
url = listenerUrl
|
||||
|
||||
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")
|
||||
result.hostname = hostname
|
||||
result.port = String(port)
|
||||
if (port !== undefined) result.port = String(port)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user