This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
#include "quakedef.h"
#include "net_dgrm.h"
+cvar_t cl_port = {CVAR_SAVE, "cl_port", "0"};
+
// these two macros are to make the code more readable
#define sfunc net_landrivers[sock->landriver]
#define dfunc net_landrivers[net_landriverlevel]
{
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);
myDriverLevel = net_driverlevel;
Cmd_AddCommand ("net_stats", NET_Stats_f);
+ Cvar_RegisterVariable (&cl_port);
if (COM_CheckParm("-nolan"))
return -1;
int activeNumber;
int clientNumber;
client_t *client;
-
+
playerNumber = MSG_ReadByte();
activeNumber = -1;
for (clientNumber = 0, client = svs.clients; clientNumber < svs.maxclients; clientNumber++, client++)
return NULL;
}
- // everything is allocated, just fill in the details
+ // everything is allocated, just fill in the details
sock->socket = newsock;
sock->landriver = net_landriverlevel;
sock->addr = clientaddr;
if (dfunc.GetAddrFromName(host, &sendaddr) == -1)
return NULL;
- newsock = dfunc.OpenSocket (0);
+ newsock = dfunc.OpenSocket (cl_port.integer);
if (newsock == -1)
return NULL;
dfunc.GetNameFromAddr (&sendaddr, sock->address);
- Con_Printf ("Connection accepted\n");
+ Con_Printf ("Connection accepted to %s\n", sock->address);
sock->lastMessageTime = SetNetTime();
// switch the connection to the specified address