mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
WebRTC + peer closed.
This commit is contained in:
parent
4670b5187c
commit
c61f5f2835
@ -153,15 +153,18 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session) (string, bool
|
|||||||
|
|
||||||
connection.OnConnectionStateChange(func(state webrtc.PeerConnectionState) {
|
connection.OnConnectionStateChange(func(state webrtc.PeerConnectionState) {
|
||||||
switch state {
|
switch state {
|
||||||
case webrtc.PeerConnectionStateDisconnected:
|
|
||||||
manager.logger.Info().Str("id", session.ID()).Msg("peer disconnected successfully")
|
|
||||||
session.SetWebRTCConnected(false)
|
|
||||||
case webrtc.PeerConnectionStateFailed:
|
|
||||||
manager.logger.Warn().Str("id", session.ID()).Msg("peer disconnected with error")
|
|
||||||
session.SetWebRTCConnected(false)
|
|
||||||
case webrtc.PeerConnectionStateConnected:
|
case webrtc.PeerConnectionStateConnected:
|
||||||
manager.logger.Info().Str("id", session.ID()).Msg("peer connected")
|
manager.logger.Info().Str("id", session.ID()).Msg("peer connected")
|
||||||
session.SetWebRTCConnected(true)
|
session.SetWebRTCConnected(true)
|
||||||
|
case webrtc.PeerConnectionStateDisconnected:
|
||||||
|
manager.logger.Info().Str("id", session.ID()).Msg("peer disconnected")
|
||||||
|
session.SetWebRTCConnected(false)
|
||||||
|
case webrtc.PeerConnectionStateFailed:
|
||||||
|
manager.logger.Warn().Str("id", session.ID()).Msg("peer failed")
|
||||||
|
session.SetWebRTCConnected(false)
|
||||||
|
case webrtc.PeerConnectionStateClosed:
|
||||||
|
manager.logger.Warn().Str("id", session.ID()).Msg("peer closed")
|
||||||
|
session.SetWebRTCConnected(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user