private void connectionChanged(ConnectionInformation information, ConnectionState state) { if (state == ConnectionState.closed) { CloseConnection(information.getConnectionID()); liveConnections.Remove(information.getConnectionID()); } }
internal GameClient(uint ClientId, ConnectionInformation pConnection) { Id = ClientId; Connection = pConnection; SetDoorPos = false; CurrentRoomUserID = -1; packetParser = new GamePacketParser(); }
internal void Stop() { if (GetMessageHandler() != null) MessageHandler.Destroy(); if (GetHabbo() != null) Habbo.OnDisconnect(); CurrentRoomUserID = -1; this.MessageHandler = null; this.Habbo = null; this.Connection = null; }
internal void Dispose() { packet.Clear(); userConnection = null; }
public QueuedServerMessage(ConnectionInformation connection) { this.userConnection = connection; this.packet = new List<byte>(4096); }
/// <summary> /// Handels a new incoming data request from some computer from arround the world /// </summary> /// <param name="iAr">the IAsyncResult of the connection</param> private void newConnectionRequest(IAsyncResult iAr) { if (this.connectionListener != null) { if (acceptConnections) { try { Socket replyFromComputer = ((Socket)iAr.AsyncState).EndAccept(iAr); replyFromComputer.NoDelay = this.disableNagleAlgorithm; Out.writeLine("[CONN MANAGER] >> New connection from [" + replyFromComputer.RemoteEndPoint.ToString().Split(':')[0] + "].", Out.logFlags.StandardLogLevel); //if (activeConnections.Count < maximumConnections) { string Ip = replyFromComputer.RemoteEndPoint.ToString().Split(':')[0]; //if (getAmountOfConnectionFromIp(Ip) < maxIpConnectionCount) { acceptedConnections++; Out.writeLine("[CONN MANAGER] >> Accepted connection [" + acceptedConnections + "] from [" + replyFromComputer.RemoteEndPoint.ToString().Split(':')[0] + "].", Out.logFlags.BelowStandardlogLevel); ConnectionInformation c = new ConnectionInformation(replyFromComputer, acceptedConnections, this, parser.Clone() as IDataParser, Ip); reportUserLogin(Ip); c.connectionChanged += c_connectionChanged; //activeConnections.Add(acceptedConnections, c); if (connectionEvent != null) connectionEvent(c); } //else // Out.writeLine("Connection denied from [" + replyFromComputer.RemoteEndPoint.ToString().Split(':')[0] + "]. The user has too many connections", Out.logFlags.StandardLogLevel); } //else // Out.writeLine("Maximum amount of connections reached " + maximumConnections, Out.logFlags.ImportantLogLevel); } catch { //Out.writeError(ex.Message); } } finally { connectionListener.BeginAccept(new AsyncCallback(newConnectionRequest), connectionListener); } } else { Out.writeLine("Connection denied, server is not currently accepting connections!", Out.logFlags.StandardLogLevel); } } }
void c_connectionChanged(ConnectionInformation information, ConnectionState state) { if (state == ConnectionState.closed) { reportDisconnect(information); } }
/// <summary> /// Reports a gameconnection as disconnected /// </summary> /// <param name="gameConnection">The connection which is logging out</param> public void reportDisconnect(ConnectionInformation gameConnection) { gameConnection.connectionChanged -= c_connectionChanged; reportUserLogout(gameConnection.getIp()); //activeConnections.Remove(gameConnection.getConnectionID()); }
private void manager_connectionEvent(ConnectionInformation connection) { liveConnections.Add(connection.getConnectionID(), connection); connection.connectionChanged += connectionChanged; PiciEnvironment.GetGame().GetClientManager().CreateAndStartClient((uint)connection.getConnectionID(), connection); }
internal void CreateAndStartClient(uint clientID, ConnectionInformation connection) { GameClient client = new GameClient(clientID, connection); if (clients.ContainsKey(clientID)) clients.Remove(clientID); lock (clientsAddQueue.SyncRoot) { clientsAddQueue.Enqueue(client); } }
public void SetConnection(ConnectionInformation con) { this.con = con; this.onNewPacket = null; }