From 51aaa11558797ce7dbfc99dabdcf79641d9bd15a Mon Sep 17 00:00:00 2001 From: LUJIAN <504439788@qq.com> Date: Fri, 28 Jun 2024 16:25:23 +0800 Subject: [PATCH] fix socket connection failed cannot throw an exception --- src/SuperSocket.Client/SocketConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SuperSocket.Client/SocketConnector.cs b/src/SuperSocket.Client/SocketConnector.cs index b2143e698..15e7d1697 100644 --- a/src/SuperSocket.Client/SocketConnector.cs +++ b/src/SuperSocket.Client/SocketConnector.cs @@ -49,7 +49,7 @@ protected override async ValueTask ConnectAsync(EndPoint remoteEnd var tcs = new TaskCompletionSource(); cancellationToken.Register(() => tcs.SetResult(false)); - await Task.WhenAny(new[] { connectTask, tcs.Task }); + await Task.WhenAny(new[] { connectTask, tcs.Task }).Unwrap(); if (!socket.Connected) {