diff --git a/app/reverse/bridge.go b/app/reverse/bridge.go index 0d65a7071..99c644e4b 100644 --- a/app/reverse/bridge.go +++ b/app/reverse/bridge.go @@ -137,7 +137,7 @@ func (w *BridgeWorker) Close() error { } func (w *BridgeWorker) IsActive() bool { - return w.state == Control_ACTIVE + return w.state == Control_ACTIVE && !w.worker.Closed() } func (w *BridgeWorker) Connections() uint32 { diff --git a/common/mux/server.go b/common/mux/server.go index 68eac8f1c..979eeec7e 100644 --- a/common/mux/server.go +++ b/common/mux/server.go @@ -96,6 +96,10 @@ func (w *ServerWorker) ActiveConnections() uint32 { return uint32(w.sessionManager.Size()) } +func (w *ServerWorker) Closed() bool { + return w.sessionManager.Closed() +} + func (w *ServerWorker) handleStatusKeepAlive(meta *FrameMetadata, reader *buf.BufferedReader) error { if meta.Option.Has(OptionData) { return buf.Copy(NewStreamReader(reader), buf.Discard) diff --git a/common/mux/session.go b/common/mux/session.go index 53c041510..c0759f96f 100644 --- a/common/mux/session.go +++ b/common/mux/session.go @@ -22,6 +22,13 @@ func NewSessionManager() *SessionManager { } } +func (m *SessionManager) Closed() bool { + m.RLock() + defer m.RUnlock() + + return m.closed +} + func (m *SessionManager) Size() int { m.RLock() defer m.RUnlock()