@@ -74,7 +74,7 @@ ConnectAttempt::stop()
7474 {
7575 JLOG (journal_.debug ()) << " Stop" ;
7676 }
77- ++app_.getPerfLog ().getPeerCounters ().connection .connectCloseStop ;
77+ ++app_.getPerfLog ().getPeerCounters ().connection .outboundConnectCloseStop ;
7878 close ();
7979}
8080
@@ -153,10 +153,10 @@ ConnectAttempt::onTimer(error_code ec)
153153 {
154154 // This should never happen
155155 JLOG (journal_.error ()) << " onTimer: " << ec.message ();
156- ++app_.getPerfLog ().getPeerCounters ().connection .connectCloseOnTimer ;
156+ ++app_.getPerfLog ().getPeerCounters ().connection .outboundConnectCloseOnTimer ;
157157 return close ();
158158 }
159- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailTimeouts ;
159+ ++app_.getPerfLog ().getPeerCounters ().connection .outboundConnectFailTimeouts ;
160160 fail (" Timeout" );
161161}
162162
@@ -170,8 +170,11 @@ ConnectAttempt::onConnect(error_code ec)
170170 endpoint_type local_endpoint;
171171 if (!ec)
172172 local_endpoint = socket_.local_endpoint (ec);
173- if (ec) {
174- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailOnConnectError ;
173+ if (ec)
174+ {
175+ ++app_.getPerfLog ()
176+ .getPeerCounters ()
177+ .connection .outboundConnectFailOnConnectError ;
175178 return fail (" onConnect" , ec);
176179 }
177180 if (!socket_.is_open ())
@@ -199,21 +202,30 @@ ConnectAttempt::onHandshake(error_code ec)
199202 endpoint_type local_endpoint;
200203 if (!ec)
201204 local_endpoint = socket_.local_endpoint (ec);
202- if (ec) {
203- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailOnHandshakeError ;
205+ if (ec)
206+ {
207+ ++app_.getPerfLog ()
208+ .getPeerCounters ()
209+ .connection .outboundConnectFailOnHandshakeError ;
204210 return fail (" onHandshake" , ec);
205211 }
206212 JLOG (journal_.trace ()) << " onHandshake" ;
207213
208214 if (!overlay_.peerFinder ().onConnected (
209- slot_, beast::IPAddressConversion::from_asio (local_endpoint))) {
210- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailOnHandshakeDuplicate ;
215+ slot_, beast::IPAddressConversion::from_asio (local_endpoint)))
216+ {
217+ ++app_.getPerfLog ()
218+ .getPeerCounters ()
219+ .connection .outboundConnectFailOnHandshakeDuplicate ;
211220 return fail (" Duplicate connection" );
212221 }
213222
214223 auto const sharedValue = makeSharedValue (*stream_ptr_, journal_);
215- if (!sharedValue) {
216- ++app_.getPerfLog ().getPeerCounters ().connection .connectCloseOnHandshake ;
224+ if (!sharedValue)
225+ {
226+ ++app_.getPerfLog ()
227+ .getPeerCounters ()
228+ .connection .outboundConnectCloseOnHandshake ;
217229 return close (); // makeSharedValue logs
218230 }
219231
@@ -250,8 +262,11 @@ ConnectAttempt::onWrite(error_code ec)
250262 return ;
251263 if (ec == boost::asio::error::operation_aborted)
252264 return ;
253- if (ec) {
254- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailOnWriteError ;
265+ if (ec)
266+ {
267+ ++app_.getPerfLog ()
268+ .getPeerCounters ()
269+ .connection .outboundConnectFailOnWriteError ;
255270 return fail (" onWrite" , ec);
256271 }
257272 boost::beast::http::async_read (
@@ -282,8 +297,9 @@ ConnectAttempt::onRead(error_code ec)
282297 shared_from_this (),
283298 std::placeholders::_1)));
284299 }
285- if (ec) {
286- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailOnReadError ;
300+ if (ec)
301+ {
302+ ++app_.getPerfLog ().getPeerCounters ().connection .outboundConnectFailOnReadError ;
287303 return fail (" onRead" , ec);
288304 }
289305 processResponse ();
@@ -296,14 +312,19 @@ ConnectAttempt::onShutdown(error_code ec)
296312 if (!ec)
297313 {
298314 JLOG (journal_.error ()) << " onShutdown: expected error condition" ;
299- ++app_.getPerfLog ().getPeerCounters ().connection .connectCloseOnShutdownNoError ;
315+ ++app_.getPerfLog ()
316+ .getPeerCounters ()
317+ .connection .outboundConnectCloseOnShutdownNoError ;
300318 return close ();
301319 }
302- if (ec != boost::asio::error::eof) {
303- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailOnShutdownError ;
320+ if (ec != boost::asio::error::eof)
321+ {
322+ ++app_.getPerfLog ()
323+ .getPeerCounters ()
324+ .connection .outboundConnectFailOnShutdownError ;
304325 return fail (" onShutdown" , ec);
305326 }
306- ++app_.getPerfLog ().getPeerCounters ().connection .connectCloseOnShutdown ;
327+ ++app_.getPerfLog ().getPeerCounters ().connection .outboundConnectCloseOnShutdown ;
307328 close ();
308329}
309330
@@ -353,7 +374,7 @@ ConnectAttempt::processResponse()
353374 JLOG (journal_.info ())
354375 << " Unable to upgrade to peer protocol: " << response_.result ()
355376 << " (" << response_.reason () << " )" ;
356- ++app_.getPerfLog ().getPeerCounters ().connection .connectCloseUpgrade ;
377+ ++app_.getPerfLog ().getPeerCounters ().connection .outboundConnectCloseUpgrade ;
357378 return close ();
358379 }
359380
@@ -367,16 +388,20 @@ ConnectAttempt::processResponse()
367388 if (pvs.size () == 1 && isProtocolSupported (pvs[0 ]))
368389 negotiatedProtocol = pvs[0 ];
369390
370- if (!negotiatedProtocol) {
371- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailProtocol ;
391+ if (!negotiatedProtocol)
392+ {
393+ ++app_.getPerfLog ()
394+ .getPeerCounters ()
395+ .connection .outboundConnectFailProtocol ;
372396 return fail (
373397 " processResponse: Unable to negotiate protocol version" );
374398 }
375399 }
376400
377401 auto const sharedValue = makeSharedValue (*stream_ptr_, journal_);
378- if (!sharedValue) {
379- ++app_.getPerfLog ().getPeerCounters ().connection .connectCloseShared ;
402+ if (!sharedValue)
403+ {
404+ ++app_.getPerfLog ().getPeerCounters ().connection .outboundConnectCloseShared ;
380405 return close (); // makeSharedValue logs
381406 }
382407
@@ -404,8 +429,11 @@ ConnectAttempt::processResponse()
404429
405430 auto const result = overlay_.peerFinder ().activate (
406431 slot_, publicKey, static_cast <bool >(member));
407- if (result != PeerFinder::Result::success) {
408- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailSlotsFull ;
432+ if (result != PeerFinder::Result::success)
433+ {
434+ ++app_.getPerfLog ()
435+ .getPeerCounters ()
436+ .connection .outboundConnectFailSlotsFull ;
409437 return fail (" Outbound slots full" );
410438 }
411439
@@ -425,7 +453,9 @@ ConnectAttempt::processResponse()
425453 }
426454 catch (std::exception const & e)
427455 {
428- ++app_.getPerfLog ().getPeerCounters ().connection .connectFailOnHandshakeFailure ;
456+ ++app_.getPerfLog ()
457+ .getPeerCounters ()
458+ .connection .outboundConnectFailOnHandshakeFailure ;
429459 return fail (std::string (" Handshake failure (" ) + e.what () + " )" );
430460 }
431461}
0 commit comments