mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
StunClient code cleanup: use enet functions, endianness
Instead of using platform-specific sockets, use enet_socket* functions
(which ends up doing the same).
Clean up some confusing APIs, removing the distinction between finding
the public IP for the host/join.
Fix endianness support & use simpler code.
Refs D364 / 61261d14fc (and some subsequent fixing diffs).
Differential Revision: https://code.wildfiregames.com/D3970
This was SVN commit r25453.
This commit is contained in:
@@ -1658,11 +1658,20 @@ u16 CNetServer::GetLocalPort() const
|
||||
return m_Worker->m_Host->address.port;
|
||||
}
|
||||
|
||||
void CNetServer::SetConnectionData(const CStr& ip, const u16 port, bool useSTUN)
|
||||
void CNetServer::SetConnectionData(const CStr& ip, const u16 port)
|
||||
{
|
||||
m_PublicIp = ip;
|
||||
m_PublicPort = port;
|
||||
m_UseSTUN = useSTUN;
|
||||
m_UseSTUN = false;
|
||||
}
|
||||
|
||||
bool CNetServer::SetConnectionDataViaSTUN()
|
||||
{
|
||||
m_UseSTUN = true;
|
||||
std::lock_guard<std::mutex> lock(m_Worker->m_WorkerMutex);
|
||||
if (!m_Worker->m_Host)
|
||||
return false;
|
||||
return StunClient::FindPublicIP(*m_Worker->m_Host, m_PublicIp, m_PublicPort);
|
||||
}
|
||||
|
||||
bool CNetServer::CheckPasswordAndIncrement(const CStr& password, const std::string& username)
|
||||
|
||||
Reference in New Issue
Block a user