Skip to content

Commit

Permalink
[FOLD] Simplify interface with bool param
Browse files Browse the repository at this point in the history
  • Loading branch information
mellery451 committed Mar 1, 2017
1 parent 017465b commit dff284b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
14 changes: 7 additions & 7 deletions src/ripple/app/main/Application.cpp
Expand Up @@ -363,7 +363,7 @@ class ApplicationImp
std::unique_ptr <TxQ> txQ_;
DeadlineTimer m_sweepTimer;
DeadlineTimer m_entropyTimer;
bool m_startTimers;
bool startTimers_;

std::unique_ptr <DatabaseCon> mTxnDB;
std::unique_ptr <DatabaseCon> mLedgerDB;
Expand Down Expand Up @@ -511,7 +511,7 @@ class ApplicationImp

, m_entropyTimer (this)

, m_startTimers (false)
, startTimers_ (false)

, m_signals (get_io_service())

Expand Down Expand Up @@ -548,7 +548,7 @@ class ApplicationImp
//--------------------------------------------------------------------------

bool setup() override;
void doStart(Application::timers) override;
void doStart(bool withTimers) override;
void run() override;
bool isShutdown() override;
void signalStop() override;
Expand Down Expand Up @@ -844,7 +844,7 @@ class ApplicationImp
<< "Application starting. Version is " << BuildInfo::getVersionString();

using namespace std::chrono_literals;
if(m_startTimers)
if(startTimers_)
{
m_sweepTimer.setExpiration (10s);
m_entropyTimer.setRecurringExpiration (5min);
Expand Down Expand Up @@ -877,7 +877,7 @@ class ApplicationImp
// things will happen.
m_resolver->stop ();

if(m_startTimers)
if(startTimers_)
{
m_sweepTimer.cancel ();
m_entropyTimer.cancel ();
Expand Down Expand Up @@ -1273,9 +1273,9 @@ bool ApplicationImp::setup()
}

void
ApplicationImp::doStart(Application::timers t)
ApplicationImp::doStart(bool withTimers)
{
m_startTimers = (t == timers::active);
startTimers_ = withTimers;
prepare ();
start ();
}
Expand Down
7 changes: 1 addition & 6 deletions src/ripple/app/main/Application.h
Expand Up @@ -97,12 +97,7 @@ class Application : public beast::PropertyStream::Source
virtual ~Application () = default;

virtual bool setup() = 0;
enum class timers
{
active,
inactive
};
virtual void doStart(timers) = 0;
virtual void doStart(bool withTimers) = 0;
virtual void run() = 0;
virtual bool isShutdown () = 0;
virtual void signalStop () = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/app/main/Main.cpp
Expand Up @@ -461,7 +461,7 @@ int run (int argc, char** argv)
}

// Start the server
app->doStart(Application::timers::active);
app->doStart(true /*start timers*/);

// Block until we get a stop RPC.
app->run();
Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/impl/Env.cpp
Expand Up @@ -171,7 +171,7 @@ Env::AppBundle::AppBundle(beast::unit_test::suite& suite,
Throw<std::runtime_error> ("Env::AppBundle: setup failed");
timeKeeper->set(
app->getLedgerMaster().getClosedLedger()->info().closeTime);
app->doStart(Application::timers::inactive);
app->doStart(false /*don't start timers*/);
thread = std::thread(
[&](){ app->run(); });

Expand Down

0 comments on commit dff284b

Please sign in to comment.