提交 b0a858bb 编写于 作者: T tanghai

TCP据说有连接不上的问题,加几个log方便查错

上级 c7500f18
......@@ -8,7 +8,7 @@ namespace ETHotfix
{
public override void Awake(NetOuterComponent self)
{
self.Awake(NetworkProtocol.KCP);
self.Awake(NetworkProtocol.TCP);
self.MessagePacker = new ProtobufPacker();
self.MessageDispatcher = new OuterMessageDispatcher();
}
......@@ -19,7 +19,7 @@ namespace ETHotfix
{
public override void Awake(NetOuterComponent self, IPEndPoint ipEndPoint)
{
self.Awake(NetworkProtocol.KCP, ipEndPoint);
self.Awake(NetworkProtocol.TCP, ipEndPoint);
self.MessagePacker = new ProtobufPacker();
self.MessageDispatcher = new OuterMessageDispatcher();
}
......
......@@ -22,7 +22,7 @@
{
public void Awake()
{
this.Awake(NetworkProtocol.KCP);
this.Awake(NetworkProtocol.TCP);
this.MessagePacker = new ProtobufPacker();
this.MessageDispatcher = new ClientDispatcher();
}
......
......@@ -12,8 +12,8 @@ namespace ETModel
public sealed class TChannel: AChannel
{
private Socket socket;
private readonly SocketAsyncEventArgs innArgs = new SocketAsyncEventArgs();
private readonly SocketAsyncEventArgs outArgs = new SocketAsyncEventArgs();
private SocketAsyncEventArgs innArgs = new SocketAsyncEventArgs();
private SocketAsyncEventArgs outArgs = new SocketAsyncEventArgs();
private readonly CircularBuffer recvBuffer = new CircularBuffer();
private readonly CircularBuffer sendBuffer = new CircularBuffer();
......@@ -64,6 +64,8 @@ namespace ETModel
this.socket.Close();
this.innArgs.Dispose();
this.outArgs.Dispose();
this.innArgs = null;
this.outArgs = null;
this.socket = null;
}
......@@ -145,10 +147,15 @@ namespace ETModel
private void OnConnectComplete(object o)
{
if (this.IsDisposed)
{
throw new Exception("TChannel已经被Dispose, 不能发送消息");
}
SocketAsyncEventArgs e = (SocketAsyncEventArgs) o;
UserTokenInfo userTokenInfo = (UserTokenInfo) e.UserToken;
if (userTokenInfo.InstanceId != this.InstanceId)
{
Log.Error($"session disposed!");
return;
}
......@@ -196,10 +203,15 @@ namespace ETModel
private void OnRecvComplete(object o)
{
if (this.IsDisposed)
{
throw new Exception("TChannel已经被Dispose, 不能发送消息");
}
SocketAsyncEventArgs e = (SocketAsyncEventArgs)o;
UserTokenInfo userTokenInfo = (UserTokenInfo) e.UserToken;
if (userTokenInfo.InstanceId != this.InstanceId)
{
Log.Error($"session disposed!");
return;
}
......@@ -287,10 +299,15 @@ namespace ETModel
private void OnSendComplete(object o)
{
if (this.IsDisposed)
{
throw new Exception("TChannel已经被Dispose, 不能发送消息");
}
SocketAsyncEventArgs e = (SocketAsyncEventArgs)o;
UserTokenInfo userTokenInfo = (UserTokenInfo) e.UserToken;
if (userTokenInfo.InstanceId != this.InstanceId)
{
Log.Error($"session disposed!");
return;
}
......
......@@ -75,6 +75,7 @@ namespace ETModel
UserTokenInfo userTokenInfo = (UserTokenInfo) e.UserToken;
if (userTokenInfo.InstanceId != this.InstanceId)
{
Log.Error($"session disposed!");
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册