/// <summary> /// TCP 客户端套接字初始化处理 /// </summary> /// <param name="socket"></param> private void onClientSocket(AutoCSer.Net.TcpServer.ClientSocketBase socket) { if (socket != null) { if (loadCacheKeepCallback != null) { loadCacheKeepCallback.Dispose(); loadCacheKeepCallback = null; } CacheManager cache = new CacheManager(this, server); if (masterClient != null) { if ((loadCacheKeepCallback = masterClient.GetCache(cache.Load)) != null) { loadCache = cache; } } else { if ((loadCacheKeepCallback = slaveClient.GetCache(cache.Load)) != null) { loadCache = cache; } } } }
/// <summary> /// TCP 客户端套接字初始化处理 /// </summary> /// <param name="socket"></param> private void onClientSocket(AutoCSer.Net.TcpServer.ClientSocketBase socket) { if (socket != null) { try { if (logKeepCallback != null) { logKeepCallback.Dispose(); logKeepCallback = null; } #if NoAutoCSer throw new Exception(); #else ClientId = TcpInternalClient.register(); logKeepCallback = TcpInternalClient.getLog(ClientId, onLog); #endif IsClient = true; Client.OnClient(name); return; } catch (Exception error) { AutoCSer.Log.Pub.Log.Add(AutoCSer.Log.LogType.Error, error); checkSocketVersion.DisposeSocket(); } IsClient = false; } }
/// <summary> /// TCP 客户端套接字初始化处理 /// </summary> /// <param name="socket"></param> private void onClientSocket(AutoCSer.Net.TcpServer.ClientSocketBase socket) { Abstract.ConsumerStreamProcessor oldProcesser = Processor; if (socket != null) { createProcessor(); } else { Processor = null; } if (oldProcesser != null) { oldProcesser.Free(); } }
/// <summary> /// TCP 客户端套接字初始化处理 /// </summary> /// <param name="socket"></param> private void onClientSocket(AutoCSer.Net.TcpServer.ClientSocketBase socket) { Monitor.Enter(newSocketLock); try { if (socket.IsSocketVersion(ref this.socket)) { try { if (logKeepCallback != null) { logKeepCallback.Dispose(); logKeepCallback = null; } #if NoAutoCSer throw new Exception(); #else ClientId = TcpInternalClient.register(); logKeepCallback = TcpInternalClient.getLog(ClientId, onLog); #endif IsClient = true; Client.OnClient(name); return; } catch (Exception error) { AutoCSer.Log.Pub.Log.add(AutoCSer.Log.LogType.Error, error); #if DotNetStandard AutoCSer.Net.TcpServer.CommandBase.CloseClient(socket.Socket); #else socket.Socket.Dispose(); #endif } IsClient = false; } } finally { Monitor.Exit(newSocketLock); } }