Merge branch 'master' into patch-1

This commit is contained in:
Simon Fels 2018-05-03 15:37:07 +02:00 committed by GitHub
commit 57bf01d408
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -24,6 +24,9 @@
namespace anbox {
namespace container {
const std::chrono::milliseconds ManagementApiStub::stop_waiting_timeout{3000};
ManagementApiStub::ManagementApiStub(
const std::shared_ptr<rpc::Channel> &channel)
: channel_(channel) {}
@ -75,7 +78,9 @@ void ManagementApiStub::stop_container() {
channel_->call_method("stop_container", &message, c->response.get(),
google::protobuf::NewCallback(this, &ManagementApiStub::container_stopped, c.get()));
c->wh.wait_for_all();
// If container manager dies before session manager, the session manager
// cannot exit if it waits for all, so just wait for 3 seconds.
c->wh.wait_for_pending(stop_waiting_timeout);
if (c->response->has_error()) throw std::runtime_error(c->response->error());
}

View file

@ -56,6 +56,7 @@ class ManagementApiStub : public DoNotCopyOrMove {
mutable std::mutex mutex_;
std::shared_ptr<rpc::Channel> channel_;
static const std::chrono::milliseconds stop_waiting_timeout;
};
} // namespace container
} // namespace anbox