public EmptyMsgRet OnSessionOfflineReq(SessionOfflineReq reqMsg) { Int64 nSessionID = reqMsg.SessionId; FFLog.Trace(string.Format("worker OnSessionOfflineReq! {0}", nSessionID)); if (m_dictRoles.ContainsKey(nSessionID) == false) { return(RPC_NONE); } Player player = GetPlayerBySessionID(nSessionID); m_dictRoles.Remove(nSessionID); Pbmsg.LogoutRet retMsg = new Pbmsg.LogoutRet() { Id = player.GetID(), Name = player.strName, }; BroadcastPlayerMsg <Pbmsg.LogoutRet>(Pbmsg.ServerCmdDef.SLogout, retMsg); if (player.playerYS != null && m_dictRoles.ContainsKey(player.playerYS.nSessionID) != false) { m_dictRoles.Remove(player.playerYS.nSessionID); retMsg = new Pbmsg.LogoutRet() { Id = player.playerYS.GetID(), Name = player.playerYS.strName, }; BroadcastPlayerMsg <Pbmsg.LogoutRet>(Pbmsg.ServerCmdDef.SLogout, retMsg); } return(RPC_NONE); }
public void CleanupSession(ClientInfo cinfo, bool closesend) { if (closesend) { SessionOfflineReq msg = new SessionOfflineReq() { SessionId = cinfo.sessionID }; m_ffrpc.Call(cinfo.strAllocWorker, msg); } m_dictClients.Remove(cinfo.sessionID); }
public EmptyMsgRet OnSessionOfflineReq(SessionOfflineReq reqMsg) { Int64 nBeginUs = DateTime.Now.Ticks / 10; Int64 nSessionID = reqMsg.SessionId; FFLog.Trace(string.Format("worker OnSessionOfflineReq! {0}", nSessionID)); int cmd = (int)WorkerDef.OFFLINE_CMD; if (m_dictCmd2Func.ContainsKey(cmd) == false) { FFLog.Error(string.Format("worker cmd invalid! {0}", cmd)); return(RPC_NONE); } byte[] data = {}; m_dictCmd2Func[cmd].cmdHandler(nSessionID, cmd, data); PerfMonitor.Instance().AddPerf("OnOffline", DateTime.Now.Ticks / 10 - nBeginUs); return(RPC_NONE); }