Skip to content

Commit

Permalink
fix panic nil on close client
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohan Totting committed Aug 1, 2024
1 parent 9f06c24 commit 93308b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,9 @@ func (c *Client) afterClosed() {

c.state.Store(ClientStateEnded)

c.internalDataChannel.Close()
if c.internalDataChannel != nil {
c.internalDataChannel.Close()
}

c.onLeft()

Expand Down
6 changes: 3 additions & 3 deletions testhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ func CreatePeerPair(ctx context.Context, log logging.LeveledLogger, room *Room,

currentTranscv := len(pc.GetTransceivers())

log.Infof("test: got renegotiation ", peerName)
defer log.Infof("test: renegotiation done ", peerName)
log.Infof("test: got renegotiation %s", peerName)
defer log.Infof("test: renegotiation done %s", peerName)
if err = pc.SetRemoteDescription(offer); err != nil {
return webrtc.SessionDescription{}, err
}
Expand All @@ -554,7 +554,7 @@ func CreatePeerPair(ctx context.Context, log logging.LeveledLogger, room *Room,
}

newTcv := len(pc.GetTransceivers()) - currentTranscv
log.Infof("test: new transceiver ", newTcv, " total tscv ", len(pc.GetTransceivers()))
log.Infof("test: new transceiver %d total tscv %d", newTcv, len(pc.GetTransceivers()))

peer.Mu.Lock()
peer.IsInRenegotiation = false
Expand Down

0 comments on commit 93308b7

Please sign in to comment.