Show errors when ICE fails

This commit is contained in:
Sergey Stepanov 2023-05-17 08:57:16 +03:00
parent 851d9a6fc1
commit 624eecd4e8
No known key found for this signature in database
GPG key ID: A56B4929BAA8556B
2 changed files with 9 additions and 3 deletions

View file

@ -141,8 +141,12 @@ func (p *Peer) handleICEState(onConnect func()) func(webrtc.ICEConnectionState)
// nothing
case webrtc.ICEConnectionStateConnected:
onConnect()
case webrtc.ICEConnectionStateFailed,
webrtc.ICEConnectionStateClosed,
case webrtc.ICEConnectionStateFailed:
p.log.Error().Msgf("WebRTC connection fail! connection: %v, ice: %v, gathering: %v, signalling: %v",
p.conn.ConnectionState(), p.conn.ICEConnectionState(), p.conn.ICEGatheringState(),
p.conn.SignalingState())
p.Disconnect()
case webrtc.ICEConnectionStateClosed,
webrtc.ICEConnectionStateDisconnected:
p.Disconnect()
default:

View file

@ -105,7 +105,9 @@ const webrtc = (() => {
break;
}
case 'disconnected': {
log.info('[rtc] disconnected...');
log.info(`[rtc] disconnected... ` +
`connection: ${connection.connectionState}, ice: ${connection.iceConnectionState}, ` +
`gathering: ${connection.iceGatheringState}, signalling: ${connection.signalingState}`)
connected = false;
event.pub(WEBRTC_CONNECTION_CLOSED);
break;