Fetch the server IP once

Fixes ourIP being set on every map change
Also catches a possible case where joining clients can sigfail in the window between map change and stun response
This commit is contained in:
SteelT 2023-07-16 19:13:20 -04:00
parent a59896ef88
commit 3d6d2694b3

View file

@ -4192,9 +4192,15 @@ boolean SV_SpawnServer(void)
serverrunning = true; serverrunning = true;
SV_ResetServer(); SV_ResetServer();
SV_GenContext(); SV_GenContext();
if (netgame && I_NetOpenSocket) if (netgame)
{ {
I_NetOpenSocket(); if (I_NetOpenSocket)
{
I_NetOpenSocket();
}
ourIP = 0;
STUN_bind(GotOurIP);
} }
// non dedicated server just connect to itself // non dedicated server just connect to itself
@ -4203,9 +4209,7 @@ boolean SV_SpawnServer(void)
else doomcom->numslots = 1; else doomcom->numslots = 1;
} }
ourIP = 0;
if (netgame && server)
STUN_bind(GotOurIP);
// strictly speaking, i'm not convinced the following is necessary // strictly speaking, i'm not convinced the following is necessary
// but I'm not confident enough to remove it entirely in case it breaks something // but I'm not confident enough to remove it entirely in case it breaks something