Skip to content

Commit f65271a

Browse files
committed
test: 增加重连功能
1 parent 58b1349 commit f65271a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/BootstrapBlazor/Services/TcpSocket/DefaultTcpSocketClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace BootstrapBlazor.Components;
1313

1414
[UnsupportedOSPlatform("browser")]
15-
sealed class DefaultTcpSocketClient(IPEndPoint endPoint) : ITcpSocketClient
15+
sealed class DefaultTcpSocketClient(IPEndPoint localEndPoint) : ITcpSocketClient
1616
{
1717
private TcpClient? _client;
1818
private IDataPackageHandler? _dataPackageHandler;
@@ -21,7 +21,7 @@ sealed class DefaultTcpSocketClient(IPEndPoint endPoint) : ITcpSocketClient
2121

2222
public bool IsConnected => _client?.Connected ?? false;
2323

24-
public IPEndPoint LocalEndPoint { get; set; } = endPoint;
24+
public IPEndPoint LocalEndPoint => localEndPoint;
2525

2626
[NotNull]
2727
public ILogger<DefaultTcpSocketClient>? Logger { get; set; }
@@ -52,7 +52,7 @@ public async ValueTask<bool> ConnectAsync(IPEndPoint endPoint, CancellationToken
5252
Close();
5353

5454
// 创建新的 TcpClient 实例
55-
_client ??= new TcpClient(LocalEndPoint);
55+
_client ??= new TcpClient(localEndPoint);
5656

5757
var connectionToken = token;
5858
if (ConnectTimeout > 0)

0 commit comments

Comments
 (0)