mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
destroy WS and WebRTC peers before assigning.
This commit is contained in:
parent
c8200e3bb7
commit
c54703d7d7
@ -118,6 +118,12 @@ func (session *SessionCtx) GetState() types.MemberState {
|
|||||||
// ---
|
// ---
|
||||||
|
|
||||||
func (session *SessionCtx) SetWebSocketPeer(websocket_peer types.WebSocketPeer) {
|
func (session *SessionCtx) SetWebSocketPeer(websocket_peer types.WebSocketPeer) {
|
||||||
|
if session.websocket_peer != nil {
|
||||||
|
if err := session.websocket_peer.Destroy(); err != nil {
|
||||||
|
session.logger.Warn().Err(err).Msgf("websocket destroy has failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session.websocket_peer = websocket_peer
|
session.websocket_peer = websocket_peer
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +182,12 @@ func (session *SessionCtx) Disconnect(reason string) error {
|
|||||||
// ---
|
// ---
|
||||||
|
|
||||||
func (session *SessionCtx) SetWebRTCPeer(webrtc_peer types.WebRTCPeer) {
|
func (session *SessionCtx) SetWebRTCPeer(webrtc_peer types.WebRTCPeer) {
|
||||||
|
if session.webrtc_peer != nil {
|
||||||
|
if err := session.webrtc_peer.Destroy(); err != nil {
|
||||||
|
session.logger.Warn().Err(err).Msgf("webrtc destroy has failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session.webrtc_peer = webrtc_peer
|
session.webrtc_peer = webrtc_peer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user