From 61abac244b2647ead88b4ceac6fd422af6b71a47 Mon Sep 17 00:00:00 2001 From: Cedric Raymond Date: Fri, 23 Aug 2024 13:34:03 -0400 Subject: [PATCH] add shutdown to close --- sctptransport.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sctptransport.go b/sctptransport.go index d26ca3f806e..52bbb59493c 100644 --- a/sctptransport.go +++ b/sctptransport.go @@ -7,6 +7,7 @@ package webrtc import ( + "context" "errors" "io" "math" @@ -153,6 +154,10 @@ func (r *SCTPTransport) Stop() error { if r.sctpAssociation == nil { return nil } + + var ctx, _ = context.WithTimeout(context.Background(), 10*time.Second) + r.sctpAssociation.Shutdown(ctx) + err := r.sctpAssociation.Close() if err != nil { return err