Match socket array param size with what's actually used.

Harmless as unix sockets (idx 2) aren't accessed, but correct.

Also updates IPv4 index access with its enum.
This commit is contained in:
Daniel Svensson 2023-12-22 10:34:45 +01:00
parent 9d6f5eb9cb
commit 8813af0e40
2 changed files with 3 additions and 3 deletions

View File

@ -112,7 +112,7 @@ void NET_InitUDPSocket(cluster_t *cluster, int port, int socketid)
Sys_Printf(cluster, "opened udp port %i\n", port);
}
SOCKET NET_ChooseSocket(SOCKET sock[2], netadr_t *toadr, netadr_t ina)
SOCKET NET_ChooseSocket(SOCKET sock[SOCKETGROUPS], netadr_t *toadr, netadr_t ina)
{
#ifdef AF_INET6
if (((struct sockaddr *)ina.sockaddr)->sa_family == AF_INET6)
@ -120,7 +120,7 @@ SOCKET NET_ChooseSocket(SOCKET sock[2], netadr_t *toadr, netadr_t ina)
*toadr = ina;
return sock[SG_IPV6];
}
if (sock[0] == INVALID_SOCKET && sock[SG_IPV6] != INVALID_SOCKET)
if (sock[SG_IPV4] == INVALID_SOCKET && sock[SG_IPV6] != INVALID_SOCKET)
{
struct sockaddr_in6 *out = (struct sockaddr_in6*)toadr->sockaddr;
struct sockaddr_in *in = (struct sockaddr_in*)ina.sockaddr;

View File

@ -947,7 +947,7 @@ void Netchan_OutOfBandPrint (cluster_t *cluster, netadr_t adr, char *format, ...
//int Netchan_IsLocal (netadr_t adr);
void NET_InitUDPSocket(cluster_t *cluster, int port, int socketid);
void NET_SendPacket(cluster_t *cluster, SOCKET sock, int length, void *data, netadr_t adr);
SOCKET NET_ChooseSocket(SOCKET sock[], netadr_t *toadr, netadr_t in);
SOCKET NET_ChooseSocket(SOCKET sock[SOCKETGROUPS], netadr_t *toadr, netadr_t in);
qboolean Net_CompareAddress(netadr_t *s1, netadr_t *s2, int qp1, int qp2);
qboolean Netchan_Process (netchan_t *chan, netmsg_t *msg);
qboolean NQNetchan_Process(cluster_t *cluster, netchan_t *chan, netmsg_t *msg);