Fix IPv4 only server in dual stack network
This commit is contained in:
parent
8486b11da6
commit
63c7c711d5
@ -1431,6 +1431,9 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
|
||||
// Server owner online account will keep online as long as
|
||||
// server is live
|
||||
Online::RequestManager::m_disable_polling = true;
|
||||
// For server we assume it is an IPv4 one, because if it fails
|
||||
// to detect the server won't start at all
|
||||
NetworkConfig::get()->setIPType(NetworkConfig::IP_V4);
|
||||
NetworkConfig::get()->detectIPType();
|
||||
NetworkConfig::get()->setIsWAN();
|
||||
NetworkConfig::get()->setIsPublicServer();
|
||||
|
@ -262,6 +262,8 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
IPType getIPType() const { return m_ip_type.load(); }
|
||||
// ------------------------------------------------------------------------
|
||||
void setIPType(IPType ip_type) { m_ip_type.store(ip_type); }
|
||||
// ------------------------------------------------------------------------
|
||||
const std::string& getNAT64Prefix() const { return m_nat64_prefix; }
|
||||
}; // class NetworkConfig
|
||||
|
||||
|
@ -1359,7 +1359,7 @@ void ServerLobby::asynchronousUpdate()
|
||||
}
|
||||
auto ip_type = NetworkConfig::get()->getIPType();
|
||||
// Set the IPv6 address first for possible IPv6 only server
|
||||
if (ip_type >= NetworkConfig::IP_V6)
|
||||
if (isIPv6Socket() && ip_type >= NetworkConfig::IP_V6)
|
||||
{
|
||||
STKHost::get()->setPublicAddress(false/*ipv4*/);
|
||||
}
|
||||
|
@ -728,7 +728,11 @@ void STKHost::setPublicAddress(bool ipv4)
|
||||
if (NetworkConfig::get()->isServer() && ipv4 &&
|
||||
port != m_public_address.getPort())
|
||||
{
|
||||
Log::error("STKHost", "IPv6 has different port than IPv4.");
|
||||
if (ServerConfig::m_ipv6_server)
|
||||
{
|
||||
Log::error("STKHost",
|
||||
"IPv6 has different port than IPv4.");
|
||||
}
|
||||
m_public_ipv6_address.clear();
|
||||
}
|
||||
if (ipv4)
|
||||
|
Loading…
Reference in New Issue
Block a user