Dont duplicate interfaces on port change
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user