fix: Leaking yamux session after HTTP handler is closed (#329)

* fix: Leaking yamux session after HTTP handler is closed

Closes #317. The httptest server cancels the context after the connection
is closed, but if a connection takes a long time to close, the request
would never end. This applies a context to the entire listener that cancels
on test cleanup.

After discussion with @bryphe-coder, reducing the parallel limit on
Windows is likely to reduce failures as well.

* Switch to windows-2022 to improve decompression

* Invalidate cache on matrix OS
This commit is contained in:
Kyle Carberry
2022-02-18 22:06:56 -06:00
committed by GitHub
parent f7b484929f
commit 65de96c8b4
6 changed files with 43 additions and 15 deletions
+9 -6
View File
@@ -183,12 +183,15 @@ func (c *Conn) init() error {
}
})
c.rtc.OnConnectionStateChange(func(peerConnectionState webrtc.PeerConnectionState) {
if c.isClosed() {
// Make sure we don't log after Close() has been called.
return
}
c.opts.Logger.Debug(context.Background(), "rtc connection updated",
slog.F("state", peerConnectionState))
go func() {
c.closeMutex.Lock()
defer c.closeMutex.Unlock()
if c.isClosed() {
return
}
c.opts.Logger.Debug(context.Background(), "rtc connection updated",
slog.F("state", peerConnectionState))
}()
switch peerConnectionState {
case webrtc.PeerConnectionStateDisconnected: