Don't do anything hole punching related if rendezvousserver is unset

This commit is contained in:
James R 2021-08-30 18:27:52 -07:00
parent 307cdf7039
commit df59f3580d
2 changed files with 16 additions and 9 deletions

View file

@ -1909,8 +1909,11 @@ static void SendAskInfo(INT32 node)
// our address to the host, it'll be able to speak to us. // our address to the host, it'll be able to speak to us.
HSendPacket(node, false, 0, sizeof (askinfo_pak)); HSendPacket(node, false, 0, sizeof (askinfo_pak));
if (node != 0 && node != BROADCASTADDR) if (node != 0 && node != BROADCASTADDR &&
cv_rendezvousserver.string[0])
{
I_NetRequestHolePunch(); I_NetRequestHolePunch();
}
} }
serverelem_t serverlist[MAXSERVERLIST]; serverelem_t serverlist[MAXSERVERLIST];
@ -5730,14 +5733,17 @@ static void UpdatePingTable(void)
static void RenewHolePunch(void) static void RenewHolePunch(void)
{ {
static time_t past; if (cv_rendezvousserver.string[0])
const time_t now = time(NULL);
if ((now - past) > 20)
{ {
I_NetRegisterHolePunch(); static time_t past;
past = now;
const time_t now = time(NULL);
if ((now - past) > 20)
{
I_NetRegisterHolePunch();
past = now;
}
} }
} }

View file

@ -600,7 +600,8 @@ void Command_Numnodes(void)
#ifndef NONET #ifndef NONET
static boolean hole_punch(ssize_t c) static boolean hole_punch(ssize_t c)
{ {
if (c == 10 && holepunchpacket->magic == hole_punch_magic) if (cv_rendezvousserver.string[0] &&
c == 10 && holepunchpacket->magic == hole_punch_magic)
{ {
mysockaddr_t addr; mysockaddr_t addr;
addr.ip4.sin_family = AF_INET; addr.ip4.sin_family = AF_INET;