]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Close some databases on shutdown if they're open
authorMario <mario.mario@y7mail.com>
Tue, 24 Dec 2019 15:02:06 +0000 (01:02 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 24 Dec 2019 15:02:06 +0000 (01:02 +1000)
qcsrc/common/command/rpn.qc
qcsrc/common/playerstats.qc
qcsrc/common/playerstats.qh

index 0998fad9dbd4ea4ea02ed815840ff18a8b3f548f..4165d3dddac289b34a2ffc42ed9f09dccd259b8b 100644 (file)
@@ -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)
index cf272e5635a1eb66e72ec90810b864b10eff9f27..511ac46e66eedc7a8b35ce447b328b56f1a89ff7 100644 (file)
@@ -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
index d27dd0ed1f775038bb904e57327876a84d45314d..d41a097d6d642419ecd4f8218e071774ca516f47 100644 (file)
@@ -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