qstat.c
/* First packet for a QuakeWorld server
 */
First packet for a QuakeWorld server
First packet for a QuakeWorld server
query_status_t send_qwserver_request_packet(struct qserver *server)
{
	int rc;
	if (server->flags &FLAG_BROADCAST)
	{
		rc = send_broadcast(server, server->type->status_packet, server->type->status_len);
	}
	else if (server->server_name == NULL)
	{
		rc = send(server->fd, server->type->status_packet, server->type->status_len, 0);
	}
	else if (server->server_name != NULL && server->type->rule_packet)
	{
		rc = send(server->fd, server->type->rule_packet, server->type->rule_len, 0);
	}
	else
	{
		rc = SOCKET_ERROR;
	}
	if (rc == SOCKET_ERROR)
	{
		return send_error( server, rc );
	}
	if (server->retry1 == n_retries || server->flags &FLAG_BROADCAST)
	{
		gettimeofday(&server->packet_time1, NULL);
		server->n_requests++;
	}
	else if (server->server_name == NULL)
	{
		server->n_retries++;
	}
	server->retry1--;
	if (server->server_name == NULL)
	{
		server->n_packets++;
	}
	server->next_player_info = NO_PLAYER_INFO; 
	return INPROGRESS;
}
query_status_t send_qwserver_request_packet ( struct qserver * server ) { int rc ; if ( server -> flags & FLAG_BROADCAST ) { rc = send_broadcast ( server , server -> type -> status_packet , server -> type -> status_len ) ; } else if ( server -> server_name == NULL ) { rc = send ( server -> fd , server -> type -> status_packet , server -> type -> status_len , 0 ) ; } else if ( server -> server_name != NULL && server -> type -> rule_packet ) { rc = send ( server -> fd , server -> type -> rule_packet , server -> type -> rule_len , 0 ) ; } else { rc = SOCKET_ERROR ; } if ( rc == SOCKET_ERROR ) { return send_error ( server , rc ) ; } if ( server -> retry1 == n_retries || server -> flags & FLAG_BROADCAST ) { gettimeofday ( & server -> packet_time1 , NULL ) ; server -> n_requests ++ ; } else if ( server -> server_name == NULL ) { server -> n_retries ++ ; } server -> retry1 -- ; if ( server -> server_name == NULL ) { server -> n_packets ++ ; } server -> next_player_info = NO_PLAYER_INFO ; return INPROGRESS ; }
First packet for a QuakeWorld server
First packet for a QuakeWorld server
// we don't have a player packet