From 3664db61e7572e8bbc58ad57a28638ee25b3ce83 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 2 Jan 2014 15:21:22 -0800 Subject: [PATCH] Fix static storage duration issue with some Journal logs --- src/ripple_app/peers/Peers.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ripple_app/peers/Peers.cpp b/src/ripple_app/peers/Peers.cpp index 0702d82f4..c6b2521a2 100644 --- a/src/ripple_app/peers/Peers.cpp +++ b/src/ripple_app/peers/Peers.cpp @@ -25,6 +25,24 @@ template <> char const* LogPartition::getPartitionName () { retu class NameResolverLog; template <> char const* LogPartition::getPartitionName () { return "NameResolver"; } +/** Calls a function during static initialization. */ +struct static_call +{ + // Function must be callable as + // void f (void) const + // + template + static_call (Function const& f) + { + f (); + } +}; + +static static_call init_PeerFinderLog (&LogPartition::get ); +static static_call init_NameResolverLog (&LogPartition::get ); + +//------------------------------------------------------------------------------ + class PeersImp : public Peers , public Stoppable