From 7bb57225d9a03ace1705be421293badc39821a68 Mon Sep 17 00:00:00 2001 From: sukun Date: Thu, 4 Apr 2024 19:45:46 +0530 Subject: [PATCH] Fix lint --- association.go | 3 ++- association_test.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/association.go b/association.go index 3938df8..c794222 100644 --- a/association.go +++ b/association.go @@ -50,6 +50,7 @@ var ( ErrChunkTypeUnhandled = errors.New("unhandled chunk type") ErrHandshakeInitAck = errors.New("handshake failed (INIT ACK)") ErrHandshakeCookieEcho = errors.New("handshake failed (COOKIE ECHO)") + ErrTooManyReconfigRequests = errors.New("too many outstanding reconfig requests") ) const ( @@ -2152,7 +2153,7 @@ func (a *Association) handleReconfigParam(raw param) (*packet, error) { // So, if the Re-configuration Timer is running and the RE-CONFIG chunk // contains at least one request parameter, the chunk MUST be buffered. // chrome: https://chromium.googlesource.com/external/webrtc/+/refs/heads/main/net/dcsctp/socket/stream_reset_handler.cc#271 - return nil, fmt.Errorf("too many outstanding reconfig requests: %d", len(a.reconfigRequests)) + return nil, fmt.Errorf("%w: %d", ErrTooManyReconfigRequests, len(a.reconfigRequests)) } a.reconfigRequests[p.reconfigRequestSequenceNumber] = p resp := a.resetStreamsIfAny(p) diff --git a/association_test.go b/association_test.go index e21b841..8b87c95 100644 --- a/association_test.go +++ b/association_test.go @@ -3423,8 +3423,6 @@ func TestAssociation_ReconfigRequestsLimited(t *testing.T) { }() a1, a2 := <-a1chan, <-a2chan - defer a1.Close() - defer a2.Close() writeStream, err := a1.OpenStream(1, PayloadTypeWebRTCString) require.NoError(t, err) @@ -3467,4 +3465,7 @@ func TestAssociation_ReconfigRequestsLimited(t *testing.T) { a2.lock.RLock() require.LessOrEqual(t, len(a2.reconfigRequests), maxReconfigRequests) a2.lock.RUnlock() + + require.NoError(t, a1.Close()) + require.NoError(t, a2.Close()) }