//确保 关闭Client的链接状态。

dev_chengFeng
Fuhaifeng 2021-01-04 19:41:01 +08:00
parent fd7f19c8ec
commit 3819ed162a
1 changed files with 9 additions and 3 deletions

View File

@ -429,6 +429,7 @@ public class SocketClient
{
Debug.Log("****Socket*********************Close ---" + IpAddress);
//确保 关闭Client的链接状态。
UnregistNetMessage(INDICATION_ERROR_CODE, Ygqmgx_indicationErrorAction);
if (client != null)
{
try
@ -442,7 +443,7 @@ public class SocketClient
}
UnregistNetMessage(INDICATION_ERROR_CODE, Ygqmgx_indicationErrorAction);
m_isConnected = false;
m_isConnecting = false;
@ -706,6 +707,7 @@ public class SocketClient
reconnect_co = netMgr.StartCoroutine(CheckReconnect_Co());
}
public void Reconnect()
{
Debug.Log("****Socket*********************Reconnect ---" + IpAddress);
@ -721,6 +723,7 @@ public class SocketClient
//client.ReceiveTimeout = 1000;
client.NoDelay = true;
client.BeginConnect(IpAddress, Port, new AsyncCallback(OnReconnect), null);
}
catch (Exception e)
{
@ -870,9 +873,12 @@ public class SocketClient
{
if (!dispatchers.ContainsKey(msgId))
return;
dispatchers.Remove(msgId);
XDebug.Log.l("-------------------UnregistNetMessage================================", msgId, IpAddress, Port);
SimpleDispatcher find = (SimpleDispatcher)dispatchers[msgId];
find.processor -= handle;
//SimpleDispatcher find = (SimpleDispatcher)dispatchers[msgId];
//find.processor -= handle;
}