engine/EngineNetwork.c
/*	Called by drivers when a new communications endpoint is required.
	The sequence and buffer fields will be filled in properly.
*/
Called by drivers when a new communications endpoint is required.
The sequence and buffer fields will be filled in properly.
Called by drivers when a new communications endpoint is required . The sequence and buffer fields will be filled in properly .
qsocket_t *NET_NewQSocket (void)
{
	qsocket_t	*sock;
	if (net_freeSockets == NULL)
		return NULL;
	if(iActiveNetConnections >= svs.maxclients)
		return NULL;
	sock = net_freeSockets;
	net_freeSockets = sock->next;
	sock->next = net_activeSockets;
	net_activeSockets = sock;
	sock->disconnected = false;
	sock->connecttime = net_time;
	strcpy(sock->address, "UNSET ADDRESS");
	sock->driver = net_driverlevel;
	sock->socket = 0;
	sock->driverdata = NULL;
	sock->canSend = TRUE;
	sock->sendNext = FALSE;
	sock->lastMessageTime = net_time;
	sock->ackSequence = 0;
	sock->sendSequence = 0;
	sock->unreliableSendSequence = 0;
	sock->sendMessageLength = 0;
	sock->receiveSequence = 0;
	sock->unreliableReceiveSequence = 0;
	sock->receiveMessageLength = 0;
	return sock;
}
qsocket_t * NET_NewQSocket ( void ) { qsocket_t * sock ; if ( net_freeSockets == NULL ) return NULL ; if ( iActiveNetConnections >= svs . maxclients ) return NULL ; sock = net_freeSockets ; net_freeSockets = sock -> next ; sock -> next = net_activeSockets ; net_activeSockets = sock ; sock -> disconnected = false ; sock -> connecttime = net_time ; strcpy ( sock -> address , " " ) ; sock -> driver = net_driverlevel ; sock -> socket = 0 ; sock -> driverdata = NULL ; sock -> canSend = TRUE ; sock -> sendNext = FALSE ; sock -> lastMessageTime = net_time ; sock -> ackSequence = 0 ; sock -> sendSequence = 0 ; sock -> unreliableSendSequence = 0 ; sock -> sendMessageLength = 0 ; sock -> receiveSequence = 0 ; sock -> unreliableReceiveSequence = 0 ; sock -> receiveMessageLength = 0 ; return sock ; }
Called by drivers when a new communications endpoint is required.
Called by drivers when a new communications endpoint is required .
// get one from free list // add it to active list