Dont duplicate interfaces on port change

This commit is contained in:
2026-08-01 06:31:15 +03:00
parent a2ae800a19
commit bc0ef8c613
2 changed files with 24 additions and 6 deletions
+18
View File
@@ -99,5 +99,23 @@ export const setInterfaces = sdk.setupInterfaces(async ({ effects }) => {
receipts.push(await tlsOrigin.export([stratumTls]))
}
// Drop bindings we no longer use. `bindPort` registers a binding per
// (hostId, internalPort) and nothing removes the old one when the user
// changes a port in Configure — the stale binding lingers and the OS lists
// its interface again, so the UI shows two identical "Stratum" entries (and
// keeps a forward open on the abandoned port). Packages with fixed ports
// never hit this; ours has user-configurable ports, so it must clean up
// after itself. Runs last, after the current bindings exist, so the `except`
// list is exactly what we just bound.
await sdk.clearBindings(effects, {
except: [
{ id: uiHostId, internalPort: uiPort },
{ id: stratumHostId, internalPort: stratumPort },
...(ports?.tlsEnabled
? [{ id: stratumTlsHostId, internalPort: stratumTlsPort }]
: []),
],
})
return receipts
})