Use cluster state in Slot instead of PeerImp

This commit is contained in:
Vinnie Falco
2014-11-24 07:11:09 -08:00
committed by Nik Bougalis
parent cd8ec89cbb
commit fb0d44d403
5 changed files with 41 additions and 51 deletions

View File

@@ -241,15 +241,18 @@ OverlayImpl::onHandoff (std::unique_ptr <beast::asio::ssl_bundle>&& ssl_bundle,
handoff.moved = true;
bool success = true;
protocol::TMHello hello;
std::tie(hello, success) = parseHello (request, journal_);
if(! success)
return handoff;
uint256 sharedValue;
std::tie(sharedValue, success) = makeSharedValue(
ssl_bundle->stream.native_handle(), journal_);
if(! success)
return handoff;
RippleAddress publicKey;
std::tie(publicKey, success) = verifyHello (hello,
sharedValue, journal_, getApp());
@@ -257,11 +260,11 @@ OverlayImpl::onHandoff (std::unique_ptr <beast::asio::ssl_bundle>&& ssl_bundle,
return handoff;
std::string name;
bool clusterNode = getApp().getUNL().nodeInCluster(
bool const cluster = getApp().getUNL().nodeInCluster(
publicKey, name);
auto const result = m_peerFinder->activate (slot,
RipplePublicKey(publicKey), clusterNode);
RipplePublicKey(publicKey), cluster);
if (result != PeerFinder::Result::success)
{
if (journal_.trace) journal_.trace <<
@@ -352,7 +355,7 @@ OverlayImpl::connect (beast::IP::Endpoint const& remote_endpoint)
}
}
//--------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
OverlayImpl::remove (PeerFinder::Slot::ptr const& slot)
@@ -363,11 +366,11 @@ OverlayImpl::remove (PeerFinder::Slot::ptr const& slot)
m_peers.erase (iter);
}
//--------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// Stoppable
//
//--------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Caller must hold the mutex
void
@@ -464,18 +467,18 @@ OverlayImpl::onChildrenStopped ()
checkStopped ();
}
//--------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// PropertyStream
//
//--------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
OverlayImpl::onWrite (beast::PropertyStream::Map& stream)
{
}
//--------------------------------------------------------------------------
//------------------------------------------------------------------------------
/** A peer has connected successfully
This is called after the peer handshake has been completed and during
peer activation. At this point, the peer address and the public key