Fixes to Overlay:

* Make ~Peer virtual
* Call close in ConnectAttempt::stop
* Handle nullptr return in new_outbound_slot
* Check gracefulClose_ in read loop
This commit is contained in:
Vinnie Falco
2015-01-20 14:34:52 -08:00
parent a470dda4e6
commit 40e138627b
5 changed files with 23 additions and 14 deletions

View File

@@ -362,10 +362,18 @@ OverlayImpl::connect (beast::IP::Endpoint const& remote_endpoint)
"Over resource limit: " << remote_endpoint;
return;
}
auto const slot = peerFinder().new_outbound_slot(remote_endpoint);
if (slot == nullptr)
{
if (journal_.debug) journal_.debug <<
"Connect: No slot for " << remote_endpoint;
return;
}
auto const p = std::make_shared<ConnectAttempt>(
io_service_, beast::IPAddressConversion::to_asio_endpoint(remote_endpoint),
usage, setup_.context, next_id_++,
usage, setup_.context, next_id_++, slot,
deprecatedLogs().journal("Peer"), *this);
std::lock_guard<decltype(mutex_)> lock(mutex_);