forked from Mirrors/openclonk
Fix adding connections to link-local IPv6 addresses
parent
cc1335fef9
commit
b595e96b83
|
@ -137,10 +137,22 @@ bool C4Network2Client::DoConnectAttempt(C4Network2IO *pIO)
|
||||||
{ iNextConnAttempt = time(nullptr) + 10; return true; }
|
{ iNextConnAttempt = time(nullptr) + 10; return true; }
|
||||||
// save attempt
|
// save attempt
|
||||||
AddrAttempts[iBestAddress]++; iNextConnAttempt = time(nullptr) + C4NetClientConnectInterval;
|
AddrAttempts[iBestAddress]++; iNextConnAttempt = time(nullptr) + C4NetClientConnectInterval;
|
||||||
// log
|
auto addr = Addr[iBestAddress].getAddr();
|
||||||
LogSilentF("Network: connecting client %s on %s...", getName(), Addr[iBestAddress].toString().getData());
|
std::set<int> interfaceIDs;
|
||||||
// connect
|
if (addr.IsLocal())
|
||||||
return pIO->Connect(Addr[iBestAddress].getAddr(), Addr[iBestAddress].getProtocol(), pClient->getCore());
|
interfaceIDs = Network.Clients.GetLocal()->getInterfaceIDs();
|
||||||
|
else
|
||||||
|
interfaceIDs = {0};
|
||||||
|
for (auto id : interfaceIDs)
|
||||||
|
{
|
||||||
|
addr.SetScopeId(id);
|
||||||
|
// log
|
||||||
|
LogSilentF("Network: connecting client %s on %s...", getName(), addr.ToString().getData());
|
||||||
|
// connect
|
||||||
|
if (pIO->Connect(addr, Addr[iBestAddress].getProtocol(), pClient->getCore()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4Network2Client::hasAddr(const C4Network2Address &addr) const
|
bool C4Network2Client::hasAddr(const C4Network2Address &addr) const
|
||||||
|
|
Loading…
Reference in New Issue