Remove dead code TimingService.

This commit is contained in:
Arthur Britto
2012-05-09 17:05:28 -07:00
parent e5a074030d
commit 2da5c4cc31
7 changed files with 3 additions and 95 deletions

View File

@@ -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.

View File

@@ -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;

View File

@@ -1,7 +1,6 @@
#include "LedgerMaster.h"
#include "Application.h"
#include "NewcoinAddress.h"
#include "TimingService.h"
#include "Conversion.h"
#include <boost/foreach.hpp>

View File

@@ -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>(PackedMessage::MessagePointer(s), newcoin::mtSTATUS_CHANGE);
theApp->getConnectionPool().relayMessage(NULL, packet);
}
// vim:ts=4

View File

@@ -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

View File

@@ -1,56 +0,0 @@
#include "TimingService.h"
#include "Config.h"
#include "Application.h"
#include <iostream>
#include <ctime>
#include <boost/bind.hpp>
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 );
}

View File

@@ -1,26 +0,0 @@
#ifndef __TIMINGSERVICE__
#define __TIMINGSERVICE__
#include <boost/asio.hpp>
/* 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