mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
fix deadlock.
This commit is contained in:
@ -68,14 +68,9 @@ func (peer *WebRTCPeerCtx) Destroy() {
|
||||
peer.mu.Lock()
|
||||
defer peer.mu.Unlock()
|
||||
|
||||
if peer.connection == nil || peer.connection.ConnectionState() != webrtc.PeerConnectionStateConnected {
|
||||
return
|
||||
if peer.connection != nil {
|
||||
err := peer.connection.Close()
|
||||
peer.logger.Err(err).Msg("peer connection destroyed")
|
||||
peer.connection = nil
|
||||
}
|
||||
|
||||
// TODO: Send webrtc disconnect event via websocket.
|
||||
|
||||
err := peer.connection.Close()
|
||||
peer.logger.Err(err).Msg("peer connection destroyed")
|
||||
|
||||
peer.connection = nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user