Skip to content

Commit 86cb3d4

Browse files
committed
Remove flushed
1 parent 107eb96 commit 86cb3d4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

peer/conn.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,8 @@ type Conn struct {
129129
localSessionDescriptionChannel chan webrtc.SessionDescription
130130
remoteSessionDescriptionChannel chan webrtc.SessionDescription
131131

132-
pendingRemoteCandidates []webrtc.ICECandidateInit
133-
pendingCandidatesMutex sync.Mutex
134-
pendingCandidatesFlushed bool
132+
pendingRemoteCandidates []webrtc.ICECandidateInit
133+
pendingCandidatesMutex sync.Mutex
135134

136135
pingChannelID uint16
137136
pingEchoChannelID uint16
@@ -352,7 +351,6 @@ func (c *Conn) negotiate() {
352351
c.opts.Logger.Debug(context.Background(), "flushed buffered remote candidates",
353352
slog.F("count", len(c.pendingRemoteCandidates)),
354353
)
355-
c.pendingCandidatesFlushed = true
356354
c.pendingRemoteCandidates = make([]webrtc.ICECandidateInit, 0)
357355
c.pendingCandidatesMutex.Unlock()
358356

@@ -395,7 +393,7 @@ func (c *Conn) AddRemoteCandidate(i webrtc.ICECandidateInit) error {
395393
slog.F("hash", c.hashCandidate(i)),
396394
slog.F("length", len(i.Candidate)),
397395
}
398-
if !c.pendingCandidatesFlushed {
396+
if c.rtc.RemoteDescription() == nil {
399397
c.opts.Logger.Debug(context.Background(), "bufferring remote candidate", fields...)
400398
c.pendingRemoteCandidates = append(c.pendingRemoteCandidates, i)
401399
return nil

0 commit comments

Comments
 (0)