public void AddAccpetServer(AbstractTcpServer server) { if (server == null) { Log.Error("AddAccpet server failed:server is null"); return; } else { lock (_allServersLock) { _connectedServers.Add(server); } } }
public void RemoveServer(AbstractTcpServer server) { if (server == null) { Log.Error("RemoveServer server failed:server is null"); return; } else { lock (_allServersLock) { if (_connectedServers.Contains(server)) { _connectedServers.Remove(server); _servers.Remove(server.Key); } } } }
public bool AddServer(AbstractTcpServer server) { if (server == null) { Log.Error("add server failed: server is null"); return(false); } else { AbstractTcpServer temp; if (_servers.TryGetValue(server.Key, out temp)) { _removeServers.Add(server); Log.Warn("{0}_{1} repeated add !", temp.Name, temp.Key); return(false); } else { Log.Debug("{0}_{1} add success ! ", server.Name, server.Key); _servers.Add(server.Key, server); return(true); } } }