Skip to content

Commit

Permalink
server runner will shut down forcefully
Browse files Browse the repository at this point in the history
this is needed to free network resources before the daemon exits
(see grpc::ServerInterface::Shutdown with deadline parameter)

Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
  • Loading branch information
MBoldyrev committed Aug 26, 2019
1 parent de0b162 commit 1efd68e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions irohad/main/server_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include "main/server_runner.hpp"

#include <chrono>

#include <grpc/impl/codegen/grpc_types.h>
#include <boost/format.hpp>
#include "logger/logger.hpp"
Expand All @@ -20,6 +22,10 @@ ServerRunner::ServerRunner(const std::string &address,
reuse_(reuse),
tls_keypair_(tls_keypair) {}

ServerRunner::~ServerRunner() {
shutdown(std::chrono::system_clock::now());
}

ServerRunner &ServerRunner::append(std::shared_ptr<grpc::Service> service) {
services_.push_back(service);
return *this;
Expand Down
2 changes: 2 additions & 0 deletions irohad/main/server_runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class ServerRunner {
bool reuse = true,
const boost::optional<TlsKeypair> &tls_keypair = boost::none);

~ServerRunner();

/**
* Adds a new grpc service to be run.
* @param service - service to append.
Expand Down

0 comments on commit 1efd68e

Please sign in to comment.