fix various race conditions

This commit is contained in:
aler9
2021-05-10 21:33:23 +02:00
parent ae3e3b19c0
commit c878b68b70
4 changed files with 8 additions and 0 deletions

View File

@@ -301,6 +301,8 @@ outer:
} }
} }
cc.ctxCancel()
cc.doClose(false) cc.doClose(false)
} }

View File

@@ -336,6 +336,8 @@ outer:
} }
} }
s.ctxCancel()
if s.udpRTCPListener != nil { if s.udpRTCPListener != nil {
s.udpRTCPListener.close() s.udpRTCPListener.close()
} }

View File

@@ -235,6 +235,8 @@ func (sc *ServerConn) run() {
} }
}() }()
sc.ctxCancel()
if sc.tcpFrameEnabled { if sc.tcpFrameEnabled {
sc.tcpFrameWriteBuffer.Close() sc.tcpFrameWriteBuffer.Close()
<-sc.tcpFrameBackgroundWriteDone <-sc.tcpFrameBackgroundWriteDone

View File

@@ -318,6 +318,8 @@ func (ss *ServerSession) run() {
} }
}() }()
ss.ctxCancel()
switch ss.state { switch ss.state {
case ServerSessionStatePlay: case ServerSessionStatePlay:
if *ss.setupProtocol == StreamProtocolUDP { if *ss.setupProtocol == StreamProtocolUDP {