Skip to content

Commit

Permalink
remove another select statement and no longer check value returned by…
Browse files Browse the repository at this point in the history
… SelectContextOrWait()
  • Loading branch information
bashar-515 committed Jan 16, 2025
1 parent 6c9be34 commit 6788a38
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions rpc/wrtc_signaling_answerer.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ func (ans *webrtcSignalingAnswerer) Start() {
timeoutCancel()
if err != nil {
ans.logger.Errorw("error connecting answer client", "error", err)
if !utils.SelectContextOrWait(ctx, answererReconnectWait) {
return
}
utils.SelectContextOrWait(ctx, answererReconnectWait)
continue
}
ans.connMu.Lock()
Expand Down Expand Up @@ -166,10 +164,8 @@ func (ans *webrtcSignalingAnswerer) startAnswerer() {
}
}()
for {
select {
case <-ctx.Done():
if ctx.Err() != nil {
return
default:
}

var err error
Expand All @@ -178,9 +174,7 @@ func (ans *webrtcSignalingAnswerer) startAnswerer() {
if err != nil {
if isNetworkError(err) {
ans.logger.Warnw("error communicating with signaling server", "error", err)
if !utils.SelectContextOrWait(ctx, answererReconnectWait) {
return
}
utils.SelectContextOrWait(ctx, answererReconnectWait)
}
continue
}
Expand Down Expand Up @@ -210,9 +204,7 @@ func (ans *webrtcSignalingAnswerer) startAnswerer() {
if err != nil {
if isNetworkError(err) {
ans.logger.Warnw("error communicating with signaling server", "error", err)
if !utils.SelectContextOrWait(ctx, answererReconnectWait) {
return
}
utils.SelectContextOrWait(ctx, answererReconnectWait)
}
continue
}
Expand Down Expand Up @@ -251,9 +243,7 @@ func (ans *webrtcSignalingAnswerer) startAnswerer() {
answerCtxCancel()
// We received an error while trying to connect to a caller/peer.
ans.logger.Errorw("error connecting to peer", "error", err)
if !utils.SelectContextOrWait(ctx, answererReconnectWait) {
return
}
utils.SelectContextOrWait(ctx, answererReconnectWait)
}
answerCtxCancel()
}
Expand Down

0 comments on commit 6788a38

Please sign in to comment.