From 2da5c4cc3177a1385ff49cc2bea408626dfce135 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Wed, 9 May 2012 17:05:28 -0700 Subject: [PATCH] Remove dead code TimingService. --- src/Application.cpp | 2 -- src/Application.h | 2 -- src/LedgerMaster.cpp | 1 - src/NetworkOPs.cpp | 9 ++----- src/NetworkOPs.h | 2 +- src/TimingService.cpp | 56 ------------------------------------------- src/TimingService.h | 26 -------------------- 7 files changed, 3 insertions(+), 95 deletions(-) delete mode 100644 src/TimingService.cpp delete mode 100644 src/TimingService.h diff --git a/src/Application.cpp b/src/Application.cpp index af7a09fde..0b8ff282b 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -106,8 +106,6 @@ void Application::run() // mConnectionPool.start(); - mTimingService.start(mIOService); - // Temporary root account will be ["This is my payphrase."]:0 NewcoinAddress rootFamilySeed; // Hold the 128 password. NewcoinAddress rootFamilyGenerator; // Hold the generator. diff --git a/src/Application.h b/src/Application.h index 293bf4a5a..a1c8b147e 100644 --- a/src/Application.h +++ b/src/Application.h @@ -3,7 +3,6 @@ #include "UniqueNodeList.h" #include "ConnectionPool.h" -#include "TimingService.h" #include "PubKeyCache.h" #include "ScopedLock.h" #include "LedgerMaster.h" @@ -38,7 +37,6 @@ class Application NetworkOPs mNetOps; Wallet mWallet; - TimingService mTimingService; UniqueNodeList mUNL; PubKeyCache mPKCache; LedgerMaster mMasterLedger; diff --git a/src/LedgerMaster.cpp b/src/LedgerMaster.cpp index 12002a74b..a198a6a61 100644 --- a/src/LedgerMaster.cpp +++ b/src/LedgerMaster.cpp @@ -1,7 +1,6 @@ #include "LedgerMaster.h" #include "Application.h" #include "NewcoinAddress.h" -#include "TimingService.h" #include "Conversion.h" #include diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index d9d756e0c..aef5d17bd 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -24,14 +24,9 @@ NetworkOPs::NetworkOPs(boost::asio::io_service& io_service) : mMode(omDISCONNECT { } -time_t NetworkOPs::getNetworkTimeTT() -{ - return time(NULL); -} - boost::posix_time::ptime NetworkOPs::getNetworkTimePT() { - return boost::posix_time::from_time_t(getNetworkTimeTT()); + return boost::posix_time::second_clock::universal_time(); } uint64 NetworkOPs::getNetworkTimeNC() @@ -356,4 +351,4 @@ void NetworkOPs::switchLastClosedLedger(Ledger::pointer newLedger, bool normal) boost::make_shared(PackedMessage::MessagePointer(s), newcoin::mtSTATUS_CHANGE); theApp->getConnectionPool().relayMessage(NULL, packet); } - +// vim:ts=4 diff --git a/src/NetworkOPs.h b/src/NetworkOPs.h index c141a266f..cdd8eb848 100644 --- a/src/NetworkOPs.h +++ b/src/NetworkOPs.h @@ -38,7 +38,6 @@ public: // network information uint64 getNetworkTimeNC(); - time_t getNetworkTimeTT(); boost::posix_time::ptime getNetworkTimePT(); uint32 getCurrentLedgerID(); OperatingMode getOperatingMode() { return mMode; } @@ -74,3 +73,4 @@ public: }; #endif +// vim:ts=4 diff --git a/src/TimingService.cpp b/src/TimingService.cpp deleted file mode 100644 index 782ee9ae5..000000000 --- a/src/TimingService.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "TimingService.h" -#include "Config.h" -#include "Application.h" - -#include -#include -#include - -using namespace std; -using namespace boost; - -/* -Only needs to start once we determine the network time -*/ - -TimingService::TimingService() : mLedgerTimer(NULL), mPropTimer(NULL), mValidTimer(NULL) -{ -} - -void TimingService::start(boost::asio::io_service& ioService) -{ - // TODO: calculate the amount of seconds left in the current ledger - mLedgerTimer=new asio::deadline_timer(ioService, posix_time::seconds(theConfig.LEDGER_SECONDS)), - mLedgerTimer->async_wait(boost::bind(&TimingService::handleLedger, this)); - - mPropTimer=new asio::deadline_timer(ioService, posix_time::seconds(theConfig.LEDGER_PROPOSAL_DELAY_SECONDS)); - -} - -void TimingService::handleLedger() -{ -#if 0 - theApp->getLedgerMaster().startFinalization(); - mLedgerTimer->expires_at(mLedgerTimer->expires_at() + boost::posix_time::seconds(theConfig.LEDGER_SECONDS)); - mLedgerTimer->async_wait(boost::bind(&TimingService::handleLedger, this)); - - mPropTimer->expires_at(mLedgerTimer->expires_at() + boost::posix_time::seconds(theConfig.LEDGER_PROPOSAL_DELAY_SECONDS)); - mPropTimer->async_wait(boost::bind(&TimingService::handleProp, this)); -#endif -} - -void TimingService::handleProp() -{ -// theApp->getLedgerMaster().sendProposal(); -} - -void TimingService::handleValid() -{ -// theApp->getLedgerMaster().endFinalization(); -} - -int TimingService::getCurrentLedgerIndex() -{ - return( (time(NULL)-theConfig.NETWORK_START_TIME)/theConfig.LEDGER_SECONDS ); -} - diff --git a/src/TimingService.h b/src/TimingService.h deleted file mode 100644 index 125effd3b..000000000 --- a/src/TimingService.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __TIMINGSERVICE__ -#define __TIMINGSERVICE__ - -#include - -/* responsible for keeping track of network time -and kicking off the publishing process -*/ - -class TimingService -{ - boost::asio::deadline_timer* mLedgerTimer; - boost::asio::deadline_timer* mPropTimer; - boost::asio::deadline_timer* mValidTimer; - - void handleLedger(); - void handleProp(); - void handleValid(); -public: - TimingService(); - void start(boost::asio::io_service& ioService); - - static int getCurrentLedgerIndex(); - -}; -#endif