Skip to content

Commit f67aba3

Browse files
committed
format2
1 parent dcc4bf3 commit f67aba3

File tree

5 files changed

+49
-46
lines changed

5 files changed

+49
-46
lines changed

src/xrpld/overlay/detail/ConnectAttempt.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ ConnectAttempt::ConnectAttempt(
5151
, stream_(*stream_ptr_)
5252
, slot_(slot)
5353
{
54-
log << "CONNECTATTEMPT start " << to_string(std::chrono::system_clock::now())
54+
log << "CONNECTATTEMPT start "
55+
<< to_string(std::chrono::system_clock::now())
5556
<< ". remote ip: " << remote_endpoint_ << ". id: " << id_;
5657
JLOG(journal_.debug()) << "connecting " << log.str();
5758
}
@@ -62,7 +63,8 @@ ConnectAttempt::~ConnectAttempt()
6263
overlay_.peerFinder().on_closed(slot_);
6364
JLOG(journal_.trace()) << "~ConnectAttempt";
6465
JLOG(journal_.debug()) << log.str() << ". end reason: "
65-
<< (close_reason.str().empty() ? "unknown" : close_reason.str());
66+
<< (close_reason.str().empty() ? "unknown"
67+
: close_reason.str());
6668
}
6769

6870
void
@@ -342,8 +344,8 @@ ConnectAttempt::processResponse()
342344
<< "Unable to upgrade to peer protocol: " << response_.result()
343345
<< " (" << response_.reason() << ")";
344346
std::stringstream ss;
345-
ss << "unable to upgrade peer protocol: " << response_.result()
346-
<< " (" << response_.reason() << ")";
347+
ss << "unable to upgrade peer protocol: " << response_.result() << " ("
348+
<< response_.reason() << ")";
347349
return close(ss.str().c_str());
348350
}
349351

@@ -407,7 +409,7 @@ ConnectAttempt::processResponse()
407409
*negotiatedProtocol,
408410
id_,
409411
overlay_);
410-
peer->log << "outbound ( " << log.str() << "). ";
412+
peer->log << "outbound ( " << log.str() << "). ";
411413

412414
overlay_.add_active(peer);
413415
}

src/xrpld/overlay/detail/PeerImp.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
#include <xrpld/overlay/detail/PeerImp.h>
3333
#include <xrpld/overlay/detail/Tuning.h>
3434
#include <xrpld/perflog/PerfLog.h>
35-
#include <xrpl/basics/chrono.h>
3635
#include <xrpl/basics/UptimeClock.h>
3736
#include <xrpl/basics/base64.h>
37+
#include <xrpl/basics/chrono.h>
3838
#include <xrpl/basics/random.h>
3939
#include <xrpl/basics/safe_cast.h>
4040
#include <xrpl/protocol/digest.h>
@@ -148,7 +148,8 @@ PeerImp::~PeerImp()
148148
JLOG(journal_.warn()) << name() << " left cluster";
149149
}
150150
JLOG(journal_.debug()) << log.str() << ". Disconnect reason: "
151-
<< (close_reason.str().empty() ? "unknown" : close_reason.str());
151+
<< (close_reason.str().empty() ? "unknown"
152+
: close_reason.str());
152153
}
153154

154155
// Helper function to check for valid uint256 values in protobuf buffers
@@ -2193,8 +2194,7 @@ PeerImp::onValidatorListMessage(
21932194
case ListDisposition::untrusted:
21942195
JLOG(p_journal_.warn())
21952196
<< "Ignored " << count << " untrusted " << messageType
2196-
<< "(s) from peer " << remote_address_ << ". "
2197-
<< ss->str();
2197+
<< "(s) from peer " << remote_address_ << ". " << ss->str();
21982198
break;
21992199
case ListDisposition::unsupported_version:
22002200
JLOG(p_journal_.warn())
@@ -3469,8 +3469,9 @@ PeerImp::reduceRelayReady()
34693469
}
34703470

34713471
void
3472-
PeerImp::initLog() {
3473-
log << "PEERLIFE start " << to_string(std::chrono::system_clock::now())
3472+
PeerImp::initLog()
3473+
{
3474+
log << "PEERLIFE start " << to_string(std::chrono::system_clock::now())
34743475
<< ". remote ip: " << remote_address_ << ". id: " << id_
34753476
<< ". public key: " << publicKey_ << ". ";
34763477
JLOG(journal_.debug()) << "connected " << log.str();

src/xrpld/overlay/detail/PeerImp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
#include <boost/endian/conversion.hpp>
4141
#include <boost/thread/shared_mutex.hpp>
4242
#include <cstdint>
43-
#include <sstream>
4443
#include <optional>
4544
#include <queue>
45+
#include <sstream>
4646

4747
namespace ripple {
4848

@@ -731,7 +731,7 @@ PeerImp::PeerImp(
731731
<< " tx reduce-relay enabled "
732732
<< txReduceRelayEnabled_ << " on " << remote_address_
733733
<< " " << id_;
734-
log << "ctor1 " ;
734+
log << "ctor1 ";
735735
initLog();
736736
}
737737

src/xrpld/peerfinder/detail/Counts.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,20 @@ class Counts
250250
}
251251

252252
std::string
253-
stats() const {
253+
stats() const
254+
{
254255
std::stringstream ss;
255256
ss << "peer stats, "
256-
<< "outbound attempts: " << m_attempts
257-
<< " active connections: " << m_active
258-
<< " inbound slots: " << m_in_max
259-
<< " active inbound slots: " << m_in_active
260-
<< " outbound slots: " << m_out_max
261-
<< " active outbound slots: " << m_out_active
262-
<< " fixed: " << m_fixed
263-
<< " active fixed: " << m_fixed_active
264-
<< " reserved: " << m_reserved
265-
<< " inbound not active or closing: " << m_acceptCount
266-
<< " closing: " << m_closingCount
267-
<< ". ";
257+
<< "outbound attempts: " << m_attempts
258+
<< " active connections: " << m_active
259+
<< " inbound slots: " << m_in_max
260+
<< " active inbound slots: " << m_in_active
261+
<< " outbound slots: " << m_out_max
262+
<< " active outbound slots: " << m_out_active
263+
<< " fixed: " << m_fixed << " active fixed: " << m_fixed_active
264+
<< " reserved: " << m_reserved
265+
<< " inbound not active or closing: " << m_acceptCount
266+
<< " closing: " << m_closingCount << ". ";
268267
return ss.str();
269268
}
270269

src/xrpld/peerfinder/detail/Logic.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,8 @@ class Logic
502502
// Count how many more outbound attempts to make
503503
//
504504
auto needed(counts_.attempts_needed());
505-
if (needed == 0) {
505+
if (needed == 0)
506+
{
506507
ss << "0 attempts needed, returning none";
507508
JLOG(m_journal.debug()) << ss.str();
508509
return none;
@@ -531,7 +532,8 @@ class Logic
531532

532533
if (!h.list().empty())
533534
{
534-
// JLOG(m_journal.debug()) << beast::leftw(18) << "Logic connect "
535+
// JLOG(m_journal.debug()) << beast::leftw(18) <<
536+
// "Logic connect "
535537
ss << "returning Logic connect " << h.list().size() << " fixed";
536538
JLOG(m_journal.debug()) << ss.str();
537539
return h.list();
@@ -542,7 +544,8 @@ class Logic
542544
JLOG(m_journal.debug())
543545
<< beast::leftw(18) << "Logic waiting on "
544546
<< counts_.attempts() << " attempts";
545-
ss << "returning none, pending outbound attempts " << counts_.attempts();
547+
ss << "returning none, pending outbound attempts "
548+
<< counts_.attempts();
546549
JLOG(m_journal.debug()) << ss.str();
547550
return none;
548551
}
@@ -551,9 +554,12 @@ class Logic
551554
// Only proceed if auto connect is enabled and we
552555
// have less than the desired number of outbound slots
553556
//
554-
if (!config_.autoConnect || counts_.out_active() >= counts_.out_max()) {
555-
ss << "returning none based on autoConnect || out_active >= out_max: "
556-
<< config_.autoConnect << ',' << counts_.out_active() << ',' << counts_.out_max();
557+
if (!config_.autoConnect || counts_.out_active() >= counts_.out_max())
558+
{
559+
ss << "returning none based on autoConnect || out_active >= "
560+
"out_max: "
561+
<< config_.autoConnect << ',' << counts_.out_active() << ','
562+
<< counts_.out_max();
557563
JLOG(m_journal.debug()) << ss.str();
558564
return none;
559565
}
@@ -568,20 +574,17 @@ class Logic
568574
&h, (&h) + 1, livecache_.hops.rbegin(), livecache_.hops.rend());
569575
if (!h.list().empty())
570576
{
571-
// JLOG(m_journal.debug())
572-
ss
573-
<< "returning Logic connect " << h.list().size()
574-
<< " live "
575-
<< ((h.list().size() > 1) ? "endpoints" : "endpoint");
577+
// JLOG(m_journal.debug())
578+
ss << "returning Logic connect " << h.list().size() << " live "
579+
<< ((h.list().size() > 1) ? "endpoints" : "endpoint");
576580
JLOG(m_journal.debug()) << ss.str();
577581
return h.list();
578582
}
579583
else if (counts_.attempts() > 0)
580584
{
581-
// JLOG(m_journal.debug())
582-
ss
583-
<< "returning none, Logic waiting on "
584-
<< counts_.attempts() << " attempts";
585+
// JLOG(m_journal.debug())
586+
ss << "returning none, Logic waiting on " << counts_.attempts()
587+
<< " attempts";
585588
JLOG(m_journal.debug()) << ss.str();
586589
return none;
587590
}
@@ -610,11 +613,9 @@ class Logic
610613

611614
if (!h.list().empty())
612615
{
613-
// JLOG(m_journal.debug())
614-
ss
615-
<< "returning Logic connect " << h.list().size()
616-
<< " boot "
617-
<< ((h.list().size() > 1) ? "addresses" : "address");
616+
// JLOG(m_journal.debug())
617+
ss << "returning Logic connect " << h.list().size() << " boot "
618+
<< ((h.list().size() > 1) ? "addresses" : "address");
618619
JLOG(m_journal.debug()) << ss.str();
619620
return h.list();
620621
}

0 commit comments

Comments
 (0)