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,6 +5733,8 @@ static void UpdatePingTable(void)
static void RenewHolePunch(void) static void RenewHolePunch(void)
{ {
if (cv_rendezvousserver.string[0])
{
static time_t past; static time_t past;
const time_t now = time(NULL); const time_t now = time(NULL);
@ -5739,6 +5744,7 @@ static void RenewHolePunch(void)
I_NetRegisterHolePunch(); I_NetRegisterHolePunch();
past = now; past = now;
} }
}
} }
// Handle timeouts to prevent definitive freezes from happenning // Handle timeouts to prevent definitive freezes from happenning

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;