Skip to content

Commit dfdcccd

Browse files
committed
test: 重构代码提高覆盖率
1 parent 1afd090 commit dfdcccd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/BootstrapBlazor/Services/TcpSocket/TcpSocketClientBase.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,14 @@ public virtual async ValueTask<bool> SendAsync(ReadOnlyMemory<byte> data, Cancel
148148
}
149149
catch (OperationCanceledException ex)
150150
{
151-
Log(LogLevel.Warning, ex, token.IsCancellationRequested
152-
? $"TCP Socket send operation was canceled from {_localEndPoint} to {_remoteEndPoint}"
153-
: $"TCP Socket send operation timed out from {_localEndPoint} to {_remoteEndPoint}");
151+
if (token.IsCancellationRequested)
152+
{
153+
Log(LogLevel.Warning, ex, $"TCP Socket send operation was canceled from {_localEndPoint} to {_remoteEndPoint}");
154+
}
155+
else
156+
{
157+
Log(LogLevel.Warning, ex, $"TCP Socket send operation timed out from {_localEndPoint} to {_remoteEndPoint}");
158+
}
154159
}
155160
catch (Exception ex)
156161
{

0 commit comments

Comments
 (0)