-
Notifications
You must be signed in to change notification settings - Fork 5.3k
conn_pool: Remove startDrain() and replace it with an argument to drainConnections #17960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8844951
f618ce6
f580f4e
485688c
2f2a280
179cdd4
8d5f90e
ea6bf0f
4307372
606f3cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,6 +229,7 @@ void ConnPoolImplBase::onStreamClosed(Envoy::ConnectionPool::ActiveClient& clien | |
| } | ||
|
|
||
| ConnectionPool::Cancellable* ConnPoolImplBase::newStreamImpl(AttachContext& context) { | ||
| ASSERT(!is_draining_for_deletion_); | ||
| ASSERT(!deferred_deleting_); | ||
|
|
||
| ASSERT(static_cast<ssize_t>(connecting_stream_capacity_) == | ||
|
|
@@ -331,11 +332,6 @@ void ConnPoolImplBase::transitionActiveClientState(ActiveClient& client, | |
|
|
||
| void ConnPoolImplBase::addIdleCallbackImpl(Instance::IdleCb cb) { idle_callbacks_.push_back(cb); } | ||
|
|
||
| void ConnPoolImplBase::startDrainImpl() { | ||
| is_draining_ = true; | ||
| checkForIdleAndCloseIdleConnsIfDraining(); | ||
| } | ||
|
|
||
| void ConnPoolImplBase::closeIdleConnectionsForDrainingPool() { | ||
| // Create a separate list of elements to close to avoid mutate-while-iterating problems. | ||
| std::list<ActiveClient*> to_close; | ||
|
|
@@ -359,7 +355,12 @@ void ConnPoolImplBase::closeIdleConnectionsForDrainingPool() { | |
| } | ||
| } | ||
|
|
||
| void ConnPoolImplBase::drainConnectionsImpl() { | ||
| void ConnPoolImplBase::drainConnectionsImpl(DrainBehavior drain_behavior) { | ||
| if (drain_behavior == Envoy::ConnectionPool::DrainBehavior::DrainAndDelete) { | ||
| is_draining_for_deletion_ = true; | ||
| checkForIdleAndCloseIdleConnsIfDraining(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function behaves differently depending on the value of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh shoot! Thanks. I think I screwed that up during a cleanup. Fixed. |
||
| return; | ||
| } | ||
| closeIdleConnectionsForDrainingPool(); | ||
|
|
||
| // closeIdleConnections() closes all connections in ready_clients_ with no active streams, | ||
|
|
@@ -387,12 +388,13 @@ bool ConnPoolImplBase::isIdleImpl() const { | |
| } | ||
|
|
||
| void ConnPoolImplBase::checkForIdleAndCloseIdleConnsIfDraining() { | ||
| if (is_draining_) { | ||
| if (is_draining_for_deletion_) { | ||
| closeIdleConnectionsForDrainingPool(); | ||
| } | ||
|
|
||
| if (isIdleImpl()) { | ||
| ENVOY_LOG(debug, "invoking idle callbacks - is_draining_={}", is_draining_); | ||
| ENVOY_LOG(debug, "invoking idle callbacks - is_draining_for_deletion_={}", | ||
| is_draining_for_deletion_); | ||
| for (const Instance::IdleCb& cb : idle_callbacks_) { | ||
| cb(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add that it is invalid to create new requests/streams/connections on this pool after this call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done.