X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Fglobal.cpp;h=ec296c1aea3c4112be6b6d7c5af035bfa030d072;hp=38d51bc35c9c2f7253c63541c6af79c7706ea593;hb=14fff12d9df0ee30e2df4bf9d22c2e83065816df;hpb=44f964d9b2b2d55a5b5672e9297717bd25fa8ee2 diff --git a/src/global.cpp b/src/global.cpp index 38d51bc..ec296c1 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -17,7 +17,7 @@ #include #endif -bool wantshutdown=false; +volatile bool wantshutdown=false; std::string CreateShortIdentityName(const std::string &name, const std::string &publickey) { @@ -39,11 +39,18 @@ void SetupDB() { DateTime date; + std::string tempval=""; SQLite3DB::DB *db=SQLite3DB::DB::Instance(); db->Open("fms.db3"); db->SetBusyTimeout(10000); // set timeout to 10 seconds - //db->Execute("VACUUM;"); // not needed every startup + + tempval=""; + Option::Instance()->Get("VacuumOnStartup",tempval); + if(tempval=="true") + { + db->Execute("VACUUM;"); + } db->Execute("CREATE TABLE IF NOT EXISTS tblDBVersion(\ Major INTEGER,\ @@ -864,6 +871,12 @@ void SetupDefaultOptions() st.Step(); st.Reset(); + st.Bind(0,"VacuumOnStartup"); + st.Bind(1,"false"); + st.Bind(2,"VACUUM the database every time FMS starts. This will defragment the free space in the database and create a smaller database file. Vacuuming the database can be CPU and disk intensive."); + st.Step(); + st.Reset(); + } void SetupLogFile() @@ -903,6 +916,9 @@ void SetupNetwork() void Shutdown() { + + LogFile::Instance()->WriteLog(LogFile::LOGLEVEL_DEBUG,"FMS starting shutdown"); + ThreadController::Instance()->ShutdownThreads(); ShutdownNetwork();