File tree Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ ConnectAttempt::processResponse()
379
379
auto const result = overlay_.peerFinder ().activate (
380
380
slot_, publicKey, static_cast <bool >(member));
381
381
if (result != PeerFinder::Result::success)
382
- return fail (" Outbound slots full " );
382
+ return fail (" Outbound " + std::string ( to_string (result)) );
383
383
384
384
auto const peer = std::make_shared<PeerImp>(
385
385
app_,
Original file line number Diff line number Diff line change 26
26
#include < xrpld/overlay/Cluster.h>
27
27
#include < xrpld/overlay/detail/ConnectAttempt.h>
28
28
#include < xrpld/overlay/detail/PeerImp.h>
29
+ #include < xrpld/overlay/detail/TrafficCount.h>
29
30
#include < xrpld/overlay/detail/Tuning.h>
30
31
#include < xrpld/overlay/predicates.h>
31
32
#include < xrpld/peerfinder/make_Manager.h>
41
42
42
43
#include < boost/algorithm/string/predicate.hpp>
43
44
44
- #include " xrpld/overlay/detail/TrafficCount.h"
45
-
46
45
namespace ripple {
47
46
48
47
namespace CrawlOptions {
@@ -269,8 +268,8 @@ OverlayImpl::onHandoff(
269
268
if (result != PeerFinder::Result::success)
270
269
{
271
270
m_peerFinder->on_closed (slot);
272
- JLOG (journal.debug ())
273
- << " Peer " << remote_endpoint << " redirected, slots full " ;
271
+ JLOG (journal.debug ()) << " Peer " << remote_endpoint
272
+ << " redirected, " << to_string (result) ;
274
273
handoff.moved = false ;
275
274
handoff.response = makeRedirectResponse (
276
275
slot, request, remote_endpoint.address ());
Original file line number Diff line number Diff line change 28
28
29
29
#include < boost/asio/ip/tcp.hpp>
30
30
31
+ #include < string_view>
32
+
31
33
namespace ripple {
32
34
namespace PeerFinder {
33
35
@@ -136,6 +138,36 @@ using Endpoints = std::vector<Endpoint>;
136
138
/* * Possible results from activating a slot. */
137
139
enum class Result { duplicate, full, success };
138
140
141
+ /* *
142
+ * @brief Converts a `Result` enum value to its string representation.
143
+ *
144
+ * This function provides a human-readable string for a given `Result` enum,
145
+ * which is useful for logging, debugging, or displaying status messages.
146
+ *
147
+ * @param result The `Result` enum value to convert.
148
+ * @return A `std::string_view` representing the enum value. Returns "unknown"
149
+ * if the enum value is not explicitly handled.
150
+ *
151
+ * @note This function returns a `std::string_view` for performance.
152
+ * A `std::string` would need to allocate memory on the heap and copy the
153
+ * string literal into it every time the function is called.
154
+ */
155
+ inline std::string_view
156
+ to_string (Result result) noexcept
157
+ {
158
+ switch (result)
159
+ {
160
+ case Result::success:
161
+ return " success" ;
162
+ case Result::duplicate:
163
+ return " duplicate connection" ;
164
+ case Result::full:
165
+ return " slots full" ;
166
+ }
167
+
168
+ return " unknown" ;
169
+ }
170
+
139
171
/* * Maintains a set of IP addresses used for getting into the network. */
140
172
class Manager : public beast ::PropertyStream::Source
141
173
{
You can’t perform that action at this time.
0 commit comments