1212#include < memory>
1313
1414#include < gloo/common/logging.h>
15+ #include < gloo/transport/tcp/debug_data.h>
1516#include < gloo/transport/tcp/error.h>
1617#include < gloo/transport/tcp/loop.h>
1718#include < gloo/transport/tcp/socket.h>
19+ #include " gloo/transport/tcp/debug_logger.h" // @manual=//gloo:debug_logger
1820
1921namespace gloo {
2022namespace transport {
@@ -180,9 +182,13 @@ class ConnectOperation final
180182 ConnectOperation (
181183 std::shared_ptr<Loop> loop,
182184 const Address& remote,
185+ const int rank,
186+ const int size,
183187 std::chrono::milliseconds timeout,
184188 callback_t fn)
185189 : remote_(remote),
190+ rank_ (rank),
191+ size_(size),
186192 deadline_(std::chrono::steady_clock::now() + timeout),
187193 loop_(std::move(loop)),
188194 fn_(std::move(fn)) {}
@@ -230,15 +236,18 @@ class ConnectOperation final
230236 SystemError e (" SO_ERROR" , result, remote_);
231237 bool willRetry = std::chrono::steady_clock::now () < deadline_ &&
232238 retry_++ < maxRetries_;
233- GLOO_ERROR (
234- " failed to connect, willRetry=" ,
235- willRetry,
236- " , retry=" ,
239+
240+ auto debugData = ConnectDebugData{
237241 retry_,
238- " , remote=" ,
242+ maxRetries_,
243+ willRetry,
244+ rank_,
245+ size_,
246+ e.what (),
239247 remote_.str (),
240- " , error=" ,
241- e.what ());
248+ socket_->sockName ().str (),
249+ };
250+ DebugLogger::log (debugData);
242251 // check deadline
243252 if (willRetry) {
244253 run ();
@@ -253,6 +262,8 @@ class ConnectOperation final
253262
254263 private:
255264 const Address remote_;
265+ const int rank_;
266+ const int size_;
256267 const std::chrono::time_point<std::chrono::steady_clock> deadline_;
257268 const int maxRetries_{3 };
258269
@@ -269,6 +280,8 @@ class ConnectOperation final
269280void connectLoop (
270281 std::shared_ptr<Loop> loop,
271282 const Address& remote,
283+ const int rank,
284+ const int size,
272285 std::chrono::milliseconds timeout,
273286 typename ConnectOperation::callback_t fn);
274287
0 commit comments