void CL_Shutdown(void) { static qboolean isdown = false; if (isdown) { printf("recursive shutdown\n"); return; } isdown = true; #ifdef USE_CURL CL_HTTP_Cleanup(true); #endif CL_WriteConfiguration(); Key_WriteConsoleHistory(); OGG_Stop(); S_Shutdown(); IN_Shutdown(); VID_Shutdown(); }
/* =============== CL_SetHTTPServer A new server is specified, so we nuke all our state. =============== */ void CL_SetHTTPServer (const char *URL) { dlqueue_t *q, *last; CL_HTTP_Cleanup (false); q = &cls.downloadQueue; last = NULL; while (q->next) { q = q->next; if (last) Z_Free (last); last = q; } if (last) Z_Free (last); if (multi) Com_Error (ERR_DROP, "CL_SetHTTPServer: Still have old handle"); multi = curl_multi_init (); memset (&cls.downloadQueue, 0, sizeof(cls.downloadQueue)); abortDownloads = HTTPDL_ABORT_NONE; handleCount = pendingCount = 0; strncpy (cls.downloadServer, URL, sizeof(cls.downloadServer)-1); }
/** * @brief Saves configuration file and shuts the client systems down * @todo this is a callback from @c Sys_Quit and @c Com_Error. It would be better * to run quit through here before the final handoff to the sys code. * @sa Sys_Quit * @sa CL_Init */ void CL_Shutdown (void) { if (isdown) { printf("recursive shutdown\n"); return; } isdown = true; /* remove cvar feedback */ for (const cvar_t* var = Cvar_GetFirst(); var; var = var->next) { if (var->flags & CVAR_R_CONTEXT) Cvar_UnRegisterChangeListener(var->name, CL_RContextCvarChange); if (var->flags & CVAR_R_IMAGES) Cvar_UnRegisterChangeListener(var->name, CL_RImagesCvarChange); } GAME_SetMode(nullptr); GAME_UnloadGame(); CL_HTTP_Cleanup(); Irc_Shutdown(); Con_SaveConsoleHistory(); Key_WriteBindings("keys.cfg"); S_Shutdown(); R_Shutdown(); UI_Shutdown(); CIN_Shutdown(); SEQ_Shutdown(); GAME_Shutdown(); CL_LanguageShutdown(); TOTD_Shutdown(); SCR_Shutdown(); }
/** * @brief A new server is specified, so we nuke all our state. */ void CL_SetHTTPServer (const char *URL) { CL_HTTP_Cleanup(); for (dlqueue_t* q = cls.downloadQueue; q;) { dlqueue_t* const del = q; q = q->next; Mem_Free(del); } cls.downloadQueue = 0; if (multi) Com_Error(ERR_DROP, "CL_SetHTTPServer: Still have old handle"); multi = curl_multi_init(); abortDownloads = HTTPDL_ABORT_NONE; handleCount = pendingCount = 0; Q_strncpyz(cls.downloadServer, URL, sizeof(cls.downloadServer)); }
/* =============== CL_SetHTTPServer A new server is specified, so we nuke all our state. =============== */ void CL_SetHTTPServer (const char *URL) { dlqueue_t *q, *last; CL_HTTP_Cleanup (false); q = &cls.downloadQueue; last = NULL; while (q->next) { q = q->next; if (last) Z_Free (last); last = q; } if (last) Z_Free (last); if (multi) Com_Error (ERR_DROP, "CL_SetHTTPServer: Still have old handle"); multi = curl_multi_init (); memset (&cls.downloadQueue, 0, sizeof(cls.downloadQueue)); abortDownloads = HTTPDL_ABORT_NONE; handleCount = pendingCount = 0; strncpy (cls.downloadServer, URL, sizeof(cls.downloadServer)-1); // FS: Added because Whale's Weapons HTTP server rejects you after a lot of 404s. Then you lose HTTP until a hard reconnect. cls.downloadServerRetry[0] = 0; }