BewareMyPower commented on code in PR #539:
URL: https://github.com/apache/pulsar-client-cpp/pull/539#discussion_r2871272118
##########
lib/ClientConnection.cc:
##########
@@ -603,15 +603,29 @@ void ClientConnection::handleResolve(ASIO_ERROR err,
const tcp::resolver::result
return;
}
+ tcp::endpoint endpointToLog;
+ if (!results.empty()) {
+ endpointToLog = *results.begin();
+ LOG_DEBUG(cnxString_ << "Resolved " << results.size() << " endpoints");
+ for (const auto& endpoint : results) {
+ LOG_DEBUG(cnxString_ << " " <<
endpoint.endpoint().address().to_string() << ":" << endpoint.endpoint().port());
+ }
+ }
+
auto weakSelf = weak_from_this();
- connectTimeoutTask_->setCallback([weakSelf](const PeriodicTask::ErrorCode&
ec) {
+ connectTimeoutTask_->setCallback([weakSelf, endpointToLog](const
PeriodicTask::ErrorCode& ec) {
Review Comment:
Instead of capturing the 1st endpoint in the DNS results, it would be better
to pass all endpoints and log them for failures.
```c++
static std::ostream& operator<<(std::ostream& os, const
tcp::resolver::results_type& results) {
for (const auto& entry : results) {
os << entry.endpoint() << " ";
}
return os;
}
```
```c++
connectTimeoutTask_->setCallback([weakSelf, results](const
PeriodicTask::ErrorCode& ec) {
/* ... */
if (ptr->state_ != Ready) {
LOG_ERROR(ptr->cnxString_ << "Connection to " << results << "
was not established in "
<<
ptr->connectTimeoutTask_->getPeriodMs() << " ms, close the socket");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]