Project

General

Profile

Bug #1878 ยป upnp-db-connection-flag.diff

disable vacuum-ing of db only if not yet connected - Zoolooc, 03/28/2015 01:19 PM

View differences:

upnp/include/server.h 2015-03-28 11:57:17.392249703 +0100
Description mServerDescription;
iconList mServerIcons;
upnp::cConfig mCurrentConfiguration;
tntdb::Connection mConnection;
tntdb::Connection mConnection;
bool mbConnected;
string mConfigDirectory;
UpnpDevice_Handle mDeviceHandle;
int mAnnounceMaxAge;
upnp/server/server.cpp 2015-03-28 11:56:02.109186240 +0100
, mMaxContentLength(KB(20))
, mWebserver(NULL)
, mMediaManager(NULL)
, mbConnected(false)
{
char tmp[255];
......
delete mMediaManager;
mMediaManager = NULL;
}
try {
mConnection.execute("VACUUM");
} catch (const std::exception& e) {
esyslog("UPnP\tFailed to vacuum database: '%s'", e.what());
if (mbConnected) {
try {
mConnection.execute("VACUUM");
} catch (const std::exception& e) {
esyslog("UPnP\tFailed to vacuum database: '%s'", e.what());
}
}
}
......
mConnection.execute("PRAGMA temp_store = MEMORY");
mConnection.execute("PRAGMA synchronous = NORMAL");
mConnection.execute("PRAGMA locking_mode = EXCLUSIVE");
mbConnected = true;
isyslog("UPnP\tSuccessfully connected to %s.", ss.str().c_str());
} catch (const std::exception& e) {
    (1-1/1)