Format first-party source according to .clang-format

This commit is contained in:
Pretty Printer
2020-04-17 09:56:34 -05:00
committed by manojsdoshi
parent 65dfc5d19e
commit 50760c6935
1076 changed files with 86161 additions and 77449 deletions

View File

@@ -17,12 +17,12 @@
*/
//==============================================================================
#include <ripple/resource/ResourceManager.h>
#include <ripple/resource/impl/Logic.h>
#include <ripple/basics/chrono.h>
#include <ripple/basics/Log.h>
#include <ripple/basics/chrono.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <ripple/beast/net/IPAddressConversion.h>
#include <ripple/resource/ResourceManager.h>
#include <ripple/resource/impl/Logic.h>
#include <boost/asio/ip/address_v4.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/system/error_code.hpp>
@@ -44,19 +44,20 @@ private:
std::condition_variable cond_;
public:
ManagerImp (beast::insight::Collector::ptr const& collector,
ManagerImp(
beast::insight::Collector::ptr const& collector,
beast::Journal journal)
: journal_ (journal)
, logic_ (collector, stopwatch(), journal)
: journal_(journal), logic_(collector, stopwatch(), journal)
{
thread_ = std::thread {&ManagerImp::run, this};
thread_ = std::thread{&ManagerImp::run, this};
}
ManagerImp () = delete;
ManagerImp (ManagerImp const&) = delete;
ManagerImp& operator= (ManagerImp const&) = delete;
ManagerImp() = delete;
ManagerImp(ManagerImp const&) = delete;
ManagerImp&
operator=(ManagerImp const&) = delete;
~ManagerImp () override
~ManagerImp() override
{
{
std::lock_guard lock(mutex_);
@@ -66,81 +67,90 @@ public:
thread_.join();
}
Consumer newInboundEndpoint (beast::IP::Endpoint const& address) override
Consumer
newInboundEndpoint(beast::IP::Endpoint const& address) override
{
return logic_.newInboundEndpoint (address);
return logic_.newInboundEndpoint(address);
}
Consumer newInboundEndpoint (beast::IP::Endpoint const& address,
bool const proxy, boost::string_view const& forwardedFor) override
Consumer
newInboundEndpoint(
beast::IP::Endpoint const& address,
bool const proxy,
boost::string_view const& forwardedFor) override
{
if (! proxy)
if (!proxy)
return newInboundEndpoint(address);
boost::system::error_code ec;
auto const proxiedIp = boost::asio::ip::make_address(
forwardedFor.to_string(), ec);
auto const proxiedIp =
boost::asio::ip::make_address(forwardedFor.to_string(), ec);
if (ec)
{
journal_.warn() << "forwarded for ("
<< forwardedFor
<< ") from proxy "
journal_.warn()
<< "forwarded for (" << forwardedFor << ") from proxy "
<< address.to_string()
<< " doesn't convert to IP endpoint: "
<< ec.message();
<< " doesn't convert to IP endpoint: " << ec.message();
return newInboundEndpoint(address);
}
return newInboundEndpoint(
beast::IPAddressConversion::from_asio(proxiedIp));
}
Consumer newOutboundEndpoint (beast::IP::Endpoint const& address) override
Consumer
newOutboundEndpoint(beast::IP::Endpoint const& address) override
{
return logic_.newOutboundEndpoint (address);
return logic_.newOutboundEndpoint(address);
}
Consumer newUnlimitedEndpoint (beast::IP::Endpoint const& address) override
Consumer
newUnlimitedEndpoint(beast::IP::Endpoint const& address) override
{
return logic_.newUnlimitedEndpoint (address);
return logic_.newUnlimitedEndpoint(address);
}
Gossip exportConsumers () override
Gossip
exportConsumers() override
{
return logic_.exportConsumers();
}
void importConsumers (
std::string const& origin, Gossip const& gossip) override
void
importConsumers(std::string const& origin, Gossip const& gossip) override
{
logic_.importConsumers (origin, gossip);
logic_.importConsumers(origin, gossip);
}
//--------------------------------------------------------------------------
Json::Value getJson () override
Json::Value
getJson() override
{
return logic_.getJson ();
return logic_.getJson();
}
Json::Value getJson (int threshold) override
Json::Value
getJson(int threshold) override
{
return logic_.getJson (threshold);
return logic_.getJson(threshold);
}
//--------------------------------------------------------------------------
void onWrite (beast::PropertyStream::Map& map) override
void
onWrite(beast::PropertyStream::Map& map) override
{
logic_.onWrite (map);
logic_.onWrite(map);
}
//--------------------------------------------------------------------------
private:
void run ()
void
run()
{
beast::setCurrentThreadName ("Resource::Manager");
for(;;)
beast::setCurrentThreadName("Resource::Manager");
for (;;)
{
logic_.periodicActivity();
std::unique_lock<std::mutex> lock(mutex_);
@@ -153,8 +163,7 @@ private:
//------------------------------------------------------------------------------
Manager::Manager ()
: beast::PropertyStream::Source ("resource")
Manager::Manager() : beast::PropertyStream::Source("resource")
{
}
@@ -162,12 +171,13 @@ Manager::~Manager() = default;
//------------------------------------------------------------------------------
std::unique_ptr <Manager> make_Manager (
std::unique_ptr<Manager>
make_Manager(
beast::insight::Collector::ptr const& collector,
beast::Journal journal)
beast::Journal journal)
{
return std::make_unique <ManagerImp> (collector, journal);
return std::make_unique<ManagerImp>(collector, journal);
}
}
}
} // namespace Resource
} // namespace ripple