Skip to content

Commit a2a4da4

Browse files
committed
Add comment clarifying channel buffer
1 parent e154d6e commit a2a4da4

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

peer/conn.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ func newWithClientOrServer(servers []webrtc.ICEServer, client bool, opts *ConnOp
6262
return nil, xerrors.Errorf("create peer connection: %w", err)
6363
}
6464
conn := &Conn{
65-
pingChannelID: 1,
66-
pingEchoChannelID: 2,
67-
opts: opts,
68-
rtc: rtc,
69-
offerrer: client,
70-
closed: make(chan struct{}),
71-
dcOpenChannel: make(chan *webrtc.DataChannel),
72-
dcDisconnectChannel: make(chan struct{}),
73-
dcFailedChannel: make(chan struct{}),
65+
pingChannelID: 1,
66+
pingEchoChannelID: 2,
67+
opts: opts,
68+
rtc: rtc,
69+
offerrer: client,
70+
closed: make(chan struct{}),
71+
dcOpenChannel: make(chan *webrtc.DataChannel),
72+
dcDisconnectChannel: make(chan struct{}),
73+
dcFailedChannel: make(chan struct{}),
74+
// This channel needs to be bufferred otherwise slow consumers
75+
// of this will cause a connection failure.
7476
localCandidateChannel: make(chan webrtc.ICECandidateInit, 16),
7577
pendingRemoteCandidates: make([]webrtc.ICECandidateInit, 0),
7678
localSessionDescriptionChannel: make(chan webrtc.SessionDescription),

peer/conn_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ var (
4848
)
4949

5050
func TestMain(m *testing.M) {
51-
goleak.VerifyTestMain(m)
51+
// pion/ice doesn't properly close immediately. The solution for this isn't yet known. See:
52+
// https://github.com/pion/ice/pull/413
53+
goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("github.com/pion/ice/v2.(*Agent).startOnConnectionStateChangeRoutine.func1 "))
5254
}
5355

5456
func TestConn(t *testing.T) {

0 commit comments

Comments
 (0)