mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Implement a workaround for routers without NAT loopback.
This allows joining a lobby game hosted on the same network (behind the same NAT gateway). This is relatively primitive to keep things simple: if the server and the client have the same public IP, it is assumed that they are on the same network and the client instead requests the local IP. Differential Revision: https://code.wildfiregames.com/D3944 This was SVN commit r25448.
This commit is contained in:
@@ -1640,14 +1640,22 @@ bool CNetServer::SetupConnection(const u16 port)
|
||||
return m_Worker->SetupConnection(port);
|
||||
}
|
||||
|
||||
CStr CNetServer::GetPublicIp() const
|
||||
{
|
||||
return m_PublicIp;
|
||||
}
|
||||
|
||||
u16 CNetServer::GetPublicPort() const
|
||||
{
|
||||
return m_PublicPort;
|
||||
}
|
||||
|
||||
CStr CNetServer::GetPublicIp() const
|
||||
u16 CNetServer::GetLocalPort() const
|
||||
{
|
||||
return m_PublicIp;
|
||||
std::lock_guard<std::mutex> lock(m_Worker->m_WorkerMutex);
|
||||
if (!m_Worker->m_Host)
|
||||
return 0;
|
||||
return m_Worker->m_Host->address.port;
|
||||
}
|
||||
|
||||
void CNetServer::SetConnectionData(const CStr& ip, const u16 port, bool useSTUN)
|
||||
|
||||
Reference in New Issue
Block a user