mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-02-06 08:15:44 -05:00
close mux session on end
This commit is contained in:
@@ -115,36 +115,17 @@ func (m *SessionManager) Close() {
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
sync.Mutex
|
||||
input ray.InputStream
|
||||
output ray.OutputStream
|
||||
parent *SessionManager
|
||||
ID uint16
|
||||
uplinkClosed bool
|
||||
downlinkClosed bool
|
||||
transferType protocol.TransferType
|
||||
input ray.InputStream
|
||||
output ray.OutputStream
|
||||
parent *SessionManager
|
||||
ID uint16
|
||||
transferType protocol.TransferType
|
||||
}
|
||||
|
||||
func (s *Session) CloseUplink() {
|
||||
var allDone bool
|
||||
s.Lock()
|
||||
s.uplinkClosed = true
|
||||
allDone = s.uplinkClosed && s.downlinkClosed
|
||||
s.Unlock()
|
||||
if allDone {
|
||||
s.parent.Remove(s.ID)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Session) CloseDownlink() {
|
||||
var allDone bool
|
||||
s.Lock()
|
||||
s.downlinkClosed = true
|
||||
allDone = s.uplinkClosed && s.downlinkClosed
|
||||
s.Unlock()
|
||||
if allDone {
|
||||
s.parent.Remove(s.ID)
|
||||
}
|
||||
func (s *Session) Close() {
|
||||
s.output.Close()
|
||||
s.input.Close()
|
||||
s.parent.Remove(s.ID)
|
||||
}
|
||||
|
||||
func (s *Session) NewReader(reader io.Reader) buf.Reader {
|
||||
|
||||
Reference in New Issue
Block a user