예제 #1
0
/*
 * @brief Sends heartbeat messages to master servers every 300s.
 */
void Sv_HeartbeatMasters(void) {
	const char *string;
	int32_t i;

	if (!dedicated->value)
		return; // only dedicated servers report to masters

	if (!sv_public->value)
		return; // a private dedicated game

	if (!svs.initialized) // we're not up yet
		return;

	if (svs.next_heartbeat > quetoo.time)
		return; // not time to send yet

	svs.next_heartbeat = quetoo.time + HEARTBEAT_SECONDS * 1000;

	// send the same string that we would give for a status command
	string = Sv_StatusString();

	// send to each master server
	for (i = 0; i < MAX_MASTERS; i++) {
		if (svs.masters[i].port) {
			Com_Print("Sending heartbeat to %s\n", Net_NetaddrToString(&svs.masters[i]));
			Netchan_OutOfBandPrint(NS_UDP_SERVER, &svs.masters[i], "heartbeat\n%s", string);
		}
	}
}
예제 #2
0
파일: sv_main.c 프로젝트: darkshade9/aq2w
/*
 * Sv_HeartbeatMasters
 *
 * Sends heartbeat messages to master servers every 300s.
 */
static void Sv_HeartbeatMasters(void) {
	const char *string;
	int i;

	if (!dedicated->value)
		return; // only dedicated servers report to masters

	if (!sv_public->value)
		return; // a private dedicated game

	if (!svs.initialized) // we're not up yet
		return;

	if (svs.last_heartbeat > svs.real_time) // catch wraps
		svs.last_heartbeat = svs.real_time;

	if (svs.last_heartbeat) { // if we've sent one, wait a while
		if (svs.real_time - svs.last_heartbeat < HEARTBEAT_SECONDS * 1000)
			return; // not time to send yet
	}

	svs.last_heartbeat = svs.real_time;

	// send the same string that we would give for a status command
	string = Sv_StatusString();

	// send to each master server
	for (i = 0; i < MAX_MASTERS; i++) {
		if (svs.masters[i].port) {
			Com_Print("Sending heartbeat to %s\n",
					Net_NetaddrToString(svs.masters[i]));
			Netchan_OutOfBandPrint(NS_SERVER, svs.masters[i], "heartbeat\n%s",
					string);
		}
	}
}
예제 #3
0
/*
 * @brief Responds with all the info that qplug or qspy can see.
 */
static void Svc_Status(void) {
	Netchan_OutOfBandPrint(NS_UDP_SERVER, &net_from, "print\n%s", Sv_StatusString());
}