/// <summary> /// Handles new connections. /// </summary> /// <param name="socket">The connection socket.</param> protected virtual void HandleConnection(Socket socket) { ToffeeSession session = new ToffeeSession(SessionManager, socket); SessionManager.NewSession(session); Log?.Info("Began new session. (id: {0})", session.SessionId); }
public void SessionDisconnected(ToffeeSession session) { if (session.SessionId >= UniqueIdentifiers.Count) { return; } UniqueIdentifiers[session.SessionId] = false; _Sessions.Remove(session); SessionLookup.Remove(session.SessionId); if (Server.Log != null) { Server.Log.Info("Session {0} disconnected.", session.SessionId); } Server.SessionDisconnected(); }
public void NewSession(ToffeeSession session) { session.SessionId = GetUniqueIdentifier(); _Sessions.Add(session); SessionLookup.Add(session.SessionId, session); }
/// <summary> /// Handles recieved packets. /// </summary> /// <param name="session">The session that received the packet.</param> /// <param name="packet">The packet data that was received.</param> public virtual void HandlePacket(ToffeeSession session, byte[] packet) { Log?.Warning("Handle packet. (This should be overridden!)"); }