asio: Fix bug that server event loop breaks with exception

This can happen when we call throwing version of
basic_stream_socket::remote_endpoint() call while client disconnected.
This commit is contained in:
Tatsuhiro Tsujikawa 2016-03-04 22:43:36 +09:00
parent e302cc9c16
commit 2d6211c455
1 changed files with 3 additions and 1 deletions

View File

@ -79,8 +79,10 @@ public:
/// Start the first asynchronous operation for the connection.
void start() {
boost::system::error_code ec;
handler_ = std::make_shared<http2_handler>(
socket_.get_io_service(), socket_.lowest_layer().remote_endpoint(),
socket_.get_io_service(), socket_.lowest_layer().remote_endpoint(ec),
[this]() { do_write(); }, mux_);
if (handler_->start() != 0) {
stop();