예제 #1
0
        private void Send(uint sessionId, byte[] buffer)
        {
            NetSession session = this.GetSession(sessionId);

            if (session == null)
            {
                Logger.Warn($"invalid sessionID:{sessionId}", 2, 5);
                return;
            }
            session.Send(buffer, buffer.Length);
        }
예제 #2
0
 private void Send(SessionType sessionType, byte[] buffer, bool once)
 {
     foreach (KeyValuePair <uint, NetSession> kv in this._idToSession)
     {
         NetSession session = kv.Value;
         if (session.type != sessionType)
         {
             continue;
         }
         session.Send(buffer, buffer.Length);
         if (once)
         {
             break;
         }
     }
 }
예제 #3
0
 public void RemoveSession(NetSession session)
 {
     this._idToSession.Remove(session.id);
     NetSessionPool.instance.Push(session);
 }
예제 #4
0
 public void AddSession(NetSession session) => this._idToSession[session.id] = session;