diff options
-rw-r--r-- | media/mediaManager.cpp | 7 | ||||
-rw-r--r-- | server/server.cpp | 13 |
2 files changed, 12 insertions, 8 deletions
diff --git a/media/mediaManager.cpp b/media/mediaManager.cpp index 07afef2..96b7024 100644 --- a/media/mediaManager.cpp +++ b/media/mediaManager.cpp @@ -622,13 +622,6 @@ bool cMediaManager::Initialise(){ bool cMediaManager::CheckIntegrity(){ try { - connection.execute("PRAGMA foreign_keys = ON"); - connection.execute("PRAGMA page_size = 4096"); - connection.execute("PRAGMA cache_size = 16384"); - connection.execute("PRAGMA temp_store = MEMORY"); - connection.execute("PRAGMA synchronous = NORMAL"); - connection.execute("PRAGMA locking_mode = EXCLUSIVE"); - tntdb::Statement checkTable = connection.prepare( "SELECT name FROM sqlite_master WHERE type='table' AND name=:table;" ); diff --git a/server/server.cpp b/server/server.cpp index 28895ac..4d208bd 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -215,7 +215,7 @@ bool cMediaServer::Initialize(){ isyslog("UPnP\tInitialized UPnP media server on %s:%d", UpnpGetServerIpAddress(), UpnpGetServerPort()); mWebserver = new cWebserver(GetServerIPAddress()); - mMediaManager = new cMediaManager(); + stringstream ss; if(mCurrentConfiguration.expertSettings){ @@ -252,11 +252,22 @@ bool cMediaServer::Initialize(){ ss << "sqlite:" << mCurrentConfiguration.databaseDir << "/metadata.db"; try { mConnection = tntdb::connect(ss.str()); + + mConnection.execute("PRAGMA foreign_keys = ON"); + mConnection.execute("PRAGMA page_size = 4096"); + mConnection.execute("PRAGMA cache_size = 16384"); + mConnection.execute("PRAGMA temp_store = MEMORY"); + mConnection.execute("PRAGMA synchronous = NORMAL"); + mConnection.execute("PRAGMA locking_mode = EXCLUSIVE"); + + isyslog("UPnP\tSuccessfully connected to %s.", ss.str().c_str()); } catch (const std::exception& e) { esyslog("UPnP\tException occurred while connecting to database '%s': %s", ss.str().c_str(), e.what()); return false; } + mMediaManager = new cMediaManager(); + ret = UpnpSetMaxContentLength(GetMaxContentLength()); if(ret != UPNP_E_SUCCESS){ |