From 408fe7400dec5102a774965324ea20e991a1faab Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Fri, 22 Jun 2012 00:29:27 -0700 Subject: [PATCH] Integrate websocket door into Application. --- src/Application.cpp | 26 +++++++++++++++----------- src/Application.h | 2 ++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index 05ea8e446d..ebca2d4524 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -1,11 +1,4 @@ -#include - -#include -#include - -#include "../database/SqliteDatabase.h" - #include "Application.h" #include "Config.h" #include "PeerDoor.h" @@ -14,9 +7,16 @@ #include "key.h" #include "utils.h" #include "TaggedCache.h" -#include "boost/filesystem.hpp" #include "Log.h" +#include "../database/SqliteDatabase.h" + +#include + +#include +#include +#include + Application* theApp = NULL; DatabaseCon::DatabaseCon(const std::string& strName, const char *initStrings[], int initCount) @@ -52,7 +52,7 @@ void Application::stop() { mIOService.stop(); - std::cerr << "Stopped: " << mIOService.stopped() << std::endl; + Log(lsINFO) << "Stopped: " << mIOService.stopped(); } static void InitDB(DatabaseCon** dbCon, const char *fileName, const char *dbInit[], int dbCount) @@ -111,6 +111,8 @@ void Application::run() std::cerr << "RPC interface: disabled" << std::endl; } + mWSDoor = WSDoor::createWSDoor(); + // // Begin connecting to network. // @@ -122,8 +124,8 @@ void Application::run() NewcoinAddress rootAddress = NewcoinAddress::createAccountPublic(rootGeneratorMaster, 0); // Print enough information to be able to claim root account. - std::cerr << "Root master seed: " << rootSeedMaster.humanSeed() << std::endl; - std::cerr << "Root account: " << rootAddress.humanAccountID() << std::endl; + Log(lsINFO) << "Root master seed: " << rootSeedMaster.humanSeed(); + Log(lsINFO) << "Root account: " << rootAddress.humanAccountID(); Ledger::pointer firstLedger = boost::make_shared(rootAddress, SYSTEM_CURRENCY_START); assert(!!firstLedger->getAccountState(rootAddress)); @@ -141,6 +143,8 @@ void Application::run() mIOService.run(); // This blocks + mWSDoor->stop(); + std::cout << "Done." << std::endl; } diff --git a/src/Application.h b/src/Application.h index ec00b94e89..629976dadb 100644 --- a/src/Application.h +++ b/src/Application.h @@ -12,6 +12,7 @@ #include "Wallet.h" #include "Peer.h" #include "NetworkOPs.h" +#include "WSDoor.h" #include "TaggedCache.h" #include "ValidationCollection.h" #include "Suppression.h" @@ -54,6 +55,7 @@ class Application ConnectionPool mConnectionPool; PeerDoor* mPeerDoor; RPCDoor* mRPCDoor; + WSDoor* mWSDoor; uint256 mNonce256; std::size_t mNonceST;