From 9157b5bf6735275b69a049da4e041367be8da801 Mon Sep 17 00:00:00 2001 From: Zuhair Zaki <141129124+ZuhairORZaki@users.noreply.github.com> Date: Tue, 14 Jan 2025 10:30:15 +0600 Subject: [PATCH] fix(client): Potential channel blocking issue for SCTP endpoints (#962) fixing channel blocking in client.go Co-authored-by: TwiN --- client/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index a7bb18da..299e1e22 100644 --- a/client/client.go +++ b/client/client.go @@ -96,16 +96,18 @@ func CanCreateUDPConnection(address string, config *Config) bool { // CanCreateSCTPConnection checks whether a connection can be established with a SCTP endpoint func CanCreateSCTPConnection(address string, config *Config) bool { - ch := make(chan bool) + ch := make(chan bool, 1) go (func(res chan bool) { addr, err := sctp.ResolveSCTPAddr("sctp", address) if err != nil { res <- false + return } conn, err := sctp.DialSCTP("sctp", nil, addr) if err != nil { res <- false + return } _ = conn.Close() res <- true