Fixing retrieval of remote webclient address for login blocker.
This commit is contained in:
@@ -282,11 +282,9 @@ ServerLobbyThread::AddConnection(boost::shared_ptr<SessionData> sessionData)
|
|||||||
unsigned numGameSessions = m_gameSessionManager.GetRawSessionCount();
|
unsigned numGameSessions = m_gameSessionManager.GetRawSessionCount();
|
||||||
if (numLobbySessions <= SERVER_MAX_NUM_LOBBY_SESSIONS
|
if (numLobbySessions <= SERVER_MAX_NUM_LOBBY_SESSIONS
|
||||||
&& numLobbySessions + numGameSessions <= SERVER_MAX_NUM_TOTAL_SESSIONS) {
|
&& numLobbySessions + numGameSessions <= SERVER_MAX_NUM_TOTAL_SESSIONS) {
|
||||||
bool hasClientIp = false;
|
|
||||||
string ipAddress = sessionData->GetRemoteIPAddressFromSocket();
|
string ipAddress = sessionData->GetRemoteIPAddressFromSocket();
|
||||||
if (!ipAddress.empty()) {
|
if (!ipAddress.empty()) {
|
||||||
sessionData->SetClientAddr(ipAddress);
|
sessionData->SetClientAddr(ipAddress);
|
||||||
hasClientIp = true;
|
|
||||||
|
|
||||||
boost::shared_ptr<NetPacket> packet(new NetPacket);
|
boost::shared_ptr<NetPacket> packet(new NetPacket);
|
||||||
packet->GetMsg()->set_messagetype(PokerTHMessage::Type_AnnounceMessage);
|
packet->GetMsg()->set_messagetype(PokerTHMessage::Type_AnnounceMessage);
|
||||||
|
|||||||
@@ -392,8 +392,12 @@ SessionData::GetRemoteIPAddressFromSocket() const
|
|||||||
ipAddress = clientEndpoint.address().to_string(errCode);
|
ipAddress = clientEndpoint.address().to_string(errCode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
boost::system::error_code errCode;
|
||||||
server::connection_ptr con = m_webData->webSocketServer->get_con_from_hdl(m_webData->webHandle);
|
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;
|
return ipAddress;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user