From 496a668a154a00ad21a58fbe5006127facdcaabb Mon Sep 17 00:00:00 2001 From: lotodore Date: Mon, 16 Sep 2013 22:33:52 +0200 Subject: [PATCH] Fixing retrieval of remote webclient address for login blocker. --- src/net/common/serverlobbythread.cpp | 2 -- src/net/common/sessiondata.cpp | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 61d23ee0..9a2a8861 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -282,11 +282,9 @@ ServerLobbyThread::AddConnection(boost::shared_ptr sessionData) unsigned numGameSessions = m_gameSessionManager.GetRawSessionCount(); if (numLobbySessions <= SERVER_MAX_NUM_LOBBY_SESSIONS && numLobbySessions + numGameSessions <= SERVER_MAX_NUM_TOTAL_SESSIONS) { - bool hasClientIp = false; string ipAddress = sessionData->GetRemoteIPAddressFromSocket(); if (!ipAddress.empty()) { sessionData->SetClientAddr(ipAddress); - hasClientIp = true; boost::shared_ptr packet(new NetPacket); packet->GetMsg()->set_messagetype(PokerTHMessage::Type_AnnounceMessage); diff --git a/src/net/common/sessiondata.cpp b/src/net/common/sessiondata.cpp index aa991066..63e0a1ed 100644 --- a/src/net/common/sessiondata.cpp +++ b/src/net/common/sessiondata.cpp @@ -392,8 +392,12 @@ SessionData::GetRemoteIPAddressFromSocket() const ipAddress = clientEndpoint.address().to_string(errCode); } } else { + boost::system::error_code errCode; server::connection_ptr con = m_webData->webSocketServer->get_con_from_hdl(m_webData->webHandle); - ipAddress = con->get_remote_endpoint(); + tcp::endpoint webClientEndpoint = con->get_raw_socket().remote_endpoint(errCode); + if (!errCode) { + ipAddress = webClientEndpoint.address().to_string(errCode); + } } return ipAddress; }