Skip to content

Commit

Permalink
Handle errors on remote_endpoint()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed Sep 8, 2016
1 parent 85ba065 commit e27ffde
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/served/net/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ connection::connection( boost::asio::io_service & io_service
void
connection::start()
{
_request.set_source(_socket.remote_endpoint().address().to_string());
boost::system::error_code ec;
boost::asio::ip::tcp::endpoint endpoint = _socket.remote_endpoint(ec);
if (ec)
{
_connection_manager.stop(shared_from_this());
return;
}

_request.set_source(endpoint.address().to_string());
do_read();

if ( _read_timeout > 0 )
Expand Down

0 comments on commit e27ffde

Please sign in to comment.