From 220edfabf3d1c2cc4c01f55a7fb73d961d5bf35a Mon Sep 17 00:00:00 2001 From: Spoike Date: Thu, 8 Sep 2005 02:05:36 +0000 Subject: [PATCH] fixed console spam regarding invalid_socket on computers with no ipx support. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1295 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 7 ++++++- engine/client/net_master.c | 23 +++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 9536c1af4..9c7a98fc5 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -2063,7 +2063,7 @@ void CL_ReadPackets (void) continue; } - if (net_message.cursize < 8 && cls.demoplayback != DPB_MVD) //MVDs don't have the whole sequence header thing going on + if (net_message.cursize < 6 && cls.demoplayback != DPB_MVD) //MVDs don't have the whole sequence header thing going on { Con_TPrintf (TL_RUNTPACKET,NET_AdrToString(net_from)); continue; @@ -2962,6 +2962,8 @@ void Host_Init (quakeparms_t *parms) Plug_Init(); #endif + Masker_SetupSockets(); + // Con_Printf ("Exe: "__TIME__" "__DATE__"\n"); Con_TPrintf (TL_HEAPSIZE, parms->memsize/ (1024*1024.0)); @@ -2983,6 +2985,8 @@ void Host_Init (quakeparms_t *parms) Cbuf_AddText ("bind ~ toggleconsole\n", RESTRICT_LOCAL); //we expect default.cfg to not exist. :( Cbuf_AddText ("exec default.cfg\n", RESTRICT_LOCAL); Cbuf_AddText ("exec config.cfg\n", RESTRICT_LOCAL); + if (COM_FCheckExists ("q3config.cfg")) + Cbuf_AddText ("exec q3config.cfg\n", RESTRICT_LOCAL); Cbuf_AddText ("exec autoexec.cfg\n", RESTRICT_LOCAL); } Cbuf_AddText ("exec fte.cfg\n", RESTRICT_LOCAL); @@ -3001,6 +3005,7 @@ void Host_Init (quakeparms_t *parms) Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to + //assuming they didn't use any waits in thier config (fools) //the configs should be fully loaded. //so convert the backwards compable commandline parameters in cvar sets. diff --git a/engine/client/net_master.c b/engine/client/net_master.c index 2bf795582..34cba8740 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -90,7 +90,9 @@ char slist_keyname[SLIST_MAXKEYS][MAX_INFO_KEY]; int slist_customkeys; - +#ifndef INVALID_SOCKET +#define INVALID_SOCKET -1 +#endif #define POLLUDPSOCKETS 64 //it's big so we can have lots of messages when behind a firewall. Basically if a firewall only allows replys, and only remembers 3 servers per socket, we need this big cos it can take a while for a packet to find a fast optimised route and we might be waiting for a few secs for a reply the first time around. @@ -105,6 +107,15 @@ int lastpollsockIPX; #define POLLIPXSOCKETS 0 #endif +void Masker_SetupSockets(void) +{ + int i; + for (i = 0; i < POLLUDPSOCKETS; i++) + pollsocketsUDP[i] = INVALID_SOCKET; + for (i = 0; i < POLLIPXSOCKETS; i++) + pollsocketsIPX[i] = INVALID_SOCKET; +} + void NetadrToSockadr (netadr_t *a, struct sockaddr_qstorage *s); @@ -671,9 +682,9 @@ void NET_SendPollPacket(int len, void *data, netadr_t to) lastpollsockIPX++; if (lastpollsockIPX>=POLLIPXSOCKETS) lastpollsockIPX=0; - if (!pollsocketsIPX[lastpollsockIPX]) + if (pollsocketsIPX[lastpollsockIPX]==INVALID_SOCKET) pollsocketsIPX[lastpollsockIPX] = IPX_OpenSocket(PORT_ANY, true); - if (!pollsocketsIPX[lastpollsockIPX]) + if (pollsocketsIPX[lastpollsockIPX]==INVALID_SOCKET) return; //bother ret = sendto (pollsocketsIPX[lastpollsockIPX], data, len, 0, (struct sockaddr *)&addr, sizeof(addr) ); } @@ -683,9 +694,9 @@ void NET_SendPollPacket(int len, void *data, netadr_t to) lastpollsockUDP++; if (lastpollsockUDP>=POLLUDPSOCKETS) lastpollsockUDP=0; - if (!pollsocketsUDP[lastpollsockUDP]) + if (pollsocketsUDP[lastpollsockUDP]==INVALID_SOCKET) pollsocketsUDP[lastpollsockUDP] = UDP_OpenSocket(PORT_ANY, true); - if (!pollsocketsUDP[lastpollsockUDP]) + if (pollsocketsUDP[lastpollsockUDP]==INVALID_SOCKET) return; //bother ret = sendto (pollsocketsUDP[lastpollsockUDP], data, len, 0, (struct sockaddr *)&addr, sizeof(addr) ); } @@ -725,7 +736,7 @@ int NET_CheckPollSockets(void) #endif usesocket = pollsocketsUDP[sock]; - if (!usesocket) + if (usesocket == INVALID_SOCKET) continue; fromlen = sizeof(from); ret = recvfrom (usesocket, (char *)net_message_buffer, sizeof(net_message_buffer), 0, (struct sockaddr *)&from, &fromlen);