Fixing retrieval of remote webclient address for login blocker.

This commit is contained in:
lotodore
2013-09-16 22:33:52 +02:00
parent cc386419d2
commit 496a668a15
2 changed files with 5 additions and 3 deletions
-2
View File
@@ -282,11 +282,9 @@ ServerLobbyThread::AddConnection(boost::shared_ptr<SessionData> 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<NetPacket> packet(new NetPacket);
packet->GetMsg()->set_messagetype(PokerTHMessage::Type_AnnounceMessage);
+5 -1
View File
@@ -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;
}