mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-05 09:47:56 -05:00
handle status keep alive
This commit is contained in:
parent
8800238d24
commit
9b834a2148
@ -9,9 +9,10 @@ import (
|
||||
type SessionStatus byte
|
||||
|
||||
const (
|
||||
SessionStatusNew SessionStatus = 0x01
|
||||
SessionStatusKeep SessionStatus = 0x02
|
||||
SessionStatusEnd SessionStatus = 0x03
|
||||
SessionStatusNew SessionStatus = 0x01
|
||||
SessionStatusKeep SessionStatus = 0x02
|
||||
SessionStatusEnd SessionStatus = 0x03
|
||||
SessionStatusKeepAlive SessionStatus = 0x04
|
||||
)
|
||||
|
||||
type Option byte
|
||||
|
@ -295,6 +295,16 @@ func (m *Client) fetchOutput() {
|
||||
log.Trace(newError("failed to read metadata").Base(err))
|
||||
break
|
||||
}
|
||||
if meta.SessionStatus == SessionStatusKeepAlive {
|
||||
if meta.Option.Has(OptionData) {
|
||||
if err := drain(reader); err != nil {
|
||||
log.Trace(newError("failed to read data").Base(err))
|
||||
break
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
m.access.RLock()
|
||||
s, found := m.sessions[meta.SessionID]
|
||||
m.access.RUnlock()
|
||||
@ -390,6 +400,16 @@ func (w *ServerWorker) run(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if meta.SessionStatus == SessionStatusKeepAlive {
|
||||
if meta.Option.Has(OptionData) {
|
||||
if err := drain(reader); err != nil {
|
||||
log.Trace(newError("failed to read data").Base(err))
|
||||
break
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
w.access.RLock()
|
||||
s, found := w.sessions[meta.SessionID]
|
||||
w.access.RUnlock()
|
||||
|
Loading…
Reference in New Issue
Block a user