void WServer::HandleWoWPacket(WorldPacket & pck) { uint32 sessionid, size; uint16 opcode; /* get session */ pck >> sessionid >> opcode >> size; Session * session = sClientMgr.GetSession(sessionid); if(!session) return; /* write it to that session's output buffer */ WorldSocket * s = session->GetSocket(); if(s) s->OutPacket(opcode, size, size ? ((const void*)(pck.contents() + 10)) : 0); }
void LogonCommClientSocket::HandleSessionInfo(WorldPacket & recvData) { uint32 request_id; recvData >> request_id; // find the socket with this request WorldSocket * sock = sLogonCommHandler.GetSocketByRequest(request_id); if(sock == 0 || sock->Authed || !sock->IsConnected()) // Expired/Client disconnected return; // extract sessionkey / account information (done by WS) sock->Authed = true; sLogonCommHandler.RemoveUnauthedSocket(request_id); sock->InformationRetreiveCallback(recvData, request_id); }
void ClusterInterface::HandlePlayerLogin(WorldPacket & pck) { /* player x logging into instance y */ uint32 Guid, InstanceId, MapId; uint32 AccountId, Account_Flags, sessionid, ClientBuild; string GMPermissions, accountname; pck >> Guid >> MapId >> InstanceId >> AccountId >> Account_Flags >> sessionid >> GMPermissions >> accountname >> ClientBuild; /* find the instance */ Map* ma = sInstanceMgr.GetMap(MapId); ASSERT(ma); MapMgr* mm = sInstanceMgr.GetInstance(MapId, InstanceId); ASSERT(mm); /* create the session */ WorldSession * s = sWorld.FindSession(AccountId); /* create the socket */ WorldSocket * so = new WorldSocket(sessionid); if (s == NULL) s = new WorldSession(AccountId, accountname, so); _sessions[sessionid] = s; sWorld.AddSession(s); bool login_result = s->ClusterTryPlayerLogin(Guid, ClientBuild, GMPermissions, Account_Flags); if(login_result) { /* login was ok. send a message to the realm server telling him to distribute our info to all other realm server */ WorldPacket data(ICMSG_PLAYER_LOGIN_RESULT, 5); data << Guid << sessionid << uint8(1); SendPacket(&data); } else { /* for some reason the login failed */ WorldPacket data(ICMSG_PLAYER_LOGIN_RESULT, 5); data << Guid << sessionid << uint8(0); SendPacket(&data); /* tell the client his login failed before deleting the session */ data.Initialize(SMSG_CHARACTER_LOGIN_FAILED); data << uint8(62); so->SendPacket(&data); /* destroy the session */ DestroySession(sessionid); } }
void ClusterInterface::HandlePlayerLogin(WorldPacket & pck) { /* player x logging into instance y */ uint32 guid, instance, mapid; uint32 accountid, accountflags, sessionid; string gmpermissions, accountname; pck >> guid >> mapid >> instance >> accountid >> accountflags >> sessionid >> gmpermissions >> accountname; /* find the instance */ Map * ma = sWorldCreator.GetMap(mapid); ASSERT(ma); MapMgr * mm = ma->GetInstance(instance); ASSERT(mm); /* create the session */ WorldSession * s = sWorld.FindSession(accountid); ASSERT(!s); /* create the socket */ WorldSocket * so = new WorldSocket(sessionid); s = new WorldSession(accountid, accountname, so); _sessions[sessionid] = s; sWorld.AddSession(s); bool login_result = s->PlayerLogin(guid, mapid, instance); if(login_result) { /* login was ok. send a message to the realm server telling him to distribute our info to all other realm server */ WorldPacket data(ICMSG_PLAYER_LOGIN_RESULT, 5); data << guid << sessionid << uint8(1); SendPacket(&data); } else { /* for some reason the login failed */ WorldPacket data(ICMSG_PLAYER_LOGIN_RESULT, 5); data << guid << sessionid << uint8(0); SendPacket(&data); /* tell the client his login failed before deleting the session */ data.Initialize(SMSG_CHARACTER_LOGIN_FAILED); data << uint8(62); so->SendPacket(&data); /* destroy the session */ DestroySession(sessionid); } }
void AddNewSockets() { ACE_GUARD(ACE_Thread_Mutex, Guard, m_NewSockets_Lock); if (m_NewSockets.empty()) return; for (SocketSet::const_iterator i = m_NewSockets.begin(); i != m_NewSockets.end(); ++i) { WorldSocket* sock = (*i); if (sock->IsClosed()) { sScriptMgr->OnSocketClose(sock, true); sock->RemoveReference(); --m_Connections; } else m_Sockets.insert(sock); } m_NewSockets.clear(); }