Skip to content

Commit c07dee1

Browse files
committed
fix(Network): 移除未实现的Close方法并修正SystemTcpNetworkChannel中的Close调用
在NetworkChannelBase中移除未实现的Close方法,避免潜在异常。在SystemTcpNetworkChannel中修正Close方法的调用,添加正确的关闭原因和错误码参数。
1 parent ccc8504 commit c07dee1

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

Runtime/Network/Network/NetworkManager.NetworkChannelBase.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -769,11 +769,6 @@ public async Task<TResult> Call<TResult>(MessageObject messageObject) where TRes
769769
return result as TResult;
770770
}
771771

772-
public void Close()
773-
{
774-
throw new NotImplementedException();
775-
}
776-
777772
/// <summary>
778773
/// 向远程主机发送消息包。
779774
/// </summary>

Runtime/Network/Network/SystemSocket/NetworkManager.SystemTcpNetworkChannel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ private void ConnectCallback(IAsyncResult asyncResult)
376376
{
377377
SocketException socketException = exception as SocketException;
378378
NetworkChannelError?.Invoke(this, NetworkErrorCode.ConnectError, socketException?.SocketErrorCode ?? SocketError.Success, exception.ToString());
379-
Close();
379+
Close(NetworkCloseReason.ConnectClose, (ushort)(socketException?.SocketErrorCode ?? SocketError.Success));
380380
return;
381381
}
382382

0 commit comments

Comments
 (0)