public void onSessionClose(ISession s) { if (s == null) { Debug.logger.log(LogType.LOG_ERR, "AEServer session manager on empty session close!"); return; } // clear listener session record for (int i = 0; i < (int)ListenerType.LT_Count; ++i) { IListener l = _listeners[i]; if (l == null) { continue; } IAssociateSession ases = s.getAssociateSession((ListenerType)i); if (ases == null) { continue; } _listeners[i].removeSession(ases.orgSessionID); } // call session closed ((AESession)s).onClosed(); // remove session lock (_sessionsLock) { _sessionsByID.Remove(s.sessionID); } }
public void addAssociateSession(IAssociateSession s) { if (s == null) { Debug.logger.log(LogType.LOG_ERR, "add empty associate session!"); return; } _associateSessions[(int)s.type] = s; }
public void addAssociateSession(IAssociateSession ases, ISession s) { IListener l = _listeners[(int)ases.type]; if (l == null) { Debug.logger.log(LogType.LOG_ERR, "add associate session with not exist listener type [" + ases.type + "]"); return; } s.addAssociateSession(ases); l.addSession(s); }
public ISession newSession(IAssociateSession s) { // create session AESession ses = null; lock (_sessionsLock) { ulong sid = ++_sessionIDSeed; ses = new AESession(s, sid); _sessionsByID[sid] = ses; } // add to listener _listeners[(int)s.type].addSession(ses); return(ses); }
public int addSession(ISession s) { IAssociateSession ases = s.getAssociateSession(this.type); if (ases == null) { Debug.logger.log(LogType.LOG_ERR, "AEServer AEListener addSession session[" + AESession.dumpSessionInfo(s) + "] without associate session type[" + this.type + "]"); return(0); } int ret = 0; lock (_sessionsLock) { _sessionsByOrgID[(OrgSessionIDType)ases.orgSessionID] = s; ret = _sessionsByOrgID.Count; } return(ret); }
public AESession(IAssociateSession ias, ulong sid) { _associateSessions[(int)ias.type] = ias; _sessionID = sid; }