Merge branch 'master' of github.com:jedmccaleb/NewCoin into new_pathfinding

This commit is contained in:
JoelKatz
2013-03-22 14:48:15 -07:00
46 changed files with 909 additions and 442 deletions

View File

@@ -24,8 +24,11 @@ LogPartition TaggedCachePartition("TaggedCache");
LogPartition AutoSocketPartition("AutoSocket");
Application* theApp = NULL;
int DatabaseCon::sCount = 0;
DatabaseCon::DatabaseCon(const std::string& strName, const char *initStrings[], int initCount)
{
++sCount;
boost::filesystem::path pPath = (theConfig.RUN_STANDALONE && (theConfig.START_UP != Config::LOAD))
? "" // Use temporary files.
: (theConfig.DATA_DIR / strName); // Use regular db files.
@@ -63,6 +66,7 @@ bool Instance::running = true;
void Application::stop()
{
cLog(lsINFO) << "Received shutdown request";
StopSustain();
mShutdown = true;
mIOService.stop();
mHashedObjectStore.bulkWrite();
@@ -88,6 +92,12 @@ void sigIntHandler(int)
}
#endif
static void runAux(boost::asio::io_service& svc)
{
NameThread("aux");
svc.run();
}
void Application::setup()
{
mJobQueue.setThreadCount();
@@ -115,7 +125,7 @@ void Application::setup()
LogPartition::setSeverity(lsDEBUG);
}
boost::thread(boost::bind(&boost::asio::io_service::run, &mAuxService)).detach();
boost::thread(boost::bind(runAux, boost::ref(mAuxService))).detach();
if (!theConfig.RUN_STANDALONE)
mSNTPClient.init(theConfig.SNTP_SERVERS);
@@ -178,6 +188,13 @@ void Application::setup()
mLedgerMaster.tune(theConfig.getSize(siLedgerSize), theConfig.getSize(siLedgerAge));
mLedgerMaster.setMinValidations(theConfig.VALIDATION_QUORUM);
theApp->getHashNodeDB()->getDB()->executeSQL(boost::str(boost::format("PRAGMA cache_size=-%d;") %
(theConfig.getSize(siHashNodeDBCache) * 1024)));
theApp->getLedgerDB()->getDB()->executeSQL(boost::str(boost::format("PRAGMA cache_size=-%d;") %
(theConfig.getSize(siTxnDBCache) * 1024)));
theApp->getTxnDB()->getDB()->executeSQL(boost::str(boost::format("PRAGMA cache_size=-%d;") %
(theConfig.getSize(siLgrDBCache) * 1024)));
//
// Allow peer connections.
//