diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 913a6aeb..5ad45628 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -1008,9 +1008,9 @@ ServerLobbyThread::HandleNetPacketInit(boost::shared_ptr session, c LOG_VERBOSE("Received init for session #" << session->GetId() << "."); // @XXX: debug tests - if(m_sessionManager.IsGuestConnectedMultiple(session->GetClientAddr())){ - LOG_ERROR("Guest with IP " << session->GetClientAddr() << " already connected! Should be declined!"); - } + //if(m_sessionManager.IsGuestConnectedMultiple(session->GetClientAddr())){ + // LOG_ERROR("Guest with IP " << session->GetClientAddr() << " already connected! Should be declined!"); + //} // @XXX: end debug tests // Before any other processing, perform some denial of service and @@ -1065,7 +1065,7 @@ ServerLobbyThread::HandleNetPacketInit(boost::shared_ptr session, c } // @XXX: check if a guest session with same ip is already connected - decline if true if(m_sessionManager.IsGuestConnectedMultiple(session->GetClientAddr())){ - LOG_ERROR("Guest with IP " << session->GetClientAddr() << " already connected! Decline!"); + //LOG_ERROR("Guest with IP " << session->GetClientAddr() << " already connected! Decline!"); validGuest = false; } } diff --git a/src/net/common/sessionmanager.cpp b/src/net/common/sessionmanager.cpp index f2b417aa..2dba6d39 100644 --- a/src/net/common/sessionmanager.cpp +++ b/src/net/common/sessionmanager.cpp @@ -256,19 +256,18 @@ SessionManager::IsGuestConnectedMultiple(const std::string &clientAddress) const SessionMap::const_iterator i = m_sessionMap.begin(); SessionMap::const_iterator end = m_sessionMap.end(); - int j = 0; - while (i != end) { - // @XXX: comparing PlayerRights does not yet work (e.g. throws an exception) - //if ((*i).second->GetClientAddr() == clientAddress && (*i).second->GetPlayerData()->GetRights() == PLAYER_RIGHTS_GUEST) { - if ((*i).second->GetClientAddr() == clientAddress) { - j++; - } + boost::shared_ptr tmpPlayer(i->second->GetPlayerData()); + // @XXX: productive: + //if(tmpPlayer && tmpPlayer->GetRights() == PLAYER_RIGHTS_GUEST && i->second->GetClientAddr() == clientAddress){ + // @XXX: debug: + // if(tmpPlayer && tmpPlayer->GetRights() == PLAYER_RIGHTS_NORMAL && i->second->GetClientAddr() == clientAddress){ + if(tmpPlayer && tmpPlayer->GetRights() == PLAYER_RIGHTS_GUEST && i->second->GetClientAddr() == clientAddress){ + retVal = true; + break; + } ++i; } - if (j > 1) { - retVal = true; - } return retVal; }