コード例 #1
0
ファイル: sv_main.c プロジェクト: ptitSeb/UFO--AI-OpenPandora
/**
 * @brief Send a message to the master every few minutes to
 * let it know we are alive, and log information
 */
static int Master_HeartbeatThread (void * data)
{
	/* send to master */
	Com_Printf("sending heartbeat\n");
	HTTP_GetURL(va("%s/ufo/masterserver.php?heartbeat&port=%s", masterserver_url->string, port->string), NULL);

	masterServerHeartBeatThread = NULL;
	return 0;
}
コード例 #2
0
/**
 * @brief Informs all masters that this server is going down
 */
static void Master_Shutdown (void)
{
	if (!sv_dedicated || !sv_dedicated->integer)
		return;					/* only dedicated servers send heartbeats */

	if (!sv_public || !sv_public->integer)
		return;					/* a private dedicated game */

	/* send to master */
	HTTP_GetURL(va("%s/ufo/masterserver.php?shutdown&port=%s", masterserver_url->string, port->string), NULL);
}
コード例 #3
0
/**
 * @brief Send a message to the master every few minutes to
 * let it know we are alive, and log information
 */
static int Master_HeartbeatThread (void * data)
{
	char url[512];
	Com_sprintf(url, sizeof(url), "%s/ufo/masterserver.php?heartbeat&port=%s", masterserver_url->string, port->string);

	/* send to master */
	Com_Printf("sending heartbeat\n");
	HTTP_GetURL(url, NULL);

	masterServerHeartBeatThread = NULL;
	return 0;
}
コード例 #4
0
ファイル: web_main.cpp プロジェクト: AresAndy/ufoai
/**
 * @brief Downloads the given url and notify the callback. The login credentials are automatically added as GET parameters
 * @param[in] url The url to download
 * @param[in] callback The callback to given the downloaded data to
 * @param[in] userdata Userdata that is given to the @c callback
 * @return @c true if the download was successful, @c false otherwise
 */
bool WEB_GetURL (const char* url, http_callback_t callback, void* userdata)
{
	char buf[576];
	char passwordEncoded[512];
	HTTP_Encode(web_password->string, passwordEncoded, sizeof(passwordEncoded));
	char usernameEncoded[128];
	HTTP_Encode(web_username->string, usernameEncoded, sizeof(usernameEncoded));
	const char sep = strchr(url, '?') ? '&' : '?';
	if (!Com_sprintf(buf, sizeof(buf), "%s%cusername=%s&password=%s", url, sep, usernameEncoded, passwordEncoded)) {
		Com_Printf("overflow in url length: '%s'\n", buf);
		return false;
	}
	return HTTP_GetURL(buf, callback, userdata);
}
コード例 #5
0
ファイル: sv_main.c プロジェクト: chrisglass/ufoai
/**
 * @brief Send a message to the master every few minutes to
 * let it know we are alive, and log information
 */
static int Master_HeartbeatThread (void * data)
{
	char *responseBuf;

	/* send to master */
	Com_Printf("sending heartbeat\n");
	responseBuf = HTTP_GetURL(va("%s/ufo/masterserver.php?heartbeat&port=%s", masterserver_url->string, port->string));
	if (responseBuf) {
		Com_DPrintf(DEBUG_SERVER, "response: %s\n", responseBuf);
		Mem_Free(responseBuf);
	}

	masterServerHeartBeatThread = NULL;
	return 0;
}
コード例 #6
0
ファイル: sv_main.c プロジェクト: chrisglass/ufoai
/**
 * @brief Informs all masters that this server is going down
 */
static void Master_Shutdown (void)
{
	char *responseBuf;

	if (!sv_dedicated || !sv_dedicated->integer)
		return;					/* only dedicated servers send heartbeats */

	if (!sv_public || !sv_public->integer)
		return;					/* a private dedicated game */

	/* send to master */
	responseBuf = HTTP_GetURL(va("%s/ufo/masterserver.php?shutdown&port=%s", masterserver_url->string, port->string));
	if (responseBuf) {
		Com_DPrintf(DEBUG_SERVER, "response: %s\n", responseBuf);
		Mem_Free(responseBuf);
	}
}