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
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

fix: TCP connections leaking after RTC disconnects#397

Merged
kylecarbs merged 8 commits intomasterfromleakyconn
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
NextNext commit
Add switch
  • Loading branch information
@kylecarbs
kylecarbs committedJul 22, 2021
commitc8ec3e171235e514324e034ad89eb49c6b486a5b
18 changes: 4 additions & 14 deletionswsnet/dial_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -297,21 +297,11 @@ func TestDial(t *testing.T) {
closeTurn()

list := l.(*listener)

for i := 0; i < 15; i++ {
time.Sleep(time.Second)

assert.Eventually(t, func() bool {
list.connClosersMut.Lock()
size := len(list.connClosers)
list.connClosersMut.Unlock()
if size == 0 {
break
}
}

list.connClosersMut.Lock()
assert.Equal(t, 0, len(list.connClosers))
list.connClosersMut.Unlock()
defer list.connClosersMut.Unlock()
return len(list.connClosers) == 0
}, time.Second*15, time.Second)
})
}

Expand Down
6 changes: 3 additions & 3 deletionswsnet/listen.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -256,10 +256,10 @@ func (l *listener) negotiate(ctx context.Context, conn net.Conn) {
}
rtc.OnConnectionStateChange(func(pcs webrtc.PeerConnectionState) {
l.log.Info(ctx, "connection state change", slog.F("state", pcs.String()))
if pcs == webrtc.PeerConnectionStateConnecting {
switch pcs {
case webrtc.PeerConnectionStateConnected:
return
}
if pcs == webrtc.PeerConnectionStateConnected {
case webrtc.PeerConnectionStateConnecting:
// Safe to close the negotiating WebSocket.
_ = conn.Close()
return
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp