fix(client): Potential channel blocking issue for SCTP endpoints (#962)
fixing channel blocking in client.go Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
parent
1ddaf5f3e5
commit
9157b5bf67
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user