Changeset View
Changeset View
Standalone View
Standalone View
source/network/NetServer.cpp
Show First 20 Lines • Show All 1,643 Lines • ▼ Show 20 Lines | u16 CNetServer::GetPublicPort() const | ||||
return m_PublicPort; | return m_PublicPort; | ||||
} | } | ||||
CStr CNetServer::GetPublicIp() const | CStr CNetServer::GetPublicIp() const | ||||
{ | { | ||||
return m_PublicIp; | return m_PublicIp; | ||||
} | } | ||||
void CNetServer::SetConnectionData(const CStr& ip, const u16 port, bool useSTUN) | void CNetServer::SetConnectionData(const CStr& ip, const u16 port) | ||||
Stan: Why not pass the new fancy ip address struct? | |||||
Done Inline ActionsLimited value given the callsites. wraitii: Limited value given the callsites. | |||||
{ | { | ||||
m_PublicIp = ip; | m_PublicIp = ip; | ||||
m_PublicPort = port; | m_PublicPort = port; | ||||
m_UseSTUN = useSTUN; | } | ||||
bool CNetServer::SetConnectionDataViaSTUN() | |||||
{ | |||||
m_UseSTUN = true; | |||||
std::lock_guard<std::mutex> lock(m_Worker->m_WorkerMutex); | |||||
if (!m_Worker->m_Host) | |||||
return false; | |||||
Networking::IPAddress publicIP; | |||||
if (!StunClient::FindPublicIP(*m_Worker->m_Host, publicIP)) | |||||
{ | |||||
LOGERROR("Failed to find public IP via STUN."); | |||||
return false; | |||||
} | |||||
m_PublicIp = publicIP.GetIP(); | |||||
m_PublicPort = publicIP.GetPort(); | |||||
return true; | |||||
} | } | ||||
bool CNetServer::CheckPasswordAndIncrement(const CStr& password, const std::string& username) | bool CNetServer::CheckPasswordAndIncrement(const CStr& password, const std::string& username) | ||||
{ | { | ||||
std::unordered_map<std::string, int>::iterator it = m_FailedAttempts.find(username); | std::unordered_map<std::string, int>::iterator it = m_FailedAttempts.find(username); | ||||
if (m_Password == password) | if (m_Password == password) | ||||
{ | { | ||||
if (it != m_FailedAttempts.end()) | if (it != m_FailedAttempts.end()) | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Why not pass the new fancy ip address struct?