Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ func (e *RTCEngine) createSubscriberPCLocked(configuration webrtc.Configuration)
} else if c.Label() == lossyDataChannelName {
e.lossyDCSub = c
} else {
e.log.Warnw("received unknown data channel label, ignoring", nil, "label", c.Label())
return
}
c.OnMessage(e.handleDataPacket)
Expand Down Expand Up @@ -626,6 +627,7 @@ func (e *RTCEngine) UnregisterTrackPublishedListener(cid string) {
func (e *RTCEngine) handleDataPacket(msg webrtc.DataChannelMessage) {
packet, err := e.readDataPacket(msg)
if err != nil {
e.log.Warnw("failed to parse data packet", err, "isString", msg.IsString)
return
}
identity := packet.ParticipantIdentity
Expand Down Expand Up @@ -733,10 +735,10 @@ func (e *RTCEngine) handleDisconnect(fullReconnect bool) {
}
}

delay := time.Duration(reconnectCount*reconnectCount) * initialReconnectInterval
if delay > maxReconnectInterval {
break
}
// Quadratic backoff: delay grows as reconnectCount² × initialReconnectInterval.
// Clamped to maxReconnectInterval so a future increase to maxReconnectCount
// cannot produce unbounded delays or skip the final OnDisconnected call.
delay := min(time.Duration(reconnectCount*reconnectCount)*initialReconnectInterval, maxReconnectInterval)
if reconnectCount < maxReconnectCount-1 {
time.Sleep(delay)
}
Expand Down
2 changes: 1 addition & 1 deletion localparticipant.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ func (p *LocalParticipant) updateSubscriptionPermissionLocked() {
}

if err := p.engine.SendSubscriptionPermission(p.subscriptionPermission); err != nil {
logger.Errorw(
p.log.Errorw(
"could not send subscription permission", err,
"participant", p.identity,
"participantID", p.sid,
Expand Down
1 change: 1 addition & 0 deletions remoteparticipant.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func (p *RemoteParticipant) addSubscribedMediaTrack(
}
time.Sleep(50 * time.Millisecond)
}
p.engine.log.Warnw("timed out waiting for track publication metadata", nil, "trackSID", trackSID, "participant", p.Identity())
p.Callback.OnTrackSubscriptionFailed(trackSID, p)
p.roomCallback.OnTrackSubscriptionFailed(trackSID, p)
}()
Expand Down
3 changes: 3 additions & 0 deletions room.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ func (r *Room) OnDisconnected(reason DisconnectionReason) {
}

func (r *Room) OnRestarting() {
r.log.Infow("room connection restarting")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are engine logs for these events

r.setConnectionState(ConnectionStateReconnecting)
r.callback.OnReconnecting()

Expand Down Expand Up @@ -898,11 +899,13 @@ func (r *Room) OnRestarted(
}

func (r *Room) OnResuming() {
r.log.Infow("room connection resuming")
r.setConnectionState(ConnectionStateReconnecting)
r.callback.OnReconnecting()
}

func (r *Room) OnResumed() {
r.log.Infow("room connection resumed")
r.setConnectionState(ConnectionStateConnected)
r.callback.OnReconnected()
r.sendSyncState()
Expand Down
Loading