Skip to content

Commit

Permalink
Show errors when ICE fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sergystepanov committed May 17, 2023
1 parent 851d9a6 commit 624eecd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pkg/network/webrtc/webrtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion web/js/network/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 624eecd

Please sign in to comment.