23 lines
623 B
Go
23 lines
623 B
Go
package gateway
|
|
|
|
// stopLocked revokes admission and cancels active work. The manager lifecycle
|
|
// lock must be held so no connection or replacement listener can be published.
|
|
func (i *instance) stopLocked() {
|
|
i.stopping = true
|
|
i.cancel()
|
|
i.listener.Close()
|
|
if i.managementListener != nil {
|
|
i.managementListener.Close()
|
|
}
|
|
for connection := range i.connections {
|
|
connection.Close()
|
|
}
|
|
}
|
|
|
|
// waitStopped runs outside Manager.mu because connection cleanup needs that
|
|
// lock. Persistent targets remain owned until every accepted session exits.
|
|
func (i *instance) waitStopped() {
|
|
i.wg.Wait()
|
|
i.persistent.Close()
|
|
}
|