This is an automated email from the ASF dual-hosted git repository.
xyz pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.8 by this push:
new 367fdeb7d85 [C++] Connect timer cancellation does not call timeout
callback (#11486)
367fdeb7d85 is described below
commit 367fdeb7d8599f2c7c85b33bc0e5868c7b106b8d
Author: Jack Vanlightly <[email protected]>
AuthorDate: Fri Jul 30 02:29:15 2021 +0200
[C++] Connect timer cancellation does not call timeout callback (#11486)
Master issue: #11485
When the PeriodicTask timer is cancelled it calls the handler
which in turn ends up invoking the callback which closes
the socket. This prevents the iteration over multiple endpoints
until the connection succeeds. This change checks the error_code
in the handler and returns if it is operation_cancelled,
avoiding erroneously calling the callback.
Co-authored-by: Jack Vanlightly <[email protected]>
(cherry picked from commit 8070a821fd0fc774de9ca41ebcff715841d60458)
---
pulsar-client-cpp/lib/PeriodicTask.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pulsar-client-cpp/lib/PeriodicTask.cc
b/pulsar-client-cpp/lib/PeriodicTask.cc
index f25a175e4d0..533d38b5efa 100644
--- a/pulsar-client-cpp/lib/PeriodicTask.cc
+++ b/pulsar-client-cpp/lib/PeriodicTask.cc
@@ -43,7 +43,7 @@ void PeriodicTask::stop() {
}
void PeriodicTask::handleTimeout(const ErrorCode& ec) {
- if (state_ != Ready) {
+ if (state_ != Ready || ec.value() ==
boost::system::errc::operation_canceled) {
return;
}