From: Mario Date: Tue, 24 Dec 2019 15:02:06 +0000 (+1000) Subject: Close some databases on shutdown if they're open X-Git-Tag: xonotic-v0.8.5~1196 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9e1ff4dcaf2580bf6ca052d829063b3b2cc57961;p=xonotic%2Fxonotic-data.pk3dir.git Close some databases on shutdown if they're open --- diff --git a/qcsrc/common/command/rpn.qc b/qcsrc/common/command/rpn.qc index 0998fad9d..4165d3ddd 100644 --- a/qcsrc/common/command/rpn.qc +++ b/qcsrc/common/command/rpn.qc @@ -53,6 +53,12 @@ float rpn_popf() { return stof(rpn_pop()); } void rpn_pushf(float f) { return rpn_push(sprintf("%.9g", f)); } void rpn_setf(float f) { return rpn_set(sprintf("%.9g", f)); } +SHUTDOWN(_rpndb) +{ + if(rpn_db) + db_close(rpn_db); +} + void GenericCommand_rpn(int request, int argc, string command) { switch(request) diff --git a/qcsrc/common/playerstats.qc b/qcsrc/common/playerstats.qc index cf272e563..511ac46e6 100644 --- a/qcsrc/common/playerstats.qc +++ b/qcsrc/common/playerstats.qc @@ -490,6 +490,21 @@ void PlayerStats_PlayerBasic(entity joiningplayer, float newrequest) } } +SHUTDOWN(PlayerStats_PlayerBasic_Shutdown) +{ + if(PS_B_IN_DB >= 0) + { + db_close(PS_B_IN_DB); + PS_B_IN_DB = -1; + } + + if(PS_GR_OUT_DB >= 0) + { + db_close(PS_GR_OUT_DB); + PS_GR_OUT_DB = -1; + } +} + void PlayerStats_PlayerBasic_CheckUpdate(entity joiningplayer) { // determine whether we should retrieve playerbasic information again diff --git a/qcsrc/common/playerstats.qh b/qcsrc/common/playerstats.qh index d27dd0ed1..d41a097d6 100644 --- a/qcsrc/common/playerstats.qh +++ b/qcsrc/common/playerstats.qh @@ -4,7 +4,7 @@ //float PS_PM_IN_DB = -1; // playerstats_prematch_in_db // db for info COLLECTED at the beginning of a match int PS_GR_OUT_DB = -1; // playerstats_gamereport_out_db // db of info SENT at the end of a match //float PS_GR_IN_DB = -1; // playerstats_gamereport_in_db // db for info COLLECTED at the end of a match -int PS_B_IN_DB = -1; // playerstats_playerbasic_in_db // db for info COLLECTED for basic player info (ELO) +float PS_B_IN_DB = -1; // playerstats_playerbasic_in_db // db for info COLLECTED for basic player info (ELO) #endif #ifdef MENUQC