Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit82364d1

Browse files
authored
fix: ensure rtc state changes can't log after close (#1213)
1 parent00cac37 commit82364d1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎peer/conn.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,19 +221,35 @@ func (c *Conn) init() error {
221221
}
222222
}
223223
})
224+
225+
// These functions need to check if the conn is closed, because they can be
226+
// called after being closed.
224227
c.rtc.OnSignalingStateChange(func(signalState webrtc.SignalingState) {
228+
ifc.isClosed() {
229+
return
230+
}
225231
c.opts.Logger.Debug(context.Background(),"signaling state updated",
226232
slog.F("state",signalState))
227233
})
228234
c.rtc.SCTP().Transport().OnStateChange(func(dtlsTransportState webrtc.DTLSTransportState) {
235+
ifc.isClosed() {
236+
return
237+
}
229238
c.opts.Logger.Debug(context.Background(),"dtls transport state updated",
230239
slog.F("state",dtlsTransportState))
231240
})
232241
c.rtc.SCTP().Transport().ICETransport().OnSelectedCandidatePairChange(func(candidatePair*webrtc.ICECandidatePair) {
242+
ifc.isClosed() {
243+
return
244+
}
233245
c.opts.Logger.Debug(context.Background(),"selected candidate pair changed",
234246
slog.F("local",candidatePair.Local),slog.F("remote",candidatePair.Remote))
235247
})
236248
c.rtc.OnICECandidate(func(iceCandidate*webrtc.ICECandidate) {
249+
ifc.isClosed() {
250+
return
251+
}
252+
237253
ificeCandidate==nil {
238254
return
239255
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp