1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-10 09:50:43 +00:00

detect underlying mux worker closed

This commit is contained in:
Darien Raymond 2018-10-29 12:51:56 +01:00
parent f3ad8acbe4
commit ff310d6bc6
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
3 changed files with 12 additions and 1 deletions

View File

@ -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 {

View File

@ -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)

View File

@ -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()