12
12
#include < memory>
13
13
14
14
#include < gloo/common/logging.h>
15
+ #include < gloo/transport/tcp/debug_data.h>
15
16
#include < gloo/transport/tcp/error.h>
16
17
#include < gloo/transport/tcp/loop.h>
17
18
#include < gloo/transport/tcp/socket.h>
19
+ #include " gloo/transport/tcp/debug_logger.h" // @manual=//gloo:debug_logger
18
20
19
21
namespace gloo {
20
22
namespace transport {
@@ -180,9 +182,13 @@ class ConnectOperation final
180
182
ConnectOperation (
181
183
std::shared_ptr<Loop> loop,
182
184
const Address& remote,
185
+ const int rank,
186
+ const int size,
183
187
std::chrono::milliseconds timeout,
184
188
callback_t fn)
185
189
: remote_(remote),
190
+ rank_ (rank),
191
+ size_(size),
186
192
deadline_(std::chrono::steady_clock::now() + timeout),
187
193
loop_(std::move(loop)),
188
194
fn_(std::move(fn)) {}
@@ -230,15 +236,18 @@ class ConnectOperation final
230
236
SystemError e (" SO_ERROR" , result, remote_);
231
237
bool willRetry = std::chrono::steady_clock::now () < deadline_ &&
232
238
retry_++ < maxRetries_;
233
- GLOO_ERROR (
234
- " failed to connect, willRetry=" ,
235
- willRetry,
236
- " , retry=" ,
239
+
240
+ auto debugData = ConnectDebugData{
237
241
retry_,
238
- " , remote=" ,
242
+ maxRetries_,
243
+ willRetry,
244
+ rank_,
245
+ size_,
246
+ e.what (),
239
247
remote_.str (),
240
- " , error=" ,
241
- e.what ());
248
+ socket_->sockName ().str (),
249
+ };
250
+ DebugLogger::log (debugData);
242
251
// check deadline
243
252
if (willRetry) {
244
253
run ();
@@ -253,6 +262,8 @@ class ConnectOperation final
253
262
254
263
private:
255
264
const Address remote_;
265
+ const int rank_;
266
+ const int size_;
256
267
const std::chrono::time_point<std::chrono::steady_clock> deadline_;
257
268
const int maxRetries_{3 };
258
269
@@ -269,6 +280,8 @@ class ConnectOperation final
269
280
void connectLoop (
270
281
std::shared_ptr<Loop> loop,
271
282
const Address& remote,
283
+ const int rank,
284
+ const int size,
272
285
std::chrono::milliseconds timeout,
273
286
typename ConnectOperation::callback_t fn);
274
287
0 commit comments