Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10111 from EOSIO/shutdown-amqp
Browse files Browse the repository at this point in the history
amqp shutdown hang
  • Loading branch information
heifner authored Mar 5, 2021
2 parents edabd8a + 284eb62 commit 634657f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libraries/amqp/include/eosio/amqp/amqp_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,18 @@ class amqp {
std::promise<void> stop_promise;
auto future = stop_promise.get_future();
boost::asio::post( *handler_->amqp_strand(), [&]() {
if( channel_ ) {
if( channel_ && channel_->usable() ) {
auto& cb = channel_->close();
cb.onFinalize( [&]() {
stop_promise.set_value();
try {
stop_promise.set_value();
} catch(...) {}
} );
cb.onError( [&](const char* message) {
elog( "Error on stop: ${m}", ("m", message) );
try {
stop_promise.set_value();
} catch(...) {}
} );
} else {
stop_promise.set_value();
Expand Down

0 comments on commit 634657f

Please sign in to comment.