Skip to content

Commit ac2b7c5

Browse files
authored
CPP-708 - Fix timer leak in WaitForHandler (#208)
The retry timer could leak when a timed out request scheduled another attempt after the whole handler had timed out.
1 parent 7a7eeac commit ac2b7c5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

cpp-driver/src/wait_for_handler.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ void WaitForHandler::start(Connection* connection) {
9999
}
100100

101101
void WaitForHandler::schedule() {
102-
retry_timer_.start(connection_->loop(), retry_wait_time_ms_,
103-
bind_callback(&WaitForHandler::on_retry_timeout, this));
102+
if (!is_finished_) { // Don't schedule a retry if the handler is finished.
103+
retry_timer_.start(connection_->loop(), retry_wait_time_ms_,
104+
bind_callback(&WaitForHandler::on_retry_timeout, this));
105+
}
104106
}
105107

106108
void WaitForHandler::finish() {

0 commit comments

Comments
 (0)