Stop autodetecting serverid for loginserver rqs

The automatic server detection just loops through all registered
servers and tries each of them to find the correct one. This process
will hang if any registered server isn't responding to DNS queries,
which at the number we currently have, makes all servers not sending
serverid fail.

We now hard-require the Config.serverid setting, to prevent this
problem.
This commit is contained in:
Guangcong Luo
2020-06-27 12:46:38 -04:00
parent be31237b96
commit 00a877333f
2 changed files with 7 additions and 11 deletions

View File

@@ -101,10 +101,10 @@ class NTBBSession {
}
function getIp() {
$ip = $_SERVER['REMOTE_ADDR'];
$ip = $_SERVER['REMOTE_ADDR'] ?? '';
foreach ($this->trustedproxies as &$proxyip) {
if ($this->cidr_match($ip, $proxyip)) {
$parts = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$parts = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'] ?? '');
$ip = array_pop($parts);
break;
}