From 41879d85115f051242747488f6a27931cc0253d5 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Tue, 1 Oct 2013 14:02:56 -0700 Subject: [PATCH] Remove obsolete mtANNOUNCE message support --- src/ripple_app/peers/Peer.cpp | 48 --------------------------- src/ripple_data/protocol/ripple.proto | 10 ------ 2 files changed, 58 deletions(-) diff --git a/src/ripple_app/peers/Peer.cpp b/src/ripple_app/peers/Peer.cpp index dec99bec54..9cbc31bb71 100644 --- a/src/ripple_app/peers/Peer.cpp +++ b/src/ripple_app/peers/Peer.cpp @@ -352,7 +352,6 @@ private: void sendPacketForce (const PackedMessage::pointer & packet); void sendHello (); - void SendAnnounce (); void recvHello (protocol::TMHello & packet); void recvCluster (protocol::TMCluster & packet); @@ -363,7 +362,6 @@ private: void recvGetContacts (protocol::TMGetContacts & packet); void recvGetPeers (protocol::TMGetPeers & packet, Application::ScopedLockType& masterLockHolder); void recvPeers (protocol::TMPeers & packet); - void recvAnnounce (protocol::TMAnnounce & packet); void recvGetObjectByHash (const boost::shared_ptr& packet); void recvPing (protocol::TMPing & packet); void recvErrorMessage (protocol::TMErrorMsg & packet); @@ -853,17 +851,6 @@ void PeerImp::processReadBuffer () } break; - case protocol::mtANNOUNCE: - { - event->reName ("PeerImp::announce"); - protocol::TMAnnounce msg; - - if(msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size() - PackedMessage::kHeaderBytes)) - recvAnnounce (msg); - else - WriteLog (lsWARNING, Peer) << "parse error: " << type;; - } - case protocol::mtSEARCH_TRANSACTION: { event->reName ("PeerImp::searchtransaction"); @@ -1642,15 +1629,6 @@ void PeerImp::recvPeers (protocol::TMPeers& packet) } } -void PeerImp::recvAnnounce (protocol::TMAnnounce& packet) -{ - // NIKB TODO: First we need to push this announcement to peerfinder - // and then this is not a private peer, we need to "adjust" this - // announcement (i.e. the hop count) and push it out to all our - // other peers. We must be careful to avoid cycles (that is to - // never send an ANNOUNCE back to the peer we got it from). -} - void PeerImp::recvGetObjectByHash (const boost::shared_ptr& ptr) { protocol::TMGetObjectByHash& packet = *ptr; @@ -2420,32 +2398,6 @@ void PeerImp::sendHello () sendPacket (packet, true); } -void PeerImp::SendAnnounce () -{ - protocol::TMAnnounce a; - - std::string selfID = getApp().getLocalCredentials ().getNodePublic ().humanNodePublic (); - - a.set_serverid(selfID); - - // Since we are announcing ourselves, the hopcount is one and the "via" peer is us. - // If hopcount is anything else, the "via" peer must be different from the "serverid". - a.set_viapeerid(selfID); - a.set_hopcount(1); // A direct connection - - // Announce whether we're a private peer or not. Should we even send an ANNOUNCE - // for private peers? - a.set_privatepeer(getConfig ().PEER_PRIVATE); - - protocol::TMIPv4EndPoint *ep = a.add_connectpoints(); - - ep->set_ipv4(inet_addr (getNativeSocket ().local_endpoint ().address ().to_string ().c_str())); - ep->set_ipv4port(getConfig ().peerListeningPort); - - PackedMessage::pointer packet = boost::make_shared (a, protocol::mtANNOUNCE); - sendPacket (packet, true); -} - void PeerImp::sendGetPeers () { // Ask peer for known other peers. diff --git a/src/ripple_data/protocol/ripple.proto b/src/ripple_data/protocol/ripple.proto index c0392ebf0a..39df5aa5d1 100644 --- a/src/ripple_data/protocol/ripple.proto +++ b/src/ripple_data/protocol/ripple.proto @@ -14,7 +14,6 @@ enum MessageType mtCONTACT = 11; mtGET_PEERS = 12; mtPEERS = 13; - mtANNOUNCE = 14; // operations for 'small' nodes mtSEARCH_TRANSACTION = 20; @@ -232,15 +231,6 @@ message TMPeers repeated TMIPv4EndPoint nodes = 1; } -message TMAnnounce -{ - required bytes serverID = 1; // The ID of this server - required bool privatePeer = 2; // This peer is private - the announce will not be propagated - required uint32 hopCount = 3; // The hop count of this server - required bytes viaPeerID = 4; // The ID of the peer through which we know this server - repeated TMIPv4EndPoint connectPoints = 5; // Addresses on which this server accepts connections (can be empty) -}; - message TMSearchTransaction { required uint32 maxTrans = 1;