{
for (s = net_activeSockets; s; s = s->next)
PrintStats(s);
- for (s = net_freeSockets; s; s = s->next)
- PrintStats(s);
+ // LordHavoc: sockets are dynamically allocated now
+ //for (s = net_freeSockets; s; s = s->next)
+ // PrintStats(s);
}
else
{
for (s = net_activeSockets; s; s = s->next)
if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0)
break;
- if (s == NULL)
- for (s = net_freeSockets; s; s = s->next)
- if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0)
- break;
+ // LordHavoc: sockets are dynamically allocated now
+ //if (s == NULL)
+ // for (s = net_freeSockets; s; s = s->next)
+ // if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0)
+ // break;
if (s == NULL)
return;
PrintStats(s);
#include "quakedef.h"
-qsocket_t *net_activeSockets = NULL;
-qsocket_t *net_freeSockets = NULL;
-int net_numsockets = 0;
+qsocket_t *net_activeSockets = NULL;
+//qsocket_t *net_freeSockets = NULL;
+//int net_numsockets = 0;
+mempool_t *net_mempool;
qboolean ipxAvailable = false;
qboolean tcpipAvailable = false;
{
qsocket_t *sock;
- if (net_freeSockets == NULL)
- return NULL;
+// if (net_freeSockets == NULL)
+// return NULL;
if (net_activeconnections >= svs.maxclients)
return NULL;
// get one from free list
- sock = net_freeSockets;
- net_freeSockets = sock->next;
+// sock = net_freeSockets;
+// net_freeSockets = sock->next;
+ // LordHavoc: sockets are dynamically allocated now
+ sock = Mem_Alloc(net_mempool, sizeof(qsocket_t));
// add it to active list
sock->next = net_activeSockets;
}
// add it to free list
- sock->next = net_freeSockets;
- net_freeSockets = sock;
- sock->disconnected = true;
+// sock->next = net_freeSockets;
+// net_freeSockets = sock;
+// sock->disconnected = true;
+ // LordHavoc: sockets are dynamically allocated now
+ Mem_Free(sock);
}
r = sfunc.QSendMessage(sock, data);
if (r == 1 && sock->driver)
messagesSent++;
-
+
return r;
}
====================
*/
-static mempool_t *net_mempool;
-
void NET_Init (void)
{
int i;
int controlSocket;
- qsocket_t *s;
+ // LordHavoc: sockets are dynamically allocated now
+ //qsocket_t *s;
i = COM_CheckParm ("-port");
if (!i)
if (COM_CheckParm("-listen") || cls.state == ca_dedicated)
listening = true;
- net_numsockets = svs.maxclientslimit;
- if (cls.state != ca_dedicated)
- net_numsockets++;
+ // LordHavoc: sockets are dynamically allocated now
+ //net_numsockets = svs.maxclientslimit;
+ //if (cls.state != ca_dedicated)
+ // net_numsockets++;
SetNetTime();
net_mempool = Mem_AllocPool("qsocket");
+ // LordHavoc: sockets are dynamically allocated now
+ /*
s = Mem_Alloc(net_mempool, net_numsockets * sizeof(qsocket_t));
for (i = 0; i < net_numsockets; i++)
{
s->disconnected = true;
s++;
}
+ */
// allocate space for network message buffer
SZ_Alloc (&net_message, NET_MAXMESSAGE, "net_message");