diff --git a/Application_8cpp_source.html b/Application_8cpp_source.html index 33d0b4e784..518b3ae943 100644 --- a/Application_8cpp_source.html +++ b/Application_8cpp_source.html @@ -2583,9 +2583,9 @@ $(function() {
ripple::create_genesis
create_genesis_t const create_genesis
Definition: Ledger.cpp:51
ripple::fixConfigPorts
static void fixConfigPorts(Config &config, Endpoints const &endpoints)
Definition: Application.cpp:2199
ripple::make_AmendmentTable
std::unique_ptr< AmendmentTable > make_AmendmentTable(Application &app, std::chrono::seconds majorityTime, std::vector< AmendmentTable::FeatureInfo > const &supported, Section const &enabled, Section const &vetoed, beast::Journal journal)
Definition: AmendmentTable.cpp:1072
-
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1467
+
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1470
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:50
-
ripple::make_Overlay
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
Definition: OverlayImpl.cpp:1572
+
ripple::make_Overlay
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
Definition: OverlayImpl.cpp:1575
ripple::make_SHAMapStore
std::unique_ptr< SHAMapStore > make_SHAMapStore(Application &app, NodeStore::Scheduler &scheduler, beast::Journal journal)
Definition: SHAMapStoreImp.cpp:683
std::chrono
std
STL namespace.
diff --git a/OverlayImpl_8cpp_source.html b/OverlayImpl_8cpp_source.html index 85296642e1..ca374beb59 100644 --- a/OverlayImpl_8cpp_source.html +++ b/OverlayImpl_8cpp_source.html @@ -581,1085 +581,1088 @@ $(function() {
503
504 // Pool of servers operated by @Xrpkuwait - https://xrpkuwait.com
505 bootstrapIps.push_back("hubs.xrpkuwait.com 51235");
-
506 }
-
507
-
508 m_resolver.resolve(
-
509 bootstrapIps,
-
510 [this](
-
511 std::string const& name,
-
512 std::vector<beast::IP::Endpoint> const& addresses) {
-
513 std::vector<std::string> ips;
-
514 ips.reserve(addresses.size());
-
515 for (auto const& addr : addresses)
-
516 {
-
517 if (addr.port() == 0)
-
518 ips.push_back(to_string(addr.at_port(DEFAULT_PEER_PORT)));
-
519 else
-
520 ips.push_back(to_string(addr));
-
521 }
-
522
-
523 std::string const base("config: ");
-
524 if (!ips.empty())
-
525 m_peerFinder->addFallbackStrings(base + name, ips);
-
526 });
-
527
-
528 // Add the ips_fixed from the rippled.cfg file
-
529 if (!app_.config().standalone() && !app_.config().IPS_FIXED.empty())
-
530 {
-
531 m_resolver.resolve(
-
532 app_.config().IPS_FIXED,
-
533 [this](
-
534 std::string const& name,
-
535 std::vector<beast::IP::Endpoint> const& addresses) {
-
536 std::vector<beast::IP::Endpoint> ips;
-
537 ips.reserve(addresses.size());
-
538
-
539 for (auto& addr : addresses)
-
540 {
-
541 if (addr.port() == 0)
-
542 ips.emplace_back(addr.address(), DEFAULT_PEER_PORT);
-
543 else
-
544 ips.emplace_back(addr);
-
545 }
-
546
-
547 if (!ips.empty())
-
548 m_peerFinder->addFixedPeer(name, ips);
-
549 });
-
550 }
-
551 auto const timer = std::make_shared<Timer>(*this);
-
552 std::lock_guard lock(mutex_);
-
553 list_.emplace(timer.get(), timer);
-
554 timer_ = timer;
-
555 timer->async_wait();
-
556}
-
557
-
558void
-
559OverlayImpl::stop()
-
560{
-
561 strand_.dispatch(std::bind(&OverlayImpl::stopChildren, this));
-
562 {
-
563 std::unique_lock<decltype(mutex_)> lock(mutex_);
-
564 cond_.wait(lock, [this] { return list_.empty(); });
-
565 }
-
566 m_peerFinder->stop();
-
567}
-
568
-
569//------------------------------------------------------------------------------
-
570//
-
571// PropertyStream
-
572//
-
573//------------------------------------------------------------------------------
-
574
-
575void
-
576OverlayImpl::onWrite(beast::PropertyStream::Map& stream)
-
577{
-
578 beast::PropertyStream::Set set("traffic", stream);
-
579 auto const stats = m_traffic.getCounts();
-
580 for (auto const& i : stats)
-
581 {
-
582 if (i)
-
583 {
-
584 beast::PropertyStream::Map item(set);
-
585 item["category"] = i.name;
-
586 item["bytes_in"] = std::to_string(i.bytesIn.load());
-
587 item["messages_in"] = std::to_string(i.messagesIn.load());
-
588 item["bytes_out"] = std::to_string(i.bytesOut.load());
-
589 item["messages_out"] = std::to_string(i.messagesOut.load());
-
590 }
-
591 }
-
592}
-
593
-
594//------------------------------------------------------------------------------
-
600void
-
601OverlayImpl::activate(std::shared_ptr<PeerImp> const& peer)
-
602{
-
603 // Now track this peer
-
604 {
-
605 std::lock_guard lock(mutex_);
-
606 auto const result(ids_.emplace(
-
607 std::piecewise_construct,
-
608 std::make_tuple(peer->id()),
-
609 std::make_tuple(peer)));
-
610 XRPL_ASSERT(
-
611 result.second,
-
612 "ripple::OverlayImpl::activate : peer ID is inserted");
-
613 (void)result.second;
-
614 }
-
615
-
616 JLOG(journal_.debug()) << "activated " << peer->getRemoteAddress() << " ("
-
617 << peer->id() << ":"
-
618 << toBase58(
-
619 TokenType::NodePublic, peer->getNodePublic())
-
620 << ")";
-
621
-
622 // We just accepted this peer so we have non-zero active peers
-
623 XRPL_ASSERT(size(), "ripple::OverlayImpl::activate : nonzero peers");
-
624}
-
625
-
626void
-
627OverlayImpl::onPeerDeactivate(Peer::id_t id)
-
628{
-
629 std::lock_guard lock(mutex_);
-
630 ids_.erase(id);
-
631}
-
632
-
633void
-
634OverlayImpl::onManifests(
-
635 std::shared_ptr<protocol::TMManifests> const& m,
-
636 std::shared_ptr<PeerImp> const& from)
-
637{
-
638 auto const n = m->list_size();
-
639 auto const& journal = from->pjournal();
-
640
-
641 protocol::TMManifests relay;
-
642
-
643 for (std::size_t i = 0; i < n; ++i)
-
644 {
-
645 auto& s = m->list().Get(i).stobject();
-
646
-
647 if (auto mo = deserializeManifest(s))
-
648 {
-
649 auto const serialized = mo->serialized;
-
650
-
651 auto const result =
-
652 app_.validatorManifests().applyManifest(std::move(*mo));
+
506
+
507 // Pool of servers operated by XRPL Commons - https://xrpl-commons.org
+
508 bootstrapIps.push_back("hub.xrpl-commons.org 51235");
+
509 }
+
510
+
511 m_resolver.resolve(
+
512 bootstrapIps,
+
513 [this](
+
514 std::string const& name,
+
515 std::vector<beast::IP::Endpoint> const& addresses) {
+
516 std::vector<std::string> ips;
+
517 ips.reserve(addresses.size());
+
518 for (auto const& addr : addresses)
+
519 {
+
520 if (addr.port() == 0)
+
521 ips.push_back(to_string(addr.at_port(DEFAULT_PEER_PORT)));
+
522 else
+
523 ips.push_back(to_string(addr));
+
524 }
+
525
+
526 std::string const base("config: ");
+
527 if (!ips.empty())
+
528 m_peerFinder->addFallbackStrings(base + name, ips);
+
529 });
+
530
+
531 // Add the ips_fixed from the rippled.cfg file
+
532 if (!app_.config().standalone() && !app_.config().IPS_FIXED.empty())
+
533 {
+
534 m_resolver.resolve(
+
535 app_.config().IPS_FIXED,
+
536 [this](
+
537 std::string const& name,
+
538 std::vector<beast::IP::Endpoint> const& addresses) {
+
539 std::vector<beast::IP::Endpoint> ips;
+
540 ips.reserve(addresses.size());
+
541
+
542 for (auto& addr : addresses)
+
543 {
+
544 if (addr.port() == 0)
+
545 ips.emplace_back(addr.address(), DEFAULT_PEER_PORT);
+
546 else
+
547 ips.emplace_back(addr);
+
548 }
+
549
+
550 if (!ips.empty())
+
551 m_peerFinder->addFixedPeer(name, ips);
+
552 });
+
553 }
+
554 auto const timer = std::make_shared<Timer>(*this);
+
555 std::lock_guard lock(mutex_);
+
556 list_.emplace(timer.get(), timer);
+
557 timer_ = timer;
+
558 timer->async_wait();
+
559}
+
560
+
561void
+
562OverlayImpl::stop()
+
563{
+
564 strand_.dispatch(std::bind(&OverlayImpl::stopChildren, this));
+
565 {
+
566 std::unique_lock<decltype(mutex_)> lock(mutex_);
+
567 cond_.wait(lock, [this] { return list_.empty(); });
+
568 }
+
569 m_peerFinder->stop();
+
570}
+
571
+
572//------------------------------------------------------------------------------
+
573//
+
574// PropertyStream
+
575//
+
576//------------------------------------------------------------------------------
+
577
+
578void
+
579OverlayImpl::onWrite(beast::PropertyStream::Map& stream)
+
580{
+
581 beast::PropertyStream::Set set("traffic", stream);
+
582 auto const stats = m_traffic.getCounts();
+
583 for (auto const& i : stats)
+
584 {
+
585 if (i)
+
586 {
+
587 beast::PropertyStream::Map item(set);
+
588 item["category"] = i.name;
+
589 item["bytes_in"] = std::to_string(i.bytesIn.load());
+
590 item["messages_in"] = std::to_string(i.messagesIn.load());
+
591 item["bytes_out"] = std::to_string(i.bytesOut.load());
+
592 item["messages_out"] = std::to_string(i.messagesOut.load());
+
593 }
+
594 }
+
595}
+
596
+
597//------------------------------------------------------------------------------
+
603void
+
604OverlayImpl::activate(std::shared_ptr<PeerImp> const& peer)
+
605{
+
606 // Now track this peer
+
607 {
+
608 std::lock_guard lock(mutex_);
+
609 auto const result(ids_.emplace(
+
610 std::piecewise_construct,
+
611 std::make_tuple(peer->id()),
+
612 std::make_tuple(peer)));
+
613 XRPL_ASSERT(
+
614 result.second,
+
615 "ripple::OverlayImpl::activate : peer ID is inserted");
+
616 (void)result.second;
+
617 }
+
618
+
619 JLOG(journal_.debug()) << "activated " << peer->getRemoteAddress() << " ("
+
620 << peer->id() << ":"
+
621 << toBase58(
+
622 TokenType::NodePublic, peer->getNodePublic())
+
623 << ")";
+
624
+
625 // We just accepted this peer so we have non-zero active peers
+
626 XRPL_ASSERT(size(), "ripple::OverlayImpl::activate : nonzero peers");
+
627}
+
628
+
629void
+
630OverlayImpl::onPeerDeactivate(Peer::id_t id)
+
631{
+
632 std::lock_guard lock(mutex_);
+
633 ids_.erase(id);
+
634}
+
635
+
636void
+
637OverlayImpl::onManifests(
+
638 std::shared_ptr<protocol::TMManifests> const& m,
+
639 std::shared_ptr<PeerImp> const& from)
+
640{
+
641 auto const n = m->list_size();
+
642 auto const& journal = from->pjournal();
+
643
+
644 protocol::TMManifests relay;
+
645
+
646 for (std::size_t i = 0; i < n; ++i)
+
647 {
+
648 auto& s = m->list().Get(i).stobject();
+
649
+
650 if (auto mo = deserializeManifest(s))
+
651 {
+
652 auto const serialized = mo->serialized;
653
-
654 if (result == ManifestDisposition::accepted)
-
655 {
-
656 relay.add_list()->set_stobject(s);
-
657
-
658 // N.B.: this is important; the applyManifest call above moves
-
659 // the loaded Manifest out of the optional so we need to
-
660 // reload it here.
-
661 mo = deserializeManifest(serialized);
-
662 XRPL_ASSERT(
-
663 mo,
-
664 "ripple::OverlayImpl::onManifests : manifest "
-
665 "deserialization succeeded");
-
666
-
667 app_.getOPs().pubManifest(*mo);
-
668
-
669 if (app_.validators().listed(mo->masterKey))
-
670 {
-
671 auto db = app_.getWalletDB().checkoutDb();
-
672 addValidatorManifest(*db, serialized);
-
673 }
-
674 }
-
675 }
-
676 else
-
677 {
-
678 JLOG(journal.debug())
-
679 << "Malformed manifest #" << i + 1 << ": " << strHex(s);
-
680 continue;
-
681 }
-
682 }
-
683
-
684 if (!relay.list().empty())
-
685 for_each([m2 = std::make_shared<Message>(relay, protocol::mtMANIFESTS)](
-
686 std::shared_ptr<PeerImp>&& p) { p->send(m2); });
-
687}
-
688
-
689void
-
690OverlayImpl::reportTraffic(
-
691 TrafficCount::category cat,
-
692 bool isInbound,
-
693 int number)
-
694{
-
695 m_traffic.addCount(cat, isInbound, number);
-
696}
-
697
-
702std::size_t
-
703OverlayImpl::size() const
-
704{
-
705 std::lock_guard lock(mutex_);
-
706 return ids_.size();
-
707}
-
708
-
709int
-
710OverlayImpl::limit()
-
711{
-
712 return m_peerFinder->config().maxPeers;
-
713}
-
714
-
715Json::Value
-
716OverlayImpl::getOverlayInfo()
-
717{
-
718 using namespace std::chrono;
-
719 Json::Value jv;
-
720 auto& av = jv["active"] = Json::Value(Json::arrayValue);
-
721
-
722 for_each([&](std::shared_ptr<PeerImp>&& sp) {
-
723 auto& pv = av.append(Json::Value(Json::objectValue));
-
724 pv[jss::public_key] = base64_encode(
-
725 sp->getNodePublic().data(), sp->getNodePublic().size());
-
726 pv[jss::type] = sp->slot()->inbound() ? "in" : "out";
-
727 pv[jss::uptime] = static_cast<std::uint32_t>(
-
728 duration_cast<seconds>(sp->uptime()).count());
-
729 if (sp->crawl())
-
730 {
-
731 pv[jss::ip] = sp->getRemoteAddress().address().to_string();
-
732 if (sp->slot()->inbound())
-
733 {
-
734 if (auto port = sp->slot()->listening_port())
-
735 pv[jss::port] = *port;
-
736 }
-
737 else
-
738 {
-
739 pv[jss::port] = std::to_string(sp->getRemoteAddress().port());
-
740 }
-
741 }
-
742
-
743 {
-
744 auto version{sp->getVersion()};
-
745 if (!version.empty())
-
746 // Could move here if Json::value supported moving from strings
-
747 pv[jss::version] = std::string{version};
-
748 }
-
749
-
750 std::uint32_t minSeq, maxSeq;
-
751 sp->ledgerRange(minSeq, maxSeq);
-
752 if (minSeq != 0 || maxSeq != 0)
-
753 pv[jss::complete_ledgers] =
-
754 std::to_string(minSeq) + "-" + std::to_string(maxSeq);
-
755 });
-
756
-
757 return jv;
-
758}
+
654 auto const result =
+
655 app_.validatorManifests().applyManifest(std::move(*mo));
+
656
+
657 if (result == ManifestDisposition::accepted)
+
658 {
+
659 relay.add_list()->set_stobject(s);
+
660
+
661 // N.B.: this is important; the applyManifest call above moves
+
662 // the loaded Manifest out of the optional so we need to
+
663 // reload it here.
+
664 mo = deserializeManifest(serialized);
+
665 XRPL_ASSERT(
+
666 mo,
+
667 "ripple::OverlayImpl::onManifests : manifest "
+
668 "deserialization succeeded");
+
669
+
670 app_.getOPs().pubManifest(*mo);
+
671
+
672 if (app_.validators().listed(mo->masterKey))
+
673 {
+
674 auto db = app_.getWalletDB().checkoutDb();
+
675 addValidatorManifest(*db, serialized);
+
676 }
+
677 }
+
678 }
+
679 else
+
680 {
+
681 JLOG(journal.debug())
+
682 << "Malformed manifest #" << i + 1 << ": " << strHex(s);
+
683 continue;
+
684 }
+
685 }
+
686
+
687 if (!relay.list().empty())
+
688 for_each([m2 = std::make_shared<Message>(relay, protocol::mtMANIFESTS)](
+
689 std::shared_ptr<PeerImp>&& p) { p->send(m2); });
+
690}
+
691
+
692void
+
693OverlayImpl::reportTraffic(
+
694 TrafficCount::category cat,
+
695 bool isInbound,
+
696 int number)
+
697{
+
698 m_traffic.addCount(cat, isInbound, number);
+
699}
+
700
+
705std::size_t
+
706OverlayImpl::size() const
+
707{
+
708 std::lock_guard lock(mutex_);
+
709 return ids_.size();
+
710}
+
711
+
712int
+
713OverlayImpl::limit()
+
714{
+
715 return m_peerFinder->config().maxPeers;
+
716}
+
717
+
718Json::Value
+
719OverlayImpl::getOverlayInfo()
+
720{
+
721 using namespace std::chrono;
+
722 Json::Value jv;
+
723 auto& av = jv["active"] = Json::Value(Json::arrayValue);
+
724
+
725 for_each([&](std::shared_ptr<PeerImp>&& sp) {
+
726 auto& pv = av.append(Json::Value(Json::objectValue));
+
727 pv[jss::public_key] = base64_encode(
+
728 sp->getNodePublic().data(), sp->getNodePublic().size());
+
729 pv[jss::type] = sp->slot()->inbound() ? "in" : "out";
+
730 pv[jss::uptime] = static_cast<std::uint32_t>(
+
731 duration_cast<seconds>(sp->uptime()).count());
+
732 if (sp->crawl())
+
733 {
+
734 pv[jss::ip] = sp->getRemoteAddress().address().to_string();
+
735 if (sp->slot()->inbound())
+
736 {
+
737 if (auto port = sp->slot()->listening_port())
+
738 pv[jss::port] = *port;
+
739 }
+
740 else
+
741 {
+
742 pv[jss::port] = std::to_string(sp->getRemoteAddress().port());
+
743 }
+
744 }
+
745
+
746 {
+
747 auto version{sp->getVersion()};
+
748 if (!version.empty())
+
749 // Could move here if Json::value supported moving from strings
+
750 pv[jss::version] = std::string{version};
+
751 }
+
752
+
753 std::uint32_t minSeq, maxSeq;
+
754 sp->ledgerRange(minSeq, maxSeq);
+
755 if (minSeq != 0 || maxSeq != 0)
+
756 pv[jss::complete_ledgers] =
+
757 std::to_string(minSeq) + "-" + std::to_string(maxSeq);
+
758 });
759
-
760Json::Value
-
761OverlayImpl::getServerInfo()
-
762{
-
763 bool const humanReadable = false;
-
764 bool const admin = false;
-
765 bool const counters = false;
-
766
-
767 Json::Value server_info =
-
768 app_.getOPs().getServerInfo(humanReadable, admin, counters);
+
760 return jv;
+
761}
+
762
+
763Json::Value
+
764OverlayImpl::getServerInfo()
+
765{
+
766 bool const humanReadable = false;
+
767 bool const admin = false;
+
768 bool const counters = false;
769
-
770 // Filter out some information
-
771 server_info.removeMember(jss::hostid);
-
772 server_info.removeMember(jss::load_factor_fee_escalation);
-
773 server_info.removeMember(jss::load_factor_fee_queue);
-
774 server_info.removeMember(jss::validation_quorum);
-
775
-
776 if (server_info.isMember(jss::validated_ledger))
-
777 {
-
778 Json::Value& validated_ledger = server_info[jss::validated_ledger];
-
779
-
780 validated_ledger.removeMember(jss::base_fee);
-
781 validated_ledger.removeMember(jss::reserve_base_xrp);
-
782 validated_ledger.removeMember(jss::reserve_inc_xrp);
-
783 }
-
784
-
785 return server_info;
-
786}
+
770 Json::Value server_info =
+
771 app_.getOPs().getServerInfo(humanReadable, admin, counters);
+
772
+
773 // Filter out some information
+
774 server_info.removeMember(jss::hostid);
+
775 server_info.removeMember(jss::load_factor_fee_escalation);
+
776 server_info.removeMember(jss::load_factor_fee_queue);
+
777 server_info.removeMember(jss::validation_quorum);
+
778
+
779 if (server_info.isMember(jss::validated_ledger))
+
780 {
+
781 Json::Value& validated_ledger = server_info[jss::validated_ledger];
+
782
+
783 validated_ledger.removeMember(jss::base_fee);
+
784 validated_ledger.removeMember(jss::reserve_base_xrp);
+
785 validated_ledger.removeMember(jss::reserve_inc_xrp);
+
786 }
787
-
788Json::Value
-
789OverlayImpl::getServerCounts()
-
790{
-
791 return getCountsJson(app_, 10);
-
792}
-
793
-
794Json::Value
-
795OverlayImpl::getUnlInfo()
-
796{
-
797 Json::Value validators = app_.validators().getJson();
-
798
-
799 if (validators.isMember(jss::publisher_lists))
-
800 {
-
801 Json::Value& publisher_lists = validators[jss::publisher_lists];
-
802
-
803 for (auto& publisher : publisher_lists)
-
804 {
-
805 publisher.removeMember(jss::list);
-
806 }
-
807 }
-
808
-
809 validators.removeMember(jss::signing_keys);
-
810 validators.removeMember(jss::trusted_validator_keys);
-
811 validators.removeMember(jss::validation_quorum);
-
812
-
813 Json::Value validatorSites = app_.validatorSites().getJson();
-
814
-
815 if (validatorSites.isMember(jss::validator_sites))
-
816 {
-
817 validators[jss::validator_sites] =
-
818 std::move(validatorSites[jss::validator_sites]);
-
819 }
-
820
-
821 return validators;
-
822}
+
788 return server_info;
+
789}
+
790
+
791Json::Value
+
792OverlayImpl::getServerCounts()
+
793{
+
794 return getCountsJson(app_, 10);
+
795}
+
796
+
797Json::Value
+
798OverlayImpl::getUnlInfo()
+
799{
+
800 Json::Value validators = app_.validators().getJson();
+
801
+
802 if (validators.isMember(jss::publisher_lists))
+
803 {
+
804 Json::Value& publisher_lists = validators[jss::publisher_lists];
+
805
+
806 for (auto& publisher : publisher_lists)
+
807 {
+
808 publisher.removeMember(jss::list);
+
809 }
+
810 }
+
811
+
812 validators.removeMember(jss::signing_keys);
+
813 validators.removeMember(jss::trusted_validator_keys);
+
814 validators.removeMember(jss::validation_quorum);
+
815
+
816 Json::Value validatorSites = app_.validatorSites().getJson();
+
817
+
818 if (validatorSites.isMember(jss::validator_sites))
+
819 {
+
820 validators[jss::validator_sites] =
+
821 std::move(validatorSites[jss::validator_sites]);
+
822 }
823
-
824// Returns information on verified peers.
-
825Json::Value
-
826OverlayImpl::json()
-
827{
-
828 Json::Value json;
-
829 for (auto const& peer : getActivePeers())
-
830 {
-
831 json.append(peer->json());
-
832 }
-
833 return json;
-
834}
-
835
-
836bool
-
837OverlayImpl::processCrawl(http_request_type const& req, Handoff& handoff)
-
838{
-
839 if (req.target() != "/crawl" ||
-
840 setup_.crawlOptions == CrawlOptions::Disabled)
-
841 return false;
-
842
-
843 boost::beast::http::response<json_body> msg;
-
844 msg.version(req.version());
-
845 msg.result(boost::beast::http::status::ok);
-
846 msg.insert("Server", BuildInfo::getFullVersionString());
-
847 msg.insert("Content-Type", "application/json");
-
848 msg.insert("Connection", "close");
-
849 msg.body()["version"] = Json::Value(2u);
-
850
-
851 if (setup_.crawlOptions & CrawlOptions::Overlay)
-
852 {
-
853 msg.body()["overlay"] = getOverlayInfo();
-
854 }
-
855 if (setup_.crawlOptions & CrawlOptions::ServerInfo)
-
856 {
-
857 msg.body()["server"] = getServerInfo();
-
858 }
-
859 if (setup_.crawlOptions & CrawlOptions::ServerCounts)
-
860 {
-
861 msg.body()["counts"] = getServerCounts();
-
862 }
-
863 if (setup_.crawlOptions & CrawlOptions::Unl)
-
864 {
-
865 msg.body()["unl"] = getUnlInfo();
-
866 }
-
867
-
868 msg.prepare_payload();
-
869 handoff.response = std::make_shared<SimpleWriter>(msg);
-
870 return true;
-
871}
-
872
-
873bool
-
874OverlayImpl::processValidatorList(
-
875 http_request_type const& req,
-
876 Handoff& handoff)
-
877{
-
878 // If the target is in the form "/vl/<validator_list_public_key>",
-
879 // return the most recent validator list for that key.
-
880 constexpr std::string_view prefix("/vl/");
-
881
-
882 if (!req.target().starts_with(prefix.data()) || !setup_.vlEnabled)
-
883 return false;
+
824 return validators;
+
825}
+
826
+
827// Returns information on verified peers.
+
828Json::Value
+
829OverlayImpl::json()
+
830{
+
831 Json::Value json;
+
832 for (auto const& peer : getActivePeers())
+
833 {
+
834 json.append(peer->json());
+
835 }
+
836 return json;
+
837}
+
838
+
839bool
+
840OverlayImpl::processCrawl(http_request_type const& req, Handoff& handoff)
+
841{
+
842 if (req.target() != "/crawl" ||
+
843 setup_.crawlOptions == CrawlOptions::Disabled)
+
844 return false;
+
845
+
846 boost::beast::http::response<json_body> msg;
+
847 msg.version(req.version());
+
848 msg.result(boost::beast::http::status::ok);
+
849 msg.insert("Server", BuildInfo::getFullVersionString());
+
850 msg.insert("Content-Type", "application/json");
+
851 msg.insert("Connection", "close");
+
852 msg.body()["version"] = Json::Value(2u);
+
853
+
854 if (setup_.crawlOptions & CrawlOptions::Overlay)
+
855 {
+
856 msg.body()["overlay"] = getOverlayInfo();
+
857 }
+
858 if (setup_.crawlOptions & CrawlOptions::ServerInfo)
+
859 {
+
860 msg.body()["server"] = getServerInfo();
+
861 }
+
862 if (setup_.crawlOptions & CrawlOptions::ServerCounts)
+
863 {
+
864 msg.body()["counts"] = getServerCounts();
+
865 }
+
866 if (setup_.crawlOptions & CrawlOptions::Unl)
+
867 {
+
868 msg.body()["unl"] = getUnlInfo();
+
869 }
+
870
+
871 msg.prepare_payload();
+
872 handoff.response = std::make_shared<SimpleWriter>(msg);
+
873 return true;
+
874}
+
875
+
876bool
+
877OverlayImpl::processValidatorList(
+
878 http_request_type const& req,
+
879 Handoff& handoff)
+
880{
+
881 // If the target is in the form "/vl/<validator_list_public_key>",
+
882 // return the most recent validator list for that key.
+
883 constexpr std::string_view prefix("/vl/");
884
-
885 std::uint32_t version = 1;
-
886
-
887 boost::beast::http::response<json_body> msg;
-
888 msg.version(req.version());
-
889 msg.insert("Server", BuildInfo::getFullVersionString());
-
890 msg.insert("Content-Type", "application/json");
-
891 msg.insert("Connection", "close");
-
892
-
893 auto fail = [&msg, &handoff](auto status) {
-
894 msg.result(status);
-
895 msg.insert("Content-Length", "0");
-
896
-
897 msg.body() = Json::nullValue;
-
898
-
899 msg.prepare_payload();
-
900 handoff.response = std::make_shared<SimpleWriter>(msg);
-
901 return true;
-
902 };
-
903
-
904 std::string_view key = req.target().substr(prefix.size());
-
905
-
906 if (auto slash = key.find('/'); slash != std::string_view::npos)
-
907 {
-
908 auto verString = key.substr(0, slash);
-
909 if (!boost::conversion::try_lexical_convert(verString, version))
-
910 return fail(boost::beast::http::status::bad_request);
-
911 key = key.substr(slash + 1);
-
912 }
-
913
-
914 if (key.empty())
-
915 return fail(boost::beast::http::status::bad_request);
+
885 if (!req.target().starts_with(prefix.data()) || !setup_.vlEnabled)
+
886 return false;
+
887
+
888 std::uint32_t version = 1;
+
889
+
890 boost::beast::http::response<json_body> msg;
+
891 msg.version(req.version());
+
892 msg.insert("Server", BuildInfo::getFullVersionString());
+
893 msg.insert("Content-Type", "application/json");
+
894 msg.insert("Connection", "close");
+
895
+
896 auto fail = [&msg, &handoff](auto status) {
+
897 msg.result(status);
+
898 msg.insert("Content-Length", "0");
+
899
+
900 msg.body() = Json::nullValue;
+
901
+
902 msg.prepare_payload();
+
903 handoff.response = std::make_shared<SimpleWriter>(msg);
+
904 return true;
+
905 };
+
906
+
907 std::string_view key = req.target().substr(prefix.size());
+
908
+
909 if (auto slash = key.find('/'); slash != std::string_view::npos)
+
910 {
+
911 auto verString = key.substr(0, slash);
+
912 if (!boost::conversion::try_lexical_convert(verString, version))
+
913 return fail(boost::beast::http::status::bad_request);
+
914 key = key.substr(slash + 1);
+
915 }
916
-
917 // find the list
-
918 auto vl = app_.validators().getAvailable(key, version);
+
917 if (key.empty())
+
918 return fail(boost::beast::http::status::bad_request);
919
-
920 if (!vl)
-
921 {
-
922 // 404 not found
-
923 return fail(boost::beast::http::status::not_found);
-
924 }
-
925 else if (!*vl)
-
926 {
-
927 return fail(boost::beast::http::status::bad_request);
-
928 }
-
929 else
-
930 {
-
931 msg.result(boost::beast::http::status::ok);
-
932
-
933 msg.body() = *vl;
-
934
-
935 msg.prepare_payload();
-
936 handoff.response = std::make_shared<SimpleWriter>(msg);
-
937 return true;
-
938 }
-
939}
-
940
-
941bool
-
942OverlayImpl::processHealth(http_request_type const& req, Handoff& handoff)
-
943{
-
944 if (req.target() != "/health")
-
945 return false;
-
946 boost::beast::http::response<json_body> msg;
-
947 msg.version(req.version());
-
948 msg.insert("Server", BuildInfo::getFullVersionString());
-
949 msg.insert("Content-Type", "application/json");
-
950 msg.insert("Connection", "close");
-
951
-
952 auto info = getServerInfo();
-
953
-
954 int last_validated_ledger_age = -1;
-
955 if (info.isMember(jss::validated_ledger))
-
956 last_validated_ledger_age =
-
957 info[jss::validated_ledger][jss::age].asInt();
-
958 bool amendment_blocked = false;
-
959 if (info.isMember(jss::amendment_blocked))
-
960 amendment_blocked = true;
-
961 int number_peers = info[jss::peers].asInt();
-
962 std::string server_state = info[jss::server_state].asString();
-
963 auto load_factor = info[jss::load_factor_server].asDouble() /
-
964 info[jss::load_base].asDouble();
-
965
-
966 enum { healthy, warning, critical };
-
967 int health = healthy;
-
968 auto set_health = [&health](int state) {
-
969 if (health < state)
-
970 health = state;
-
971 };
-
972
-
973 msg.body()[jss::info] = Json::objectValue;
-
974 if (last_validated_ledger_age >= 7 || last_validated_ledger_age < 0)
-
975 {
-
976 msg.body()[jss::info][jss::validated_ledger] =
-
977 last_validated_ledger_age;
-
978 if (last_validated_ledger_age < 20)
-
979 set_health(warning);
-
980 else
-
981 set_health(critical);
-
982 }
-
983
-
984 if (amendment_blocked)
-
985 {
-
986 msg.body()[jss::info][jss::amendment_blocked] = true;
-
987 set_health(critical);
-
988 }
-
989
-
990 if (number_peers <= 7)
-
991 {
-
992 msg.body()[jss::info][jss::peers] = number_peers;
-
993 if (number_peers != 0)
-
994 set_health(warning);
-
995 else
-
996 set_health(critical);
-
997 }
-
998
-
999 if (!(server_state == "full" || server_state == "validating" ||
-
1000 server_state == "proposing"))
-
1001 {
-
1002 msg.body()[jss::info][jss::server_state] = server_state;
-
1003 if (server_state == "syncing" || server_state == "tracking" ||
-
1004 server_state == "connected")
-
1005 {
-
1006 set_health(warning);
-
1007 }
-
1008 else
-
1009 set_health(critical);
-
1010 }
-
1011
-
1012 if (load_factor > 100)
-
1013 {
-
1014 msg.body()[jss::info][jss::load_factor] = load_factor;
-
1015 if (load_factor < 1000)
-
1016 set_health(warning);
-
1017 else
-
1018 set_health(critical);
-
1019 }
-
1020
-
1021 switch (health)
-
1022 {
-
1023 case healthy:
-
1024 msg.result(boost::beast::http::status::ok);
-
1025 break;
-
1026 case warning:
-
1027 msg.result(boost::beast::http::status::service_unavailable);
+
920 // find the list
+
921 auto vl = app_.validators().getAvailable(key, version);
+
922
+
923 if (!vl)
+
924 {
+
925 // 404 not found
+
926 return fail(boost::beast::http::status::not_found);
+
927 }
+
928 else if (!*vl)
+
929 {
+
930 return fail(boost::beast::http::status::bad_request);
+
931 }
+
932 else
+
933 {
+
934 msg.result(boost::beast::http::status::ok);
+
935
+
936 msg.body() = *vl;
+
937
+
938 msg.prepare_payload();
+
939 handoff.response = std::make_shared<SimpleWriter>(msg);
+
940 return true;
+
941 }
+
942}
+
943
+
944bool
+
945OverlayImpl::processHealth(http_request_type const& req, Handoff& handoff)
+
946{
+
947 if (req.target() != "/health")
+
948 return false;
+
949 boost::beast::http::response<json_body> msg;
+
950 msg.version(req.version());
+
951 msg.insert("Server", BuildInfo::getFullVersionString());
+
952 msg.insert("Content-Type", "application/json");
+
953 msg.insert("Connection", "close");
+
954
+
955 auto info = getServerInfo();
+
956
+
957 int last_validated_ledger_age = -1;
+
958 if (info.isMember(jss::validated_ledger))
+
959 last_validated_ledger_age =
+
960 info[jss::validated_ledger][jss::age].asInt();
+
961 bool amendment_blocked = false;
+
962 if (info.isMember(jss::amendment_blocked))
+
963 amendment_blocked = true;
+
964 int number_peers = info[jss::peers].asInt();
+
965 std::string server_state = info[jss::server_state].asString();
+
966 auto load_factor = info[jss::load_factor_server].asDouble() /
+
967 info[jss::load_base].asDouble();
+
968
+
969 enum { healthy, warning, critical };
+
970 int health = healthy;
+
971 auto set_health = [&health](int state) {
+
972 if (health < state)
+
973 health = state;
+
974 };
+
975
+
976 msg.body()[jss::info] = Json::objectValue;
+
977 if (last_validated_ledger_age >= 7 || last_validated_ledger_age < 0)
+
978 {
+
979 msg.body()[jss::info][jss::validated_ledger] =
+
980 last_validated_ledger_age;
+
981 if (last_validated_ledger_age < 20)
+
982 set_health(warning);
+
983 else
+
984 set_health(critical);
+
985 }
+
986
+
987 if (amendment_blocked)
+
988 {
+
989 msg.body()[jss::info][jss::amendment_blocked] = true;
+
990 set_health(critical);
+
991 }
+
992
+
993 if (number_peers <= 7)
+
994 {
+
995 msg.body()[jss::info][jss::peers] = number_peers;
+
996 if (number_peers != 0)
+
997 set_health(warning);
+
998 else
+
999 set_health(critical);
+
1000 }
+
1001
+
1002 if (!(server_state == "full" || server_state == "validating" ||
+
1003 server_state == "proposing"))
+
1004 {
+
1005 msg.body()[jss::info][jss::server_state] = server_state;
+
1006 if (server_state == "syncing" || server_state == "tracking" ||
+
1007 server_state == "connected")
+
1008 {
+
1009 set_health(warning);
+
1010 }
+
1011 else
+
1012 set_health(critical);
+
1013 }
+
1014
+
1015 if (load_factor > 100)
+
1016 {
+
1017 msg.body()[jss::info][jss::load_factor] = load_factor;
+
1018 if (load_factor < 1000)
+
1019 set_health(warning);
+
1020 else
+
1021 set_health(critical);
+
1022 }
+
1023
+
1024 switch (health)
+
1025 {
+
1026 case healthy:
+
1027 msg.result(boost::beast::http::status::ok);
1028 break;
-
1029 case critical:
-
1030 msg.result(boost::beast::http::status::internal_server_error);
+
1029 case warning:
+
1030 msg.result(boost::beast::http::status::service_unavailable);
1031 break;
-
1032 }
-
1033
-
1034 msg.prepare_payload();
-
1035 handoff.response = std::make_shared<SimpleWriter>(msg);
-
1036 return true;
-
1037}
-
1038
-
1039bool
-
1040OverlayImpl::processRequest(http_request_type const& req, Handoff& handoff)
-
1041{
-
1042 // Take advantage of || short-circuiting
-
1043 return processCrawl(req, handoff) || processValidatorList(req, handoff) ||
-
1044 processHealth(req, handoff);
-
1045}
-
1046
-
1047Overlay::PeerSequence
-
1048OverlayImpl::getActivePeers() const
-
1049{
-
1050 Overlay::PeerSequence ret;
-
1051 ret.reserve(size());
-
1052
-
1053 for_each([&ret](std::shared_ptr<PeerImp>&& sp) {
-
1054 ret.emplace_back(std::move(sp));
-
1055 });
-
1056
-
1057 return ret;
-
1058}
+
1032 case critical:
+
1033 msg.result(boost::beast::http::status::internal_server_error);
+
1034 break;
+
1035 }
+
1036
+
1037 msg.prepare_payload();
+
1038 handoff.response = std::make_shared<SimpleWriter>(msg);
+
1039 return true;
+
1040}
+
1041
+
1042bool
+
1043OverlayImpl::processRequest(http_request_type const& req, Handoff& handoff)
+
1044{
+
1045 // Take advantage of || short-circuiting
+
1046 return processCrawl(req, handoff) || processValidatorList(req, handoff) ||
+
1047 processHealth(req, handoff);
+
1048}
+
1049
+
1050Overlay::PeerSequence
+
1051OverlayImpl::getActivePeers() const
+
1052{
+
1053 Overlay::PeerSequence ret;
+
1054 ret.reserve(size());
+
1055
+
1056 for_each([&ret](std::shared_ptr<PeerImp>&& sp) {
+
1057 ret.emplace_back(std::move(sp));
+
1058 });
1059
-
1060Overlay::PeerSequence
-
1061OverlayImpl::getActivePeers(
-
1062 std::set<Peer::id_t> const& toSkip,
-
1063 std::size_t& active,
-
1064 std::size_t& disabled,
-
1065 std::size_t& enabledInSkip) const
-
1066{
-
1067 Overlay::PeerSequence ret;
-
1068 std::lock_guard lock(mutex_);
-
1069
-
1070 active = ids_.size();
-
1071 disabled = enabledInSkip = 0;
-
1072 ret.reserve(ids_.size());
-
1073
-
1074 // NOTE The purpose of p is to delay the destruction of PeerImp
-
1075 std::shared_ptr<PeerImp> p;
-
1076 for (auto& [id, w] : ids_)
-
1077 {
-
1078 if (p = w.lock(); p != nullptr)
-
1079 {
-
1080 bool const reduceRelayEnabled = p->txReduceRelayEnabled();
-
1081 // tx reduced relay feature disabled
-
1082 if (!reduceRelayEnabled)
-
1083 ++disabled;
-
1084
-
1085 if (toSkip.count(id) == 0)
-
1086 ret.emplace_back(std::move(p));
-
1087 else if (reduceRelayEnabled)
-
1088 ++enabledInSkip;
-
1089 }
-
1090 }
-
1091
-
1092 return ret;
-
1093}
+
1060 return ret;
+
1061}
+
1062
+
1063Overlay::PeerSequence
+
1064OverlayImpl::getActivePeers(
+
1065 std::set<Peer::id_t> const& toSkip,
+
1066 std::size_t& active,
+
1067 std::size_t& disabled,
+
1068 std::size_t& enabledInSkip) const
+
1069{
+
1070 Overlay::PeerSequence ret;
+
1071 std::lock_guard lock(mutex_);
+
1072
+
1073 active = ids_.size();
+
1074 disabled = enabledInSkip = 0;
+
1075 ret.reserve(ids_.size());
+
1076
+
1077 // NOTE The purpose of p is to delay the destruction of PeerImp
+
1078 std::shared_ptr<PeerImp> p;
+
1079 for (auto& [id, w] : ids_)
+
1080 {
+
1081 if (p = w.lock(); p != nullptr)
+
1082 {
+
1083 bool const reduceRelayEnabled = p->txReduceRelayEnabled();
+
1084 // tx reduced relay feature disabled
+
1085 if (!reduceRelayEnabled)
+
1086 ++disabled;
+
1087
+
1088 if (toSkip.count(id) == 0)
+
1089 ret.emplace_back(std::move(p));
+
1090 else if (reduceRelayEnabled)
+
1091 ++enabledInSkip;
+
1092 }
+
1093 }
1094
-
1095void
-
1096OverlayImpl::checkTracking(std::uint32_t index)
-
1097{
-
1098 for_each(
-
1099 [index](std::shared_ptr<PeerImp>&& sp) { sp->checkTracking(index); });
-
1100}
-
1101
-
1102std::shared_ptr<Peer>
-
1103OverlayImpl::findPeerByShortID(Peer::id_t const& id) const
-
1104{
-
1105 std::lock_guard lock(mutex_);
-
1106 auto const iter = ids_.find(id);
-
1107 if (iter != ids_.end())
-
1108 return iter->second.lock();
-
1109 return {};
-
1110}
-
1111
-
1112// A public key hash map was not used due to the peer connect/disconnect
-
1113// update overhead outweighing the performance of a small set linear search.
-
1114std::shared_ptr<Peer>
-
1115OverlayImpl::findPeerByPublicKey(PublicKey const& pubKey)
-
1116{
-
1117 std::lock_guard lock(mutex_);
-
1118 // NOTE The purpose of peer is to delay the destruction of PeerImp
-
1119 std::shared_ptr<PeerImp> peer;
-
1120 for (auto const& e : ids_)
-
1121 {
-
1122 if (peer = e.second.lock(); peer != nullptr)
-
1123 {
-
1124 if (peer->getNodePublic() == pubKey)
-
1125 return peer;
-
1126 }
-
1127 }
-
1128 return {};
-
1129}
-
1130
-
1131void
-
1132OverlayImpl::broadcast(protocol::TMProposeSet& m)
-
1133{
-
1134 auto const sm = std::make_shared<Message>(m, protocol::mtPROPOSE_LEDGER);
-
1135 for_each([&](std::shared_ptr<PeerImp>&& p) { p->send(sm); });
-
1136}
-
1137
-
1138std::set<Peer::id_t>
-
1139OverlayImpl::relay(
-
1140 protocol::TMProposeSet& m,
-
1141 uint256 const& uid,
-
1142 PublicKey const& validator)
-
1143{
-
1144 if (auto const toSkip = app_.getHashRouter().shouldRelay(uid))
-
1145 {
-
1146 auto const sm =
-
1147 std::make_shared<Message>(m, protocol::mtPROPOSE_LEDGER, validator);
-
1148 for_each([&](std::shared_ptr<PeerImp>&& p) {
-
1149 if (toSkip->find(p->id()) == toSkip->end())
-
1150 p->send(sm);
-
1151 });
-
1152 return *toSkip;
-
1153 }
-
1154 return {};
-
1155}
-
1156
-
1157void
-
1158OverlayImpl::broadcast(protocol::TMValidation& m)
-
1159{
-
1160 auto const sm = std::make_shared<Message>(m, protocol::mtVALIDATION);
-
1161 for_each([sm](std::shared_ptr<PeerImp>&& p) { p->send(sm); });
-
1162}
-
1163
-
1164std::set<Peer::id_t>
-
1165OverlayImpl::relay(
-
1166 protocol::TMValidation& m,
-
1167 uint256 const& uid,
-
1168 PublicKey const& validator)
-
1169{
-
1170 if (auto const toSkip = app_.getHashRouter().shouldRelay(uid))
-
1171 {
-
1172 auto const sm =
-
1173 std::make_shared<Message>(m, protocol::mtVALIDATION, validator);
-
1174 for_each([&](std::shared_ptr<PeerImp>&& p) {
-
1175 if (toSkip->find(p->id()) == toSkip->end())
-
1176 p->send(sm);
-
1177 });
-
1178 return *toSkip;
-
1179 }
-
1180 return {};
-
1181}
-
1182
-
1183std::shared_ptr<Message>
-
1184OverlayImpl::getManifestsMessage()
-
1185{
-
1186 std::lock_guard g(manifestLock_);
-
1187
-
1188 if (auto seq = app_.validatorManifests().sequence();
-
1189 seq != manifestListSeq_)
-
1190 {
-
1191 protocol::TMManifests tm;
-
1192
-
1193 app_.validatorManifests().for_each_manifest(
-
1194 [&tm](std::size_t s) { tm.mutable_list()->Reserve(s); },
-
1195 [&tm, &hr = app_.getHashRouter()](Manifest const& manifest) {
-
1196 tm.add_list()->set_stobject(
-
1197 manifest.serialized.data(), manifest.serialized.size());
-
1198 hr.addSuppression(manifest.hash());
-
1199 });
-
1200
-
1201 manifestMessage_.reset();
-
1202
-
1203 if (tm.list_size() != 0)
-
1204 manifestMessage_ =
-
1205 std::make_shared<Message>(tm, protocol::mtMANIFESTS);
-
1206
-
1207 manifestListSeq_ = seq;
-
1208 }
+
1095 return ret;
+
1096}
+
1097
+
1098void
+
1099OverlayImpl::checkTracking(std::uint32_t index)
+
1100{
+
1101 for_each(
+
1102 [index](std::shared_ptr<PeerImp>&& sp) { sp->checkTracking(index); });
+
1103}
+
1104
+
1105std::shared_ptr<Peer>
+
1106OverlayImpl::findPeerByShortID(Peer::id_t const& id) const
+
1107{
+
1108 std::lock_guard lock(mutex_);
+
1109 auto const iter = ids_.find(id);
+
1110 if (iter != ids_.end())
+
1111 return iter->second.lock();
+
1112 return {};
+
1113}
+
1114
+
1115// A public key hash map was not used due to the peer connect/disconnect
+
1116// update overhead outweighing the performance of a small set linear search.
+
1117std::shared_ptr<Peer>
+
1118OverlayImpl::findPeerByPublicKey(PublicKey const& pubKey)
+
1119{
+
1120 std::lock_guard lock(mutex_);
+
1121 // NOTE The purpose of peer is to delay the destruction of PeerImp
+
1122 std::shared_ptr<PeerImp> peer;
+
1123 for (auto const& e : ids_)
+
1124 {
+
1125 if (peer = e.second.lock(); peer != nullptr)
+
1126 {
+
1127 if (peer->getNodePublic() == pubKey)
+
1128 return peer;
+
1129 }
+
1130 }
+
1131 return {};
+
1132}
+
1133
+
1134void
+
1135OverlayImpl::broadcast(protocol::TMProposeSet& m)
+
1136{
+
1137 auto const sm = std::make_shared<Message>(m, protocol::mtPROPOSE_LEDGER);
+
1138 for_each([&](std::shared_ptr<PeerImp>&& p) { p->send(sm); });
+
1139}
+
1140
+
1141std::set<Peer::id_t>
+
1142OverlayImpl::relay(
+
1143 protocol::TMProposeSet& m,
+
1144 uint256 const& uid,
+
1145 PublicKey const& validator)
+
1146{
+
1147 if (auto const toSkip = app_.getHashRouter().shouldRelay(uid))
+
1148 {
+
1149 auto const sm =
+
1150 std::make_shared<Message>(m, protocol::mtPROPOSE_LEDGER, validator);
+
1151 for_each([&](std::shared_ptr<PeerImp>&& p) {
+
1152 if (toSkip->find(p->id()) == toSkip->end())
+
1153 p->send(sm);
+
1154 });
+
1155 return *toSkip;
+
1156 }
+
1157 return {};
+
1158}
+
1159
+
1160void
+
1161OverlayImpl::broadcast(protocol::TMValidation& m)
+
1162{
+
1163 auto const sm = std::make_shared<Message>(m, protocol::mtVALIDATION);
+
1164 for_each([sm](std::shared_ptr<PeerImp>&& p) { p->send(sm); });
+
1165}
+
1166
+
1167std::set<Peer::id_t>
+
1168OverlayImpl::relay(
+
1169 protocol::TMValidation& m,
+
1170 uint256 const& uid,
+
1171 PublicKey const& validator)
+
1172{
+
1173 if (auto const toSkip = app_.getHashRouter().shouldRelay(uid))
+
1174 {
+
1175 auto const sm =
+
1176 std::make_shared<Message>(m, protocol::mtVALIDATION, validator);
+
1177 for_each([&](std::shared_ptr<PeerImp>&& p) {
+
1178 if (toSkip->find(p->id()) == toSkip->end())
+
1179 p->send(sm);
+
1180 });
+
1181 return *toSkip;
+
1182 }
+
1183 return {};
+
1184}
+
1185
+
1186std::shared_ptr<Message>
+
1187OverlayImpl::getManifestsMessage()
+
1188{
+
1189 std::lock_guard g(manifestLock_);
+
1190
+
1191 if (auto seq = app_.validatorManifests().sequence();
+
1192 seq != manifestListSeq_)
+
1193 {
+
1194 protocol::TMManifests tm;
+
1195
+
1196 app_.validatorManifests().for_each_manifest(
+
1197 [&tm](std::size_t s) { tm.mutable_list()->Reserve(s); },
+
1198 [&tm, &hr = app_.getHashRouter()](Manifest const& manifest) {
+
1199 tm.add_list()->set_stobject(
+
1200 manifest.serialized.data(), manifest.serialized.size());
+
1201 hr.addSuppression(manifest.hash());
+
1202 });
+
1203
+
1204 manifestMessage_.reset();
+
1205
+
1206 if (tm.list_size() != 0)
+
1207 manifestMessage_ =
+
1208 std::make_shared<Message>(tm, protocol::mtMANIFESTS);
1209
-
1210 return manifestMessage_;
-
1211}
+
1210 manifestListSeq_ = seq;
+
1211 }
1212
-
1213void
-
1214OverlayImpl::relay(
-
1215 uint256 const& hash,
-
1216 std::optional<std::reference_wrapper<protocol::TMTransaction>> tx,
-
1217 std::set<Peer::id_t> const& toSkip)
-
1218{
-
1219 bool relay = tx.has_value();
-
1220 if (relay)
-
1221 {
-
1222 auto& txn = tx->get();
-
1223 SerialIter sit(makeSlice(txn.rawtransaction()));
-
1224 relay = !isPseudoTx(STTx{sit});
-
1225 }
-
1226
-
1227 Overlay::PeerSequence peers = {};
-
1228 std::size_t total = 0;
-
1229 std::size_t disabled = 0;
-
1230 std::size_t enabledInSkip = 0;
-
1231
-
1232 if (!relay)
-
1233 {
-
1234 if (!app_.config().TX_REDUCE_RELAY_ENABLE)
-
1235 return;
-
1236
-
1237 peers = getActivePeers(toSkip, total, disabled, enabledInSkip);
-
1238 JLOG(journal_.trace())
-
1239 << "not relaying tx, total peers " << peers.size();
-
1240 for (auto const& p : peers)
-
1241 p->addTxQueue(hash);
-
1242 return;
-
1243 }
-
1244
-
1245 auto& txn = tx->get();
-
1246 auto const sm = std::make_shared<Message>(txn, protocol::mtTRANSACTION);
-
1247 peers = getActivePeers(toSkip, total, disabled, enabledInSkip);
-
1248 auto const minRelay = app_.config().TX_REDUCE_RELAY_MIN_PEERS + disabled;
-
1249
-
1250 if (!app_.config().TX_REDUCE_RELAY_ENABLE || total <= minRelay)
-
1251 {
-
1252 for (auto const& p : peers)
-
1253 p->send(sm);
-
1254 if (app_.config().TX_REDUCE_RELAY_ENABLE ||
-
1255 app_.config().TX_REDUCE_RELAY_METRICS)
-
1256 txMetrics_.addMetrics(total, toSkip.size(), 0);
-
1257 return;
-
1258 }
-
1259
-
1260 // We have more peers than the minimum (disabled + minimum enabled),
-
1261 // relay to all disabled and some randomly selected enabled that
-
1262 // do not have the transaction.
-
1263 auto const enabledTarget = app_.config().TX_REDUCE_RELAY_MIN_PEERS +
-
1264 (total - minRelay) * app_.config().TX_RELAY_PERCENTAGE / 100;
-
1265
-
1266 txMetrics_.addMetrics(enabledTarget, toSkip.size(), disabled);
-
1267
-
1268 if (enabledTarget > enabledInSkip)
-
1269 std::shuffle(peers.begin(), peers.end(), default_prng());
+
1213 return manifestMessage_;
+
1214}
+
1215
+
1216void
+
1217OverlayImpl::relay(
+
1218 uint256 const& hash,
+
1219 std::optional<std::reference_wrapper<protocol::TMTransaction>> tx,
+
1220 std::set<Peer::id_t> const& toSkip)
+
1221{
+
1222 bool relay = tx.has_value();
+
1223 if (relay)
+
1224 {
+
1225 auto& txn = tx->get();
+
1226 SerialIter sit(makeSlice(txn.rawtransaction()));
+
1227 relay = !isPseudoTx(STTx{sit});
+
1228 }
+
1229
+
1230 Overlay::PeerSequence peers = {};
+
1231 std::size_t total = 0;
+
1232 std::size_t disabled = 0;
+
1233 std::size_t enabledInSkip = 0;
+
1234
+
1235 if (!relay)
+
1236 {
+
1237 if (!app_.config().TX_REDUCE_RELAY_ENABLE)
+
1238 return;
+
1239
+
1240 peers = getActivePeers(toSkip, total, disabled, enabledInSkip);
+
1241 JLOG(journal_.trace())
+
1242 << "not relaying tx, total peers " << peers.size();
+
1243 for (auto const& p : peers)
+
1244 p->addTxQueue(hash);
+
1245 return;
+
1246 }
+
1247
+
1248 auto& txn = tx->get();
+
1249 auto const sm = std::make_shared<Message>(txn, protocol::mtTRANSACTION);
+
1250 peers = getActivePeers(toSkip, total, disabled, enabledInSkip);
+
1251 auto const minRelay = app_.config().TX_REDUCE_RELAY_MIN_PEERS + disabled;
+
1252
+
1253 if (!app_.config().TX_REDUCE_RELAY_ENABLE || total <= minRelay)
+
1254 {
+
1255 for (auto const& p : peers)
+
1256 p->send(sm);
+
1257 if (app_.config().TX_REDUCE_RELAY_ENABLE ||
+
1258 app_.config().TX_REDUCE_RELAY_METRICS)
+
1259 txMetrics_.addMetrics(total, toSkip.size(), 0);
+
1260 return;
+
1261 }
+
1262
+
1263 // We have more peers than the minimum (disabled + minimum enabled),
+
1264 // relay to all disabled and some randomly selected enabled that
+
1265 // do not have the transaction.
+
1266 auto const enabledTarget = app_.config().TX_REDUCE_RELAY_MIN_PEERS +
+
1267 (total - minRelay) * app_.config().TX_RELAY_PERCENTAGE / 100;
+
1268
+
1269 txMetrics_.addMetrics(enabledTarget, toSkip.size(), disabled);
1270
-
1271 JLOG(journal_.trace()) << "relaying tx, total peers " << peers.size()
-
1272 << " selected " << enabledTarget << " skip "
-
1273 << toSkip.size() << " disabled " << disabled;
-
1274
-
1275 // count skipped peers with the enabled feature towards the quota
-
1276 std::uint16_t enabledAndRelayed = enabledInSkip;
-
1277 for (auto const& p : peers)
-
1278 {
-
1279 // always relay to a peer with the disabled feature
-
1280 if (!p->txReduceRelayEnabled())
-
1281 {
-
1282 p->send(sm);
-
1283 }
-
1284 else if (enabledAndRelayed < enabledTarget)
-
1285 {
-
1286 enabledAndRelayed++;
-
1287 p->send(sm);
-
1288 }
-
1289 else
-
1290 {
-
1291 p->addTxQueue(hash);
-
1292 }
-
1293 }
-
1294}
-
1295
-
1296//------------------------------------------------------------------------------
-
1297
-
1298void
-
1299OverlayImpl::remove(Child& child)
-
1300{
-
1301 std::lock_guard lock(mutex_);
-
1302 list_.erase(&child);
-
1303 if (list_.empty())
-
1304 cond_.notify_all();
-
1305}
-
1306
-
1307void
-
1308OverlayImpl::stopChildren()
-
1309{
-
1310 // Calling list_[].second->stop() may cause list_ to be modified
-
1311 // (OverlayImpl::remove() may be called on this same thread). So
-
1312 // iterating directly over list_ to call child->stop() could lead to
-
1313 // undefined behavior.
-
1314 //
-
1315 // Therefore we copy all of the weak/shared ptrs out of list_ before we
-
1316 // start calling stop() on them. That guarantees OverlayImpl::remove()
-
1317 // won't be called until vector<> children leaves scope.
-
1318 std::vector<std::shared_ptr<Child>> children;
-
1319 {
-
1320 std::lock_guard lock(mutex_);
-
1321 if (!work_)
-
1322 return;
-
1323 work_ = std::nullopt;
-
1324
-
1325 children.reserve(list_.size());
-
1326 for (auto const& element : list_)
-
1327 {
-
1328 children.emplace_back(element.second.lock());
-
1329 }
-
1330 } // lock released
-
1331
-
1332 for (auto const& child : children)
-
1333 {
-
1334 if (child != nullptr)
-
1335 child->stop();
-
1336 }
-
1337}
-
1338
-
1339void
-
1340OverlayImpl::autoConnect()
-
1341{
-
1342 auto const result = m_peerFinder->autoconnect();
-
1343 for (auto addr : result)
-
1344 connect(addr);
-
1345}
-
1346
-
1347void
-
1348OverlayImpl::sendEndpoints()
-
1349{
-
1350 auto const result = m_peerFinder->buildEndpointsForPeers();
-
1351 for (auto const& e : result)
-
1352 {
-
1353 std::shared_ptr<PeerImp> peer;
-
1354 {
-
1355 std::lock_guard lock(mutex_);
-
1356 auto const iter = m_peers.find(e.first);
-
1357 if (iter != m_peers.end())
-
1358 peer = iter->second.lock();
-
1359 }
-
1360 if (peer)
-
1361 peer->sendEndpoints(e.second.begin(), e.second.end());
-
1362 }
-
1363}
-
1364
-
1365void
-
1366OverlayImpl::sendTxQueue()
-
1367{
-
1368 for_each([](auto const& p) {
-
1369 if (p->txReduceRelayEnabled())
-
1370 p->sendTxQueue();
-
1371 });
-
1372}
-
1373
-
1374std::shared_ptr<Message>
-
1375makeSquelchMessage(
-
1376 PublicKey const& validator,
-
1377 bool squelch,
-
1378 uint32_t squelchDuration)
-
1379{
-
1380 protocol::TMSquelch m;
-
1381 m.set_squelch(squelch);
-
1382 m.set_validatorpubkey(validator.data(), validator.size());
-
1383 if (squelch)
-
1384 m.set_squelchduration(squelchDuration);
-
1385 return std::make_shared<Message>(m, protocol::mtSQUELCH);
-
1386}
-
1387
-
1388void
-
1389OverlayImpl::unsquelch(PublicKey const& validator, Peer::id_t id) const
-
1390{
-
1391 if (auto peer = findPeerByShortID(id);
-
1392 peer && app_.config().VP_REDUCE_RELAY_SQUELCH)
-
1393 {
-
1394 // optimize - multiple message with different
-
1395 // validator might be sent to the same peer
-
1396 peer->send(makeSquelchMessage(validator, false, 0));
-
1397 }
-
1398}
-
1399
-
1400void
-
1401OverlayImpl::squelch(
-
1402 PublicKey const& validator,
-
1403 Peer::id_t id,
-
1404 uint32_t squelchDuration) const
-
1405{
-
1406 if (auto peer = findPeerByShortID(id);
-
1407 peer && app_.config().VP_REDUCE_RELAY_SQUELCH)
-
1408 {
-
1409 peer->send(makeSquelchMessage(validator, true, squelchDuration));
-
1410 }
-
1411}
-
1412
-
1413void
-
1414OverlayImpl::updateSlotAndSquelch(
-
1415 uint256 const& key,
-
1416 PublicKey const& validator,
-
1417 std::set<Peer::id_t>&& peers,
-
1418 protocol::MessageType type)
-
1419{
-
1420 if (!strand_.running_in_this_thread())
-
1421 return post(
-
1422 strand_,
-
1423 [this, key, validator, peers = std::move(peers), type]() mutable {
-
1424 updateSlotAndSquelch(key, validator, std::move(peers), type);
-
1425 });
-
1426
-
1427 for (auto id : peers)
-
1428 slots_.updateSlotAndSquelch(key, validator, id, type);
-
1429}
-
1430
-
1431void
-
1432OverlayImpl::updateSlotAndSquelch(
-
1433 uint256 const& key,
-
1434 PublicKey const& validator,
-
1435 Peer::id_t peer,
-
1436 protocol::MessageType type)
-
1437{
-
1438 if (!strand_.running_in_this_thread())
-
1439 return post(strand_, [this, key, validator, peer, type]() {
-
1440 updateSlotAndSquelch(key, validator, peer, type);
-
1441 });
-
1442
-
1443 slots_.updateSlotAndSquelch(key, validator, peer, type);
-
1444}
+
1271 if (enabledTarget > enabledInSkip)
+
1272 std::shuffle(peers.begin(), peers.end(), default_prng());
+
1273
+
1274 JLOG(journal_.trace()) << "relaying tx, total peers " << peers.size()
+
1275 << " selected " << enabledTarget << " skip "
+
1276 << toSkip.size() << " disabled " << disabled;
+
1277
+
1278 // count skipped peers with the enabled feature towards the quota
+
1279 std::uint16_t enabledAndRelayed = enabledInSkip;
+
1280 for (auto const& p : peers)
+
1281 {
+
1282 // always relay to a peer with the disabled feature
+
1283 if (!p->txReduceRelayEnabled())
+
1284 {
+
1285 p->send(sm);
+
1286 }
+
1287 else if (enabledAndRelayed < enabledTarget)
+
1288 {
+
1289 enabledAndRelayed++;
+
1290 p->send(sm);
+
1291 }
+
1292 else
+
1293 {
+
1294 p->addTxQueue(hash);
+
1295 }
+
1296 }
+
1297}
+
1298
+
1299//------------------------------------------------------------------------------
+
1300
+
1301void
+
1302OverlayImpl::remove(Child& child)
+
1303{
+
1304 std::lock_guard lock(mutex_);
+
1305 list_.erase(&child);
+
1306 if (list_.empty())
+
1307 cond_.notify_all();
+
1308}
+
1309
+
1310void
+
1311OverlayImpl::stopChildren()
+
1312{
+
1313 // Calling list_[].second->stop() may cause list_ to be modified
+
1314 // (OverlayImpl::remove() may be called on this same thread). So
+
1315 // iterating directly over list_ to call child->stop() could lead to
+
1316 // undefined behavior.
+
1317 //
+
1318 // Therefore we copy all of the weak/shared ptrs out of list_ before we
+
1319 // start calling stop() on them. That guarantees OverlayImpl::remove()
+
1320 // won't be called until vector<> children leaves scope.
+
1321 std::vector<std::shared_ptr<Child>> children;
+
1322 {
+
1323 std::lock_guard lock(mutex_);
+
1324 if (!work_)
+
1325 return;
+
1326 work_ = std::nullopt;
+
1327
+
1328 children.reserve(list_.size());
+
1329 for (auto const& element : list_)
+
1330 {
+
1331 children.emplace_back(element.second.lock());
+
1332 }
+
1333 } // lock released
+
1334
+
1335 for (auto const& child : children)
+
1336 {
+
1337 if (child != nullptr)
+
1338 child->stop();
+
1339 }
+
1340}
+
1341
+
1342void
+
1343OverlayImpl::autoConnect()
+
1344{
+
1345 auto const result = m_peerFinder->autoconnect();
+
1346 for (auto addr : result)
+
1347 connect(addr);
+
1348}
+
1349
+
1350void
+
1351OverlayImpl::sendEndpoints()
+
1352{
+
1353 auto const result = m_peerFinder->buildEndpointsForPeers();
+
1354 for (auto const& e : result)
+
1355 {
+
1356 std::shared_ptr<PeerImp> peer;
+
1357 {
+
1358 std::lock_guard lock(mutex_);
+
1359 auto const iter = m_peers.find(e.first);
+
1360 if (iter != m_peers.end())
+
1361 peer = iter->second.lock();
+
1362 }
+
1363 if (peer)
+
1364 peer->sendEndpoints(e.second.begin(), e.second.end());
+
1365 }
+
1366}
+
1367
+
1368void
+
1369OverlayImpl::sendTxQueue()
+
1370{
+
1371 for_each([](auto const& p) {
+
1372 if (p->txReduceRelayEnabled())
+
1373 p->sendTxQueue();
+
1374 });
+
1375}
+
1376
+
1377std::shared_ptr<Message>
+
1378makeSquelchMessage(
+
1379 PublicKey const& validator,
+
1380 bool squelch,
+
1381 uint32_t squelchDuration)
+
1382{
+
1383 protocol::TMSquelch m;
+
1384 m.set_squelch(squelch);
+
1385 m.set_validatorpubkey(validator.data(), validator.size());
+
1386 if (squelch)
+
1387 m.set_squelchduration(squelchDuration);
+
1388 return std::make_shared<Message>(m, protocol::mtSQUELCH);
+
1389}
+
1390
+
1391void
+
1392OverlayImpl::unsquelch(PublicKey const& validator, Peer::id_t id) const
+
1393{
+
1394 if (auto peer = findPeerByShortID(id);
+
1395 peer && app_.config().VP_REDUCE_RELAY_SQUELCH)
+
1396 {
+
1397 // optimize - multiple message with different
+
1398 // validator might be sent to the same peer
+
1399 peer->send(makeSquelchMessage(validator, false, 0));
+
1400 }
+
1401}
+
1402
+
1403void
+
1404OverlayImpl::squelch(
+
1405 PublicKey const& validator,
+
1406 Peer::id_t id,
+
1407 uint32_t squelchDuration) const
+
1408{
+
1409 if (auto peer = findPeerByShortID(id);
+
1410 peer && app_.config().VP_REDUCE_RELAY_SQUELCH)
+
1411 {
+
1412 peer->send(makeSquelchMessage(validator, true, squelchDuration));
+
1413 }
+
1414}
+
1415
+
1416void
+
1417OverlayImpl::updateSlotAndSquelch(
+
1418 uint256 const& key,
+
1419 PublicKey const& validator,
+
1420 std::set<Peer::id_t>&& peers,
+
1421 protocol::MessageType type)
+
1422{
+
1423 if (!strand_.running_in_this_thread())
+
1424 return post(
+
1425 strand_,
+
1426 [this, key, validator, peers = std::move(peers), type]() mutable {
+
1427 updateSlotAndSquelch(key, validator, std::move(peers), type);
+
1428 });
+
1429
+
1430 for (auto id : peers)
+
1431 slots_.updateSlotAndSquelch(key, validator, id, type);
+
1432}
+
1433
+
1434void
+
1435OverlayImpl::updateSlotAndSquelch(
+
1436 uint256 const& key,
+
1437 PublicKey const& validator,
+
1438 Peer::id_t peer,
+
1439 protocol::MessageType type)
+
1440{
+
1441 if (!strand_.running_in_this_thread())
+
1442 return post(strand_, [this, key, validator, peer, type]() {
+
1443 updateSlotAndSquelch(key, validator, peer, type);
+
1444 });
1445
-
1446void
-
1447OverlayImpl::deletePeer(Peer::id_t id)
-
1448{
-
1449 if (!strand_.running_in_this_thread())
-
1450 return post(strand_, std::bind(&OverlayImpl::deletePeer, this, id));
-
1451
-
1452 slots_.deletePeer(id, true);
-
1453}
+
1446 slots_.updateSlotAndSquelch(key, validator, peer, type);
+
1447}
+
1448
+
1449void
+
1450OverlayImpl::deletePeer(Peer::id_t id)
+
1451{
+
1452 if (!strand_.running_in_this_thread())
+
1453 return post(strand_, std::bind(&OverlayImpl::deletePeer, this, id));
1454
-
1455void
-
1456OverlayImpl::deleteIdlePeers()
-
1457{
-
1458 if (!strand_.running_in_this_thread())
-
1459 return post(strand_, std::bind(&OverlayImpl::deleteIdlePeers, this));
-
1460
-
1461 slots_.deleteIdlePeers();
-
1462}
+
1455 slots_.deletePeer(id, true);
+
1456}
+
1457
+
1458void
+
1459OverlayImpl::deleteIdlePeers()
+
1460{
+
1461 if (!strand_.running_in_this_thread())
+
1462 return post(strand_, std::bind(&OverlayImpl::deleteIdlePeers, this));
1463
-
1464//------------------------------------------------------------------------------
-
1465
-
1466Overlay::Setup
-
1467setup_Overlay(BasicConfig const& config)
-
1468{
-
1469 Overlay::Setup setup;
-
1470
-
1471 {
-
1472 auto const& section = config.section("overlay");
-
1473 setup.context = make_SSLContext("");
-
1474
-
1475 set(setup.ipLimit, "ip_limit", section);
-
1476 if (setup.ipLimit < 0)
-
1477 Throw<std::runtime_error>("Configured IP limit is invalid");
-
1478
-
1479 std::string ip;
-
1480 set(ip, "public_ip", section);
-
1481 if (!ip.empty())
-
1482 {
-
1483 boost::system::error_code ec;
-
1484 setup.public_ip = beast::IP::Address::from_string(ip, ec);
-
1485 if (ec || beast::IP::is_private(setup.public_ip))
-
1486 Throw<std::runtime_error>("Configured public IP is invalid");
-
1487 }
-
1488 }
-
1489
-
1490 {
-
1491 auto const& section = config.section("crawl");
-
1492 auto const& values = section.values();
-
1493
-
1494 if (values.size() > 1)
-
1495 {
-
1496 Throw<std::runtime_error>(
-
1497 "Configured [crawl] section is invalid, too many values");
-
1498 }
-
1499
-
1500 bool crawlEnabled = true;
-
1501
-
1502 // Only allow "0|1" as a value
-
1503 if (values.size() == 1)
-
1504 {
-
1505 try
-
1506 {
-
1507 crawlEnabled = boost::lexical_cast<bool>(values.front());
-
1508 }
-
1509 catch (boost::bad_lexical_cast const&)
-
1510 {
-
1511 Throw<std::runtime_error>(
-
1512 "Configured [crawl] section has invalid value: " +
-
1513 values.front());
-
1514 }
-
1515 }
-
1516
-
1517 if (crawlEnabled)
-
1518 {
-
1519 if (get<bool>(section, "overlay", true))
-
1520 {
-
1521 setup.crawlOptions |= CrawlOptions::Overlay;
-
1522 }
-
1523 if (get<bool>(section, "server", true))
-
1524 {
-
1525 setup.crawlOptions |= CrawlOptions::ServerInfo;
-
1526 }
-
1527 if (get<bool>(section, "counts", false))
-
1528 {
-
1529 setup.crawlOptions |= CrawlOptions::ServerCounts;
-
1530 }
-
1531 if (get<bool>(section, "unl", true))
-
1532 {
-
1533 setup.crawlOptions |= CrawlOptions::Unl;
-
1534 }
-
1535 }
-
1536 }
-
1537 {
-
1538 auto const& section = config.section("vl");
-
1539
-
1540 set(setup.vlEnabled, "enabled", section);
-
1541 }
+
1464 slots_.deleteIdlePeers();
+
1465}
+
1466
+
1467//------------------------------------------------------------------------------
+
1468
+
1469Overlay::Setup
+
1470setup_Overlay(BasicConfig const& config)
+
1471{
+
1472 Overlay::Setup setup;
+
1473
+
1474 {
+
1475 auto const& section = config.section("overlay");
+
1476 setup.context = make_SSLContext("");
+
1477
+
1478 set(setup.ipLimit, "ip_limit", section);
+
1479 if (setup.ipLimit < 0)
+
1480 Throw<std::runtime_error>("Configured IP limit is invalid");
+
1481
+
1482 std::string ip;
+
1483 set(ip, "public_ip", section);
+
1484 if (!ip.empty())
+
1485 {
+
1486 boost::system::error_code ec;
+
1487 setup.public_ip = beast::IP::Address::from_string(ip, ec);
+
1488 if (ec || beast::IP::is_private(setup.public_ip))
+
1489 Throw<std::runtime_error>("Configured public IP is invalid");
+
1490 }
+
1491 }
+
1492
+
1493 {
+
1494 auto const& section = config.section("crawl");
+
1495 auto const& values = section.values();
+
1496
+
1497 if (values.size() > 1)
+
1498 {
+
1499 Throw<std::runtime_error>(
+
1500 "Configured [crawl] section is invalid, too many values");
+
1501 }
+
1502
+
1503 bool crawlEnabled = true;
+
1504
+
1505 // Only allow "0|1" as a value
+
1506 if (values.size() == 1)
+
1507 {
+
1508 try
+
1509 {
+
1510 crawlEnabled = boost::lexical_cast<bool>(values.front());
+
1511 }
+
1512 catch (boost::bad_lexical_cast const&)
+
1513 {
+
1514 Throw<std::runtime_error>(
+
1515 "Configured [crawl] section has invalid value: " +
+
1516 values.front());
+
1517 }
+
1518 }
+
1519
+
1520 if (crawlEnabled)
+
1521 {
+
1522 if (get<bool>(section, "overlay", true))
+
1523 {
+
1524 setup.crawlOptions |= CrawlOptions::Overlay;
+
1525 }
+
1526 if (get<bool>(section, "server", true))
+
1527 {
+
1528 setup.crawlOptions |= CrawlOptions::ServerInfo;
+
1529 }
+
1530 if (get<bool>(section, "counts", false))
+
1531 {
+
1532 setup.crawlOptions |= CrawlOptions::ServerCounts;
+
1533 }
+
1534 if (get<bool>(section, "unl", true))
+
1535 {
+
1536 setup.crawlOptions |= CrawlOptions::Unl;
+
1537 }
+
1538 }
+
1539 }
+
1540 {
+
1541 auto const& section = config.section("vl");
1542
-
1543 try
-
1544 {
-
1545 auto id = config.legacy("network_id");
-
1546
-
1547 if (!id.empty())
-
1548 {
-
1549 if (id == "main")
-
1550 id = "0";
-
1551
-
1552 if (id == "testnet")
-
1553 id = "1";
+
1543 set(setup.vlEnabled, "enabled", section);
+
1544 }
+
1545
+
1546 try
+
1547 {
+
1548 auto id = config.legacy("network_id");
+
1549
+
1550 if (!id.empty())
+
1551 {
+
1552 if (id == "main")
+
1553 id = "0";
1554
-
1555 if (id == "devnet")
-
1556 id = "2";
+
1555 if (id == "testnet")
+
1556 id = "1";
1557
-
1558 setup.networkID = beast::lexicalCastThrow<std::uint32_t>(id);
-
1559 }
-
1560 }
-
1561 catch (...)
-
1562 {
-
1563 Throw<std::runtime_error>(
-
1564 "Configured [network_id] section is invalid: must be a number "
-
1565 "or one of the strings 'main', 'testnet' or 'devnet'.");
-
1566 }
-
1567
-
1568 return setup;
-
1569}
+
1558 if (id == "devnet")
+
1559 id = "2";
+
1560
+
1561 setup.networkID = beast::lexicalCastThrow<std::uint32_t>(id);
+
1562 }
+
1563 }
+
1564 catch (...)
+
1565 {
+
1566 Throw<std::runtime_error>(
+
1567 "Configured [network_id] section is invalid: must be a number "
+
1568 "or one of the strings 'main', 'testnet' or 'devnet'.");
+
1569 }
1570
-
1571std::unique_ptr<Overlay>
-
1572make_Overlay(
-
1573 Application& app,
-
1574 Overlay::Setup const& setup,
-
1575 ServerHandler& serverHandler,
-
1576 Resource::Manager& resourceManager,
-
1577 Resolver& resolver,
-
1578 boost::asio::io_service& io_service,
-
1579 BasicConfig const& config,
-
1580 beast::insight::Collector::ptr const& collector)
-
1581{
-
1582 return std::make_unique<OverlayImpl>(
-
1583 app,
-
1584 setup,
-
1585 serverHandler,
-
1586 resourceManager,
-
1587 resolver,
-
1588 io_service,
-
1589 config,
-
1590 collector);
-
1591}
-
1592
-
1593} // namespace ripple
+
1571 return setup;
+
1572}
+
1573
+
1574std::unique_ptr<Overlay>
+
1575make_Overlay(
+
1576 Application& app,
+
1577 Overlay::Setup const& setup,
+
1578 ServerHandler& serverHandler,
+
1579 Resource::Manager& resourceManager,
+
1580 Resolver& resolver,
+
1581 boost::asio::io_service& io_service,
+
1582 BasicConfig const& config,
+
1583 beast::insight::Collector::ptr const& collector)
+
1584{
+
1585 return std::make_unique<OverlayImpl>(
+
1586 app,
+
1587 setup,
+
1588 serverHandler,
+
1589 resourceManager,
+
1590 resolver,
+
1591 io_service,
+
1592 config,
+
1593 collector);
+
1594}
+
1595
+
1596} // namespace ripple
std::ostringstream
std::string
std::string_view
@@ -1716,79 +1719,79 @@ $(function() {
ripple::OverlayImpl::Child::Child
Child(OverlayImpl &overlay)
Definition: OverlayImpl.cpp:58
ripple::OverlayImpl
Definition: OverlayImpl.h:62
ripple::OverlayImpl::error_code
boost::system::error_code error_code
Definition: OverlayImpl.h:83
-
ripple::OverlayImpl::getUnlInfo
Json::Value getUnlInfo()
Returns information about the local server's UNL.
Definition: OverlayImpl.cpp:795
-
ripple::OverlayImpl::stop
void stop() override
Definition: OverlayImpl.cpp:559
+
ripple::OverlayImpl::getUnlInfo
Json::Value getUnlInfo()
Returns information about the local server's UNL.
Definition: OverlayImpl.cpp:798
+
ripple::OverlayImpl::stop
void stop() override
Definition: OverlayImpl.cpp:562
ripple::OverlayImpl::makePrefix
static std::string makePrefix(std::uint32_t id)
Definition: OverlayImpl.cpp:337
ripple::OverlayImpl::peerFinder
PeerFinder::Manager & peerFinder()
Definition: OverlayImpl.h:161
ripple::OverlayImpl::endpoint_type
boost::asio::ip::tcp::endpoint endpoint_type
Definition: OverlayImpl.h:82
-
ripple::OverlayImpl::processHealth
bool processHealth(http_request_type const &req, Handoff &handoff)
Handles health requests.
Definition: OverlayImpl.cpp:942
+
ripple::OverlayImpl::processHealth
bool processHealth(http_request_type const &req, Handoff &handoff)
Handles health requests.
Definition: OverlayImpl.cpp:945
ripple::OverlayImpl::address_type
boost::asio::ip::address address_type
Definition: OverlayImpl.h:81
ripple::OverlayImpl::is_upgrade
static bool is_upgrade(boost::beast::http::header< true, Fields > const &req)
Definition: OverlayImpl.h:320
ripple::OverlayImpl::cond_
std::condition_variable_any cond_
Definition: OverlayImpl.h:107
-
ripple::OverlayImpl::onWrite
void onWrite(beast::PropertyStream::Map &stream) override
Subclass override.
Definition: OverlayImpl.cpp:576
-
ripple::OverlayImpl::deleteIdlePeers
void deleteIdlePeers()
Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.
Definition: OverlayImpl.cpp:1456
+
ripple::OverlayImpl::onWrite
void onWrite(beast::PropertyStream::Map &stream) override
Subclass override.
Definition: OverlayImpl.cpp:579
+
ripple::OverlayImpl::deleteIdlePeers
void deleteIdlePeers()
Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.
Definition: OverlayImpl.cpp:1459
ripple::OverlayImpl::m_resolver
Resolver & m_resolver
Definition: OverlayImpl.h:118
-
ripple::OverlayImpl::reportTraffic
void reportTraffic(TrafficCount::category cat, bool isInbound, int bytes)
Definition: OverlayImpl.cpp:690
-
ripple::OverlayImpl::activate
void activate(std::shared_ptr< PeerImp > const &peer)
Called when a peer has connected successfully This is called after the peer handshake has been comple...
Definition: OverlayImpl.cpp:601
-
ripple::OverlayImpl::getActivePeers
PeerSequence getActivePeers() const override
Returns a sequence representing the current list of peers.
Definition: OverlayImpl.cpp:1048
+
ripple::OverlayImpl::reportTraffic
void reportTraffic(TrafficCount::category cat, bool isInbound, int bytes)
Definition: OverlayImpl.cpp:693
+
ripple::OverlayImpl::activate
void activate(std::shared_ptr< PeerImp > const &peer)
Called when a peer has connected successfully This is called after the peer handshake has been comple...
Definition: OverlayImpl.cpp:604
+
ripple::OverlayImpl::getActivePeers
PeerSequence getActivePeers() const override
Returns a sequence representing the current list of peers.
Definition: OverlayImpl.cpp:1051
ripple::OverlayImpl::start
void start() override
Definition: OverlayImpl.cpp:478
ripple::OverlayImpl::m_peers
hash_map< std::shared_ptr< PeerFinder::Slot >, std::weak_ptr< PeerImp > > m_peers
Definition: OverlayImpl.h:116
ripple::OverlayImpl::add_active
void add_active(std::shared_ptr< PeerImp > const &peer)
Definition: OverlayImpl.cpp:430
-
ripple::OverlayImpl::findPeerByPublicKey
std::shared_ptr< Peer > findPeerByPublicKey(PublicKey const &pubKey) override
Returns the peer with the matching public key, or null.
Definition: OverlayImpl.cpp:1115
+
ripple::OverlayImpl::findPeerByPublicKey
std::shared_ptr< Peer > findPeerByPublicKey(PublicKey const &pubKey) override
Returns the peer with the matching public key, or null.
Definition: OverlayImpl.cpp:1118
ripple::OverlayImpl::m_resourceManager
Resource::Manager & m_resourceManager
Definition: OverlayImpl.h:113
-
ripple::OverlayImpl::stopChildren
void stopChildren()
Definition: OverlayImpl.cpp:1308
+
ripple::OverlayImpl::stopChildren
void stopChildren()
Definition: OverlayImpl.cpp:1311
ripple::OverlayImpl::manifestMessage_
std::shared_ptr< Message > manifestMessage_
Definition: OverlayImpl.h:131
ripple::OverlayImpl::manifestListSeq_
std::optional< std::uint32_t > manifestListSeq_
Definition: OverlayImpl.h:133
ripple::OverlayImpl::m_traffic
TrafficCount m_traffic
Definition: OverlayImpl.h:115
-
ripple::OverlayImpl::squelch
void squelch(PublicKey const &validator, Peer::id_t const id, std::uint32_t squelchDuration) const override
Squelch handler.
Definition: OverlayImpl.cpp:1401
+
ripple::OverlayImpl::squelch
void squelch(PublicKey const &validator, Peer::id_t const id, std::uint32_t squelchDuration) const override
Squelch handler.
Definition: OverlayImpl.cpp:1404
ripple::OverlayImpl::makeErrorResponse
std::shared_ptr< Writer > makeErrorResponse(std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remote_address, std::string msg)
Definition: OverlayImpl.cpp:372
ripple::OverlayImpl::slots_
reduce_relay::Slots< UptimeClock > slots_
Definition: OverlayImpl.h:125
-
ripple::OverlayImpl::deletePeer
void deletePeer(Peer::id_t id)
Called when the peer is deleted.
Definition: OverlayImpl.cpp:1447
-
ripple::OverlayImpl::findPeerByShortID
std::shared_ptr< Peer > findPeerByShortID(Peer::id_t const &id) const override
Returns the peer with the matching short id, or null.
Definition: OverlayImpl.cpp:1103
+
ripple::OverlayImpl::deletePeer
void deletePeer(Peer::id_t id)
Called when the peer is deleted.
Definition: OverlayImpl.cpp:1450
+
ripple::OverlayImpl::findPeerByShortID
std::shared_ptr< Peer > findPeerByShortID(Peer::id_t const &id) const override
Returns the peer with the matching short id, or null.
Definition: OverlayImpl.cpp:1106
ripple::OverlayImpl::next_id_
std::atomic< Peer::id_t > next_id_
Definition: OverlayImpl.h:119
ripple::OverlayImpl::io_service_
boost::asio::io_service & io_service_
Definition: OverlayImpl.h:103
ripple::OverlayImpl::app_
Application & app_
Definition: OverlayImpl.h:102
ripple::OverlayImpl::collect_metrics
void collect_metrics()
Definition: OverlayImpl.h:602
ripple::OverlayImpl::timer_
std::weak_ptr< Timer > timer_
Definition: OverlayImpl.h:108
ripple::OverlayImpl::txMetrics_
metrics::TxMetrics txMetrics_
Definition: OverlayImpl.h:128
-
ripple::OverlayImpl::broadcast
void broadcast(protocol::TMProposeSet &m) override
Broadcast a proposal.
Definition: OverlayImpl.cpp:1132
-
ripple::OverlayImpl::onPeerDeactivate
void onPeerDeactivate(Peer::id_t id)
Definition: OverlayImpl.cpp:627
+
ripple::OverlayImpl::broadcast
void broadcast(protocol::TMProposeSet &m) override
Broadcast a proposal.
Definition: OverlayImpl.cpp:1135
+
ripple::OverlayImpl::onPeerDeactivate
void onPeerDeactivate(Peer::id_t id)
Definition: OverlayImpl.cpp:630
ripple::OverlayImpl::manifestLock_
std::mutex manifestLock_
Definition: OverlayImpl.h:135
-
ripple::OverlayImpl::processRequest
bool processRequest(http_request_type const &req, Handoff &handoff)
Handles non-peer protocol requests.
Definition: OverlayImpl.cpp:1040
+
ripple::OverlayImpl::processRequest
bool processRequest(http_request_type const &req, Handoff &handoff)
Handles non-peer protocol requests.
Definition: OverlayImpl.cpp:1043
ripple::OverlayImpl::mutex_
std::recursive_mutex mutex_
Definition: OverlayImpl.h:106
-
ripple::OverlayImpl::sendEndpoints
void sendEndpoints()
Definition: OverlayImpl.cpp:1348
+
ripple::OverlayImpl::sendEndpoints
void sendEndpoints()
Definition: OverlayImpl.cpp:1351
ripple::OverlayImpl::remove
void remove(std::shared_ptr< PeerFinder::Slot > const &slot)
Definition: OverlayImpl.cpp:468
-
ripple::OverlayImpl::sendTxQueue
void sendTxQueue()
Send once a second transactions' hashes aggregated by peers.
Definition: OverlayImpl.cpp:1366
+
ripple::OverlayImpl::sendTxQueue
void sendTxQueue()
Send once a second transactions' hashes aggregated by peers.
Definition: OverlayImpl.cpp:1369
ripple::OverlayImpl::timer_count_
int timer_count_
Definition: OverlayImpl.h:120
-
ripple::OverlayImpl::relay
std::set< Peer::id_t > relay(protocol::TMProposeSet &m, uint256 const &uid, PublicKey const &validator) override
Relay a proposal.
Definition: OverlayImpl.cpp:1139
-
ripple::OverlayImpl::size
std::size_t size() const override
The number of active peers on the network Active peers are only those peers that have completed the h...
Definition: OverlayImpl.cpp:703
-
ripple::OverlayImpl::unsquelch
void unsquelch(PublicKey const &validator, Peer::id_t id) const override
Unsquelch handler.
Definition: OverlayImpl.cpp:1389
+
ripple::OverlayImpl::relay
std::set< Peer::id_t > relay(protocol::TMProposeSet &m, uint256 const &uid, PublicKey const &validator) override
Relay a proposal.
Definition: OverlayImpl.cpp:1142
+
ripple::OverlayImpl::size
std::size_t size() const override
The number of active peers on the network Active peers are only those peers that have completed the h...
Definition: OverlayImpl.cpp:706
+
ripple::OverlayImpl::unsquelch
void unsquelch(PublicKey const &validator, Peer::id_t id) const override
Unsquelch handler.
Definition: OverlayImpl.cpp:1392
ripple::OverlayImpl::makeRedirectResponse
std::shared_ptr< Writer > makeRedirectResponse(std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remote_address)
Definition: OverlayImpl.cpp:345
ripple::OverlayImpl::for_each
void for_each(UnaryFunc &&f) const
Definition: OverlayImpl.h:278
ripple::OverlayImpl::work_
std::optional< boost::asio::io_service::work > work_
Definition: OverlayImpl.h:104
-
ripple::OverlayImpl::getOverlayInfo
Json::Value getOverlayInfo()
Returns information about peers on the overlay network.
Definition: OverlayImpl.cpp:716
+
ripple::OverlayImpl::getOverlayInfo
Json::Value getOverlayInfo()
Returns information about peers on the overlay network.
Definition: OverlayImpl.cpp:719
ripple::OverlayImpl::resourceManager
Resource::Manager & resourceManager()
Definition: OverlayImpl.h:167
ripple::OverlayImpl::isPeerUpgrade
static bool isPeerUpgrade(http_request_type const &request)
Definition: OverlayImpl.cpp:328
-
ripple::OverlayImpl::getServerCounts
Json::Value getServerCounts()
Returns information about the local server's performance counters.
Definition: OverlayImpl.cpp:789
+
ripple::OverlayImpl::getServerCounts
Json::Value getServerCounts()
Returns information about the local server's performance counters.
Definition: OverlayImpl.cpp:792
ripple::OverlayImpl::strand_
boost::asio::io_service::strand strand_
Definition: OverlayImpl.h:105
-
ripple::OverlayImpl::onManifests
void onManifests(std::shared_ptr< protocol::TMManifests > const &m, std::shared_ptr< PeerImp > const &from)
Definition: OverlayImpl.cpp:634
+
ripple::OverlayImpl::onManifests
void onManifests(std::shared_ptr< protocol::TMManifests > const &m, std::shared_ptr< PeerImp > const &from)
Definition: OverlayImpl.cpp:637
ripple::OverlayImpl::m_peerFinder
std::unique_ptr< PeerFinder::Manager > m_peerFinder
Definition: OverlayImpl.h:114
ripple::OverlayImpl::connect
void connect(beast::IP::Endpoint const &remote_endpoint) override
Establish a peer connection to the specified endpoint.
Definition: OverlayImpl.cpp:392
ripple::OverlayImpl::onHandoff
Handoff onHandoff(std::unique_ptr< stream_type > &&bundle, http_request_type &&request, endpoint_type remote_endpoint) override
Conditionally accept an incoming HTTP request.
Definition: OverlayImpl.cpp:163
ripple::OverlayImpl::setup
Setup const & setup() const
Definition: OverlayImpl.h:173
-
ripple::OverlayImpl::autoConnect
void autoConnect()
Definition: OverlayImpl.cpp:1340
-
ripple::OverlayImpl::getManifestsMessage
std::shared_ptr< Message > getManifestsMessage()
Definition: OverlayImpl.cpp:1184
+
ripple::OverlayImpl::autoConnect
void autoConnect()
Definition: OverlayImpl.cpp:1343
+
ripple::OverlayImpl::getManifestsMessage
std::shared_ptr< Message > getManifestsMessage()
Definition: OverlayImpl.cpp:1187
ripple::OverlayImpl::m_stats
Stats m_stats
Definition: OverlayImpl.h:597
ripple::OverlayImpl::ids_
hash_map< Peer::id_t, std::weak_ptr< PeerImp > > ids_
Definition: OverlayImpl.h:117
-
ripple::OverlayImpl::getServerInfo
Json::Value getServerInfo()
Returns information about the local server.
Definition: OverlayImpl.cpp:761
-
ripple::OverlayImpl::processValidatorList
bool processValidatorList(http_request_type const &req, Handoff &handoff)
Handles validator list requests.
Definition: OverlayImpl.cpp:874
-
ripple::OverlayImpl::json
Json::Value json() override
Return diagnostics on the status of all peers.
Definition: OverlayImpl.cpp:826
-
ripple::OverlayImpl::checkTracking
void checkTracking(std::uint32_t) override
Calls the checkTracking function on each peer.
Definition: OverlayImpl.cpp:1096
+
ripple::OverlayImpl::getServerInfo
Json::Value getServerInfo()
Returns information about the local server.
Definition: OverlayImpl.cpp:764
+
ripple::OverlayImpl::processValidatorList
bool processValidatorList(http_request_type const &req, Handoff &handoff)
Handles validator list requests.
Definition: OverlayImpl.cpp:877
+
ripple::OverlayImpl::json
Json::Value json() override
Return diagnostics on the status of all peers.
Definition: OverlayImpl.cpp:829
+
ripple::OverlayImpl::checkTracking
void checkTracking(std::uint32_t) override
Calls the checkTracking function on each peer.
Definition: OverlayImpl.cpp:1099
ripple::OverlayImpl::serverHandler_
ServerHandler & serverHandler_
Definition: OverlayImpl.h:112
-
ripple::OverlayImpl::processCrawl
bool processCrawl(http_request_type const &req, Handoff &handoff)
Handles crawl requests.
Definition: OverlayImpl.cpp:837
+
ripple::OverlayImpl::processCrawl
bool processCrawl(http_request_type const &req, Handoff &handoff)
Handles crawl requests.
Definition: OverlayImpl.cpp:840
ripple::OverlayImpl::setup_
Setup setup_
Definition: OverlayImpl.h:110
-
ripple::OverlayImpl::limit
int limit() override
Returns the maximum number of peers we are configured to allow.
Definition: OverlayImpl.cpp:710
-
ripple::OverlayImpl::updateSlotAndSquelch
void updateSlotAndSquelch(uint256 const &key, PublicKey const &validator, std::set< Peer::id_t > &&peers, protocol::MessageType type)
Updates message count for validator/peer.
Definition: OverlayImpl.cpp:1414
+
ripple::OverlayImpl::limit
int limit() override
Returns the maximum number of peers we are configured to allow.
Definition: OverlayImpl.cpp:713
+
ripple::OverlayImpl::updateSlotAndSquelch
void updateSlotAndSquelch(uint256 const &key, PublicKey const &validator, std::set< Peer::id_t > &&peers, protocol::MessageType type)
Updates message count for validator/peer.
Definition: OverlayImpl.cpp:1417
ripple::OverlayImpl::OverlayImpl
OverlayImpl(Application &app, Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Definition: OverlayImpl.cpp:117
ripple::OverlayImpl::journal_
beast::Journal const journal_
Definition: OverlayImpl.h:111
ripple::OverlayImpl::list_
boost::container::flat_map< Child *, std::weak_ptr< Child > > list_
Definition: OverlayImpl.h:109
@@ -1851,7 +1854,7 @@ $(function() {
ripple::set
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:315
ripple::makeSharedValue
std::optional< uint256 > makeSharedValue(stream_type &ssl, beast::Journal journal)
Computes a shared value based on the SSL connection state.
Definition: Handshake.cpp:146
ripple::make_SSLContext
std::shared_ptr< boost::asio::ssl::context > make_SSLContext(std::string const &cipherList)
Create a self-signed SSL context that allows anonymous Diffie Hellman.
Definition: make_SSLContext.cpp:385
-
ripple::makeSquelchMessage
std::shared_ptr< Message > makeSquelchMessage(PublicKey const &validator, bool squelch, uint32_t squelchDuration)
Definition: OverlayImpl.cpp:1375
+
ripple::makeSquelchMessage
std::shared_ptr< Message > makeSquelchMessage(PublicKey const &validator, bool squelch, uint32_t squelchDuration)
Definition: OverlayImpl.cpp:1378
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
ripple::ManifestDisposition::accepted
@ accepted
Manifest is valid.
ripple::makeSlice
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition: Slice.h:244
@@ -1862,9 +1865,9 @@ $(function() {
ripple::to_string
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
ripple::verifyHandshake
PublicKey verifyHandshake(boost::beast::http::fields const &headers, ripple::uint256 const &sharedValue, std::optional< std::uint32_t > networkID, beast::IP::Address public_ip, beast::IP::Address remote, Application &app)
Validate header fields necessary for upgrading the link to the peer protocol.
Definition: Handshake.cpp:227
ripple::HashPrefix::manifest
@ manifest
Manifest.
-
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1467
+
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1470
ripple::squelch
constexpr Number squelch(Number const &x, Number const &limit) noexcept
Definition: Number.h:363
-
ripple::make_Overlay
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
Definition: OverlayImpl.cpp:1572
+
ripple::make_Overlay
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
Definition: OverlayImpl.cpp:1575
ripple::default_prng
beast::xor_shift_engine & default_prng()
Return the default random engine.
Definition: include/xrpl/basics/random.h:65
std::chrono
std
STL namespace.
diff --git a/OverlayImpl_8h_source.html b/OverlayImpl_8h_source.html index 83ed1bbd9e..dce3c12948 100644 --- a/OverlayImpl_8h_source.html +++ b/OverlayImpl_8h_source.html @@ -647,38 +647,38 @@ $(function() {
ripple::OverlayImpl::Child::overlay_
OverlayImpl & overlay_
Definition: OverlayImpl.h:67
ripple::OverlayImpl
Definition: OverlayImpl.h:62
ripple::OverlayImpl::error_code
boost::system::error_code error_code
Definition: OverlayImpl.h:83
-
ripple::OverlayImpl::getUnlInfo
Json::Value getUnlInfo()
Returns information about the local server's UNL.
Definition: OverlayImpl.cpp:795
-
ripple::OverlayImpl::stop
void stop() override
Definition: OverlayImpl.cpp:559
+
ripple::OverlayImpl::getUnlInfo
Json::Value getUnlInfo()
Returns information about the local server's UNL.
Definition: OverlayImpl.cpp:798
+
ripple::OverlayImpl::stop
void stop() override
Definition: OverlayImpl.cpp:562
ripple::OverlayImpl::makePrefix
static std::string makePrefix(std::uint32_t id)
Definition: OverlayImpl.cpp:337
ripple::OverlayImpl::peerFinder
PeerFinder::Manager & peerFinder()
Definition: OverlayImpl.h:161
ripple::OverlayImpl::endpoint_type
boost::asio::ip::tcp::endpoint endpoint_type
Definition: OverlayImpl.h:82
ripple::OverlayImpl::peerDisconnects_
std::atomic< uint64_t > peerDisconnects_
Definition: OverlayImpl.h:122
-
ripple::OverlayImpl::processHealth
bool processHealth(http_request_type const &req, Handoff &handoff)
Handles health requests.
Definition: OverlayImpl.cpp:942
+
ripple::OverlayImpl::processHealth
bool processHealth(http_request_type const &req, Handoff &handoff)
Handles health requests.
Definition: OverlayImpl.cpp:945
ripple::OverlayImpl::address_type
boost::asio::ip::address address_type
Definition: OverlayImpl.h:81
ripple::OverlayImpl::is_upgrade
static bool is_upgrade(boost::beast::http::header< true, Fields > const &req)
Definition: OverlayImpl.h:320
ripple::OverlayImpl::cond_
std::condition_variable_any cond_
Definition: OverlayImpl.h:107
-
ripple::OverlayImpl::onWrite
void onWrite(beast::PropertyStream::Map &stream) override
Subclass override.
Definition: OverlayImpl.cpp:576
+
ripple::OverlayImpl::onWrite
void onWrite(beast::PropertyStream::Map &stream) override
Subclass override.
Definition: OverlayImpl.cpp:579
ripple::OverlayImpl::txMetrics
Json::Value txMetrics() const override
Returns tx reduce-relay metrics.
Definition: OverlayImpl.h:426
-
ripple::OverlayImpl::deleteIdlePeers
void deleteIdlePeers()
Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.
Definition: OverlayImpl.cpp:1456
+
ripple::OverlayImpl::deleteIdlePeers
void deleteIdlePeers()
Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.
Definition: OverlayImpl.cpp:1459
ripple::OverlayImpl::m_resolver
Resolver & m_resolver
Definition: OverlayImpl.h:118
-
ripple::OverlayImpl::reportTraffic
void reportTraffic(TrafficCount::category cat, bool isInbound, int bytes)
Definition: OverlayImpl.cpp:690
-
ripple::OverlayImpl::activate
void activate(std::shared_ptr< PeerImp > const &peer)
Called when a peer has connected successfully This is called after the peer handshake has been comple...
Definition: OverlayImpl.cpp:601
-
ripple::OverlayImpl::getActivePeers
PeerSequence getActivePeers() const override
Returns a sequence representing the current list of peers.
Definition: OverlayImpl.cpp:1048
+
ripple::OverlayImpl::reportTraffic
void reportTraffic(TrafficCount::category cat, bool isInbound, int bytes)
Definition: OverlayImpl.cpp:693
+
ripple::OverlayImpl::activate
void activate(std::shared_ptr< PeerImp > const &peer)
Called when a peer has connected successfully This is called after the peer handshake has been comple...
Definition: OverlayImpl.cpp:604
+
ripple::OverlayImpl::getActivePeers
PeerSequence getActivePeers() const override
Returns a sequence representing the current list of peers.
Definition: OverlayImpl.cpp:1051
ripple::OverlayImpl::start
void start() override
Definition: OverlayImpl.cpp:478
ripple::OverlayImpl::m_peers
hash_map< std::shared_ptr< PeerFinder::Slot >, std::weak_ptr< PeerImp > > m_peers
Definition: OverlayImpl.h:116
ripple::OverlayImpl::add_active
void add_active(std::shared_ptr< PeerImp > const &peer)
Definition: OverlayImpl.cpp:430
-
ripple::OverlayImpl::findPeerByPublicKey
std::shared_ptr< Peer > findPeerByPublicKey(PublicKey const &pubKey) override
Returns the peer with the matching public key, or null.
Definition: OverlayImpl.cpp:1115
+
ripple::OverlayImpl::findPeerByPublicKey
std::shared_ptr< Peer > findPeerByPublicKey(PublicKey const &pubKey) override
Returns the peer with the matching public key, or null.
Definition: OverlayImpl.cpp:1118
ripple::OverlayImpl::m_resourceManager
Resource::Manager & m_resourceManager
Definition: OverlayImpl.h:113
-
ripple::OverlayImpl::stopChildren
void stopChildren()
Definition: OverlayImpl.cpp:1308
+
ripple::OverlayImpl::stopChildren
void stopChildren()
Definition: OverlayImpl.cpp:1311
ripple::OverlayImpl::manifestMessage_
std::shared_ptr< Message > manifestMessage_
Definition: OverlayImpl.h:131
ripple::OverlayImpl::manifestListSeq_
std::optional< std::uint32_t > manifestListSeq_
Definition: OverlayImpl.h:133
ripple::OverlayImpl::operator=
OverlayImpl & operator=(OverlayImpl const &)=delete
ripple::OverlayImpl::m_traffic
TrafficCount m_traffic
Definition: OverlayImpl.h:115
-
ripple::OverlayImpl::squelch
void squelch(PublicKey const &validator, Peer::id_t const id, std::uint32_t squelchDuration) const override
Squelch handler.
Definition: OverlayImpl.cpp:1401
+
ripple::OverlayImpl::squelch
void squelch(PublicKey const &validator, Peer::id_t const id, std::uint32_t squelchDuration) const override
Squelch handler.
Definition: OverlayImpl.cpp:1404
ripple::OverlayImpl::makeErrorResponse
std::shared_ptr< Writer > makeErrorResponse(std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remote_address, std::string msg)
Definition: OverlayImpl.cpp:372
ripple::OverlayImpl::slots_
reduce_relay::Slots< UptimeClock > slots_
Definition: OverlayImpl.h:125
-
ripple::OverlayImpl::deletePeer
void deletePeer(Peer::id_t id)
Called when the peer is deleted.
Definition: OverlayImpl.cpp:1447
-
ripple::OverlayImpl::findPeerByShortID
std::shared_ptr< Peer > findPeerByShortID(Peer::id_t const &id) const override
Returns the peer with the matching short id, or null.
Definition: OverlayImpl.cpp:1103
+
ripple::OverlayImpl::deletePeer
void deletePeer(Peer::id_t id)
Called when the peer is deleted.
Definition: OverlayImpl.cpp:1450
+
ripple::OverlayImpl::findPeerByShortID
std::shared_ptr< Peer > findPeerByShortID(Peer::id_t const &id) const override
Returns the peer with the matching short id, or null.
Definition: OverlayImpl.cpp:1106
ripple::OverlayImpl::next_id_
std::atomic< Peer::id_t > next_id_
Definition: OverlayImpl.h:119
ripple::OverlayImpl::incPeerDisconnect
void incPeerDisconnect() override
Increment and retrieve counters for total peer disconnects, and disconnects we initiate for excessive...
Definition: OverlayImpl.h:363
ripple::OverlayImpl::io_service_
boost::asio::io_service & io_service_
Definition: OverlayImpl.h:103
@@ -689,53 +689,53 @@ $(function() {
ripple::OverlayImpl::timer_
std::weak_ptr< Timer > timer_
Definition: OverlayImpl.h:108
ripple::OverlayImpl::jqTransOverflow_
std::atomic< uint64_t > jqTransOverflow_
Definition: OverlayImpl.h:121
ripple::OverlayImpl::txMetrics_
metrics::TxMetrics txMetrics_
Definition: OverlayImpl.h:128
-
ripple::OverlayImpl::broadcast
void broadcast(protocol::TMProposeSet &m) override
Broadcast a proposal.
Definition: OverlayImpl.cpp:1132
-
ripple::OverlayImpl::onPeerDeactivate
void onPeerDeactivate(Peer::id_t id)
Definition: OverlayImpl.cpp:627
+
ripple::OverlayImpl::broadcast
void broadcast(protocol::TMProposeSet &m) override
Broadcast a proposal.
Definition: OverlayImpl.cpp:1135
+
ripple::OverlayImpl::onPeerDeactivate
void onPeerDeactivate(Peer::id_t id)
Definition: OverlayImpl.cpp:630
ripple::OverlayImpl::manifestLock_
std::mutex manifestLock_
Definition: OverlayImpl.h:135
-
ripple::OverlayImpl::processRequest
bool processRequest(http_request_type const &req, Handoff &handoff)
Handles non-peer protocol requests.
Definition: OverlayImpl.cpp:1040
+
ripple::OverlayImpl::processRequest
bool processRequest(http_request_type const &req, Handoff &handoff)
Handles non-peer protocol requests.
Definition: OverlayImpl.cpp:1043
ripple::OverlayImpl::mutex_
std::recursive_mutex mutex_
Definition: OverlayImpl.h:106
ripple::OverlayImpl::getPeerDisconnectCharges
std::uint64_t getPeerDisconnectCharges() const override
Definition: OverlayImpl.h:381
-
ripple::OverlayImpl::sendEndpoints
void sendEndpoints()
Definition: OverlayImpl.cpp:1348
+
ripple::OverlayImpl::sendEndpoints
void sendEndpoints()
Definition: OverlayImpl.cpp:1351
ripple::OverlayImpl::socket_type
boost::asio::ip::tcp::socket socket_type
Definition: OverlayImpl.h:80
ripple::OverlayImpl::remove
void remove(std::shared_ptr< PeerFinder::Slot > const &slot)
Definition: OverlayImpl.cpp:468
-
ripple::OverlayImpl::sendTxQueue
void sendTxQueue()
Send once a second transactions' hashes aggregated by peers.
Definition: OverlayImpl.cpp:1366
+
ripple::OverlayImpl::sendTxQueue
void sendTxQueue()
Send once a second transactions' hashes aggregated by peers.
Definition: OverlayImpl.cpp:1369
ripple::OverlayImpl::timer_count_
int timer_count_
Definition: OverlayImpl.h:120
-
ripple::OverlayImpl::relay
std::set< Peer::id_t > relay(protocol::TMProposeSet &m, uint256 const &uid, PublicKey const &validator) override
Relay a proposal.
Definition: OverlayImpl.cpp:1139
-
ripple::OverlayImpl::size
std::size_t size() const override
The number of active peers on the network Active peers are only those peers that have completed the h...
Definition: OverlayImpl.cpp:703
-
ripple::OverlayImpl::unsquelch
void unsquelch(PublicKey const &validator, Peer::id_t id) const override
Unsquelch handler.
Definition: OverlayImpl.cpp:1389
+
ripple::OverlayImpl::relay
std::set< Peer::id_t > relay(protocol::TMProposeSet &m, uint256 const &uid, PublicKey const &validator) override
Relay a proposal.
Definition: OverlayImpl.cpp:1142
+
ripple::OverlayImpl::size
std::size_t size() const override
The number of active peers on the network Active peers are only those peers that have completed the h...
Definition: OverlayImpl.cpp:706
+
ripple::OverlayImpl::unsquelch
void unsquelch(PublicKey const &validator, Peer::id_t id) const override
Unsquelch handler.
Definition: OverlayImpl.cpp:1392
ripple::OverlayImpl::makeRedirectResponse
std::shared_ptr< Writer > makeRedirectResponse(std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remote_address)
Definition: OverlayImpl.cpp:345
ripple::OverlayImpl::for_each
void for_each(UnaryFunc &&f) const
Definition: OverlayImpl.h:278
ripple::OverlayImpl::isPeerUpgrade
static bool isPeerUpgrade(boost::beast::http::response< Body > const &response)
Definition: OverlayImpl.h:310
ripple::OverlayImpl::work_
std::optional< boost::asio::io_service::work > work_
Definition: OverlayImpl.h:104
ripple::OverlayImpl::OverlayImpl
OverlayImpl(OverlayImpl const &)=delete
-
ripple::OverlayImpl::getOverlayInfo
Json::Value getOverlayInfo()
Returns information about peers on the overlay network.
Definition: OverlayImpl.cpp:716
+
ripple::OverlayImpl::getOverlayInfo
Json::Value getOverlayInfo()
Returns information about peers on the overlay network.
Definition: OverlayImpl.cpp:719
ripple::OverlayImpl::resourceManager
Resource::Manager & resourceManager()
Definition: OverlayImpl.h:167
ripple::OverlayImpl::isPeerUpgrade
static bool isPeerUpgrade(http_request_type const &request)
Definition: OverlayImpl.cpp:328
-
ripple::OverlayImpl::getServerCounts
Json::Value getServerCounts()
Returns information about the local server's performance counters.
Definition: OverlayImpl.cpp:789
+
ripple::OverlayImpl::getServerCounts
Json::Value getServerCounts()
Returns information about the local server's performance counters.
Definition: OverlayImpl.cpp:792
ripple::OverlayImpl::strand_
boost::asio::io_service::strand strand_
Definition: OverlayImpl.h:105
-
ripple::OverlayImpl::onManifests
void onManifests(std::shared_ptr< protocol::TMManifests > const &m, std::shared_ptr< PeerImp > const &from)
Definition: OverlayImpl.cpp:634
+
ripple::OverlayImpl::onManifests
void onManifests(std::shared_ptr< protocol::TMManifests > const &m, std::shared_ptr< PeerImp > const &from)
Definition: OverlayImpl.cpp:637
ripple::OverlayImpl::m_peerFinder
std::unique_ptr< PeerFinder::Manager > m_peerFinder
Definition: OverlayImpl.h:114
ripple::OverlayImpl::getJqTransOverflow
std::uint64_t getJqTransOverflow() const override
Definition: OverlayImpl.h:357
ripple::OverlayImpl::connect
void connect(beast::IP::Endpoint const &remote_endpoint) override
Establish a peer connection to the specified endpoint.
Definition: OverlayImpl.cpp:392
ripple::OverlayImpl::onHandoff
Handoff onHandoff(std::unique_ptr< stream_type > &&bundle, http_request_type &&request, endpoint_type remote_endpoint) override
Conditionally accept an incoming HTTP request.
Definition: OverlayImpl.cpp:163
ripple::OverlayImpl::setup
Setup const & setup() const
Definition: OverlayImpl.h:173
-
ripple::OverlayImpl::autoConnect
void autoConnect()
Definition: OverlayImpl.cpp:1340
+
ripple::OverlayImpl::autoConnect
void autoConnect()
Definition: OverlayImpl.cpp:1343
ripple::OverlayImpl::peerDisconnectsCharges_
std::atomic< uint64_t > peerDisconnectsCharges_
Definition: OverlayImpl.h:123
-
ripple::OverlayImpl::getManifestsMessage
std::shared_ptr< Message > getManifestsMessage()
Definition: OverlayImpl.cpp:1184
+
ripple::OverlayImpl::getManifestsMessage
std::shared_ptr< Message > getManifestsMessage()
Definition: OverlayImpl.cpp:1187
ripple::OverlayImpl::m_stats
Stats m_stats
Definition: OverlayImpl.h:597
ripple::OverlayImpl::ids_
hash_map< Peer::id_t, std::weak_ptr< PeerImp > > ids_
Definition: OverlayImpl.h:117
-
ripple::OverlayImpl::getServerInfo
Json::Value getServerInfo()
Returns information about the local server.
Definition: OverlayImpl.cpp:761
-
ripple::OverlayImpl::processValidatorList
bool processValidatorList(http_request_type const &req, Handoff &handoff)
Handles validator list requests.
Definition: OverlayImpl.cpp:874
-
ripple::OverlayImpl::json
Json::Value json() override
Return diagnostics on the status of all peers.
Definition: OverlayImpl.cpp:826
+
ripple::OverlayImpl::getServerInfo
Json::Value getServerInfo()
Returns information about the local server.
Definition: OverlayImpl.cpp:764
+
ripple::OverlayImpl::processValidatorList
bool processValidatorList(http_request_type const &req, Handoff &handoff)
Handles validator list requests.
Definition: OverlayImpl.cpp:877
+
ripple::OverlayImpl::json
Json::Value json() override
Return diagnostics on the status of all peers.
Definition: OverlayImpl.cpp:829
ripple::OverlayImpl::m_statsMutex
std::mutex m_statsMutex
Definition: OverlayImpl.h:598
-
ripple::OverlayImpl::checkTracking
void checkTracking(std::uint32_t) override
Calls the checkTracking function on each peer.
Definition: OverlayImpl.cpp:1096
+
ripple::OverlayImpl::checkTracking
void checkTracking(std::uint32_t) override
Calls the checkTracking function on each peer.
Definition: OverlayImpl.cpp:1099
ripple::OverlayImpl::incPeerDisconnectCharges
void incPeerDisconnectCharges() override
Definition: OverlayImpl.h:375
ripple::OverlayImpl::serverHandler_
ServerHandler & serverHandler_
Definition: OverlayImpl.h:112
-
ripple::OverlayImpl::processCrawl
bool processCrawl(http_request_type const &req, Handoff &handoff)
Handles crawl requests.
Definition: OverlayImpl.cpp:837
+
ripple::OverlayImpl::processCrawl
bool processCrawl(http_request_type const &req, Handoff &handoff)
Handles crawl requests.
Definition: OverlayImpl.cpp:840
ripple::OverlayImpl::setup_
Setup setup_
Definition: OverlayImpl.h:110
ripple::OverlayImpl::is_upgrade
static bool is_upgrade(boost::beast::http::header< false, Fields > const &req)
Definition: OverlayImpl.h:334
-
ripple::OverlayImpl::limit
int limit() override
Returns the maximum number of peers we are configured to allow.
Definition: OverlayImpl.cpp:710
-
ripple::OverlayImpl::updateSlotAndSquelch
void updateSlotAndSquelch(uint256 const &key, PublicKey const &validator, std::set< Peer::id_t > &&peers, protocol::MessageType type)
Updates message count for validator/peer.
Definition: OverlayImpl.cpp:1414
+
ripple::OverlayImpl::limit
int limit() override
Returns the maximum number of peers we are configured to allow.
Definition: OverlayImpl.cpp:713
+
ripple::OverlayImpl::updateSlotAndSquelch
void updateSlotAndSquelch(uint256 const &key, PublicKey const &validator, std::set< Peer::id_t > &&peers, protocol::MessageType type)
Updates message count for validator/peer.
Definition: OverlayImpl.cpp:1417
ripple::OverlayImpl::incJqTransOverflow
void incJqTransOverflow() override
Increment and retrieve counter for transaction job queue overflows.
Definition: OverlayImpl.h:351
ripple::OverlayImpl::journal_
beast::Journal const journal_
Definition: OverlayImpl.h:111
ripple::OverlayImpl::list_
boost::container::flat_map< Child *, std::weak_ptr< Child > > list_
Definition: OverlayImpl.h:109
diff --git a/PeerImp_8cpp_source.html b/PeerImp_8cpp_source.html index 658f9061bb..93486d14c3 100644 --- a/PeerImp_8cpp_source.html +++ b/PeerImp_8cpp_source.html @@ -3619,18 +3619,18 @@ $(function() {
ripple::NetworkOPs::isNeedNetworkLedger
virtual bool isNeedNetworkLedger()=0
ripple::OverlayImpl
Definition: OverlayImpl.h:62
ripple::OverlayImpl::peerFinder
PeerFinder::Manager & peerFinder()
Definition: OverlayImpl.h:161
-
ripple::OverlayImpl::reportTraffic
void reportTraffic(TrafficCount::category cat, bool isInbound, int bytes)
Definition: OverlayImpl.cpp:690
-
ripple::OverlayImpl::activate
void activate(std::shared_ptr< PeerImp > const &peer)
Called when a peer has connected successfully This is called after the peer handshake has been comple...
Definition: OverlayImpl.cpp:601
-
ripple::OverlayImpl::deletePeer
void deletePeer(Peer::id_t id)
Called when the peer is deleted.
Definition: OverlayImpl.cpp:1447
+
ripple::OverlayImpl::reportTraffic
void reportTraffic(TrafficCount::category cat, bool isInbound, int bytes)
Definition: OverlayImpl.cpp:693
+
ripple::OverlayImpl::activate
void activate(std::shared_ptr< PeerImp > const &peer)
Called when a peer has connected successfully This is called after the peer handshake has been comple...
Definition: OverlayImpl.cpp:604
+
ripple::OverlayImpl::deletePeer
void deletePeer(Peer::id_t id)
Called when the peer is deleted.
Definition: OverlayImpl.cpp:1450
ripple::OverlayImpl::incPeerDisconnect
void incPeerDisconnect() override
Increment and retrieve counters for total peer disconnects, and disconnects we initiate for excessive...
Definition: OverlayImpl.h:363
ripple::OverlayImpl::addTxMetrics
void addTxMetrics(Args... args)
Add tx reduce-relay metrics.
Definition: OverlayImpl.h:434
-
ripple::OverlayImpl::onPeerDeactivate
void onPeerDeactivate(Peer::id_t id)
Definition: OverlayImpl.cpp:627
+
ripple::OverlayImpl::onPeerDeactivate
void onPeerDeactivate(Peer::id_t id)
Definition: OverlayImpl.cpp:630
ripple::OverlayImpl::remove
void remove(std::shared_ptr< PeerFinder::Slot > const &slot)
Definition: OverlayImpl.cpp:468
ripple::OverlayImpl::for_each
void for_each(UnaryFunc &&f) const
Definition: OverlayImpl.h:278
ripple::OverlayImpl::resourceManager
Resource::Manager & resourceManager()
Definition: OverlayImpl.h:167
-
ripple::OverlayImpl::onManifests
void onManifests(std::shared_ptr< protocol::TMManifests > const &m, std::shared_ptr< PeerImp > const &from)
Definition: OverlayImpl.cpp:634
+
ripple::OverlayImpl::onManifests
void onManifests(std::shared_ptr< protocol::TMManifests > const &m, std::shared_ptr< PeerImp > const &from)
Definition: OverlayImpl.cpp:637
ripple::OverlayImpl::setup
Setup const & setup() const
Definition: OverlayImpl.h:173
-
ripple::OverlayImpl::getManifestsMessage
std::shared_ptr< Message > getManifestsMessage()
Definition: OverlayImpl.cpp:1184
+
ripple::OverlayImpl::getManifestsMessage
std::shared_ptr< Message > getManifestsMessage()
Definition: OverlayImpl.cpp:1187
ripple::OverlayImpl::incPeerDisconnectCharges
void incPeerDisconnectCharges() override
Definition: OverlayImpl.h:375
ripple::OverlayImpl::incJqTransOverflow
void incJqTransOverflow() override
Increment and retrieve counter for transaction job queue overflows.
Definition: OverlayImpl.h:351
ripple::PeerFinder::Manager::on_endpoints
virtual void on_endpoints(std::shared_ptr< Slot > const &slot, Endpoints const &endpoints)=0
Called when mtENDPOINTS is received.
diff --git a/ServerHandler_8cpp_source.html b/ServerHandler_8cpp_source.html index 0a74cee7ea..4288cb01a2 100644 --- a/ServerHandler_8cpp_source.html +++ b/ServerHandler_8cpp_source.html @@ -1508,7 +1508,7 @@ $(function() {
ripple::setup_Client
static void setup_Client(ServerHandler::Setup &setup)
Definition: ServerHandler.cpp:1217
ripple::make_SSLContextAuthed
std::shared_ptr< boost::asio::ssl::context > make_SSLContextAuthed(std::string const &keyFile, std::string const &certFile, std::string const &chainFile, std::string const &cipherList)
Create an authenticated SSL context using the specified files.
Definition: make_SSLContext.cpp:396
ripple::make_Server
std::unique_ptr< Server > make_Server(Handler &handler, boost::asio::io_service &io_service, beast::Journal journal)
Create the HTTP server using the specified handler.
Definition: Server.h:35
-
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1467
+
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1470
ripple::Role::GUEST
@ GUEST
ripple::Role::FORBID
@ FORBID
ripple::jtCLIENT_RPC
@ jtCLIENT_RPC
Definition: Job.h:50
diff --git a/classripple_1_1OverlayImpl.html b/classripple_1_1OverlayImpl.html index 9f9d3772f3..5435cacc35 100644 --- a/classripple_1_1OverlayImpl.html +++ b/classripple_1_1OverlayImpl.html @@ -874,7 +874,7 @@ Private Attributes

Reimplemented from ripple::Overlay.

-

Definition at line 559 of file OverlayImpl.cpp.

+

Definition at line 562 of file OverlayImpl.cpp.

@@ -1043,7 +1043,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 710 of file OverlayImpl.cpp.

+

Definition at line 713 of file OverlayImpl.cpp.

@@ -1074,7 +1074,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 703 of file OverlayImpl.cpp.

+

Definition at line 706 of file OverlayImpl.cpp.

@@ -1105,7 +1105,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 826 of file OverlayImpl.cpp.

+

Definition at line 829 of file OverlayImpl.cpp.

@@ -1137,7 +1137,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 1048 of file OverlayImpl.cpp.

+

Definition at line 1051 of file OverlayImpl.cpp.

@@ -1191,7 +1191,7 @@ Private Attributes
Returns
active peers less peers in toSkip
-

Definition at line 1061 of file OverlayImpl.cpp.

+

Definition at line 1064 of file OverlayImpl.cpp.

@@ -1229,7 +1229,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 1096 of file OverlayImpl.cpp.

+

Definition at line 1099 of file OverlayImpl.cpp.

@@ -1261,7 +1261,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 1103 of file OverlayImpl.cpp.

+

Definition at line 1106 of file OverlayImpl.cpp.

@@ -1293,7 +1293,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 1115 of file OverlayImpl.cpp.

+

Definition at line 1118 of file OverlayImpl.cpp.

@@ -1325,7 +1325,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 1132 of file OverlayImpl.cpp.

+

Definition at line 1135 of file OverlayImpl.cpp.

@@ -1357,7 +1357,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 1158 of file OverlayImpl.cpp.

+

Definition at line 1161 of file OverlayImpl.cpp.

@@ -1414,7 +1414,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 1139 of file OverlayImpl.cpp.

+

Definition at line 1142 of file OverlayImpl.cpp.

@@ -1471,7 +1471,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 1165 of file OverlayImpl.cpp.

+

Definition at line 1168 of file OverlayImpl.cpp.

@@ -1527,7 +1527,7 @@ Private Attributes

Implements ripple::Overlay.

-

Definition at line 1214 of file OverlayImpl.cpp.

+

Definition at line 1217 of file OverlayImpl.cpp.

@@ -1546,7 +1546,7 @@ Private Attributes
-

Definition at line 1184 of file OverlayImpl.cpp.

+

Definition at line 1187 of file OverlayImpl.cpp.

@@ -1610,7 +1610,7 @@ Private Attributes

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 are known.

-

Definition at line 601 of file OverlayImpl.cpp.

+

Definition at line 604 of file OverlayImpl.cpp.

@@ -1630,7 +1630,7 @@ Private Attributes
-

Definition at line 627 of file OverlayImpl.cpp.

+

Definition at line 630 of file OverlayImpl.cpp.

@@ -1682,7 +1682,7 @@ template<class UnaryFunc >
-

Definition at line 634 of file OverlayImpl.cpp.

+

Definition at line 637 of file OverlayImpl.cpp.

@@ -1864,7 +1864,7 @@ template<class Fields >
-

Definition at line 690 of file OverlayImpl.cpp.

+

Definition at line 693 of file OverlayImpl.cpp.

@@ -2128,7 +2128,7 @@ template<class Fields > -

Definition at line 1414 of file OverlayImpl.cpp.

+

Definition at line 1417 of file OverlayImpl.cpp.

@@ -2172,7 +2172,7 @@ template<class Fields >

Overload to reduce allocation in case of single peer.

-

Definition at line 1432 of file OverlayImpl.cpp.

+

Definition at line 1435 of file OverlayImpl.cpp.

@@ -2200,7 +2200,7 @@ template<class Fields > -

Definition at line 1447 of file OverlayImpl.cpp.

+

Definition at line 1450 of file OverlayImpl.cpp.

@@ -2312,7 +2312,7 @@ template<typename... Args>

Implements ripple::reduce_relay::SquelchHandler.

-

Definition at line 1401 of file OverlayImpl.cpp.

+

Definition at line 1404 of file OverlayImpl.cpp.

@@ -2361,7 +2361,7 @@ template<typename... Args>

Implements ripple::reduce_relay::SquelchHandler.

-

Definition at line 1389 of file OverlayImpl.cpp.

+

Definition at line 1392 of file OverlayImpl.cpp.

@@ -2497,7 +2497,7 @@ template<typename... Args>

Crawl returns information about the node and its peers so crawlers can map the network.

Returns
true if the request was handled.
-

Definition at line 837 of file OverlayImpl.cpp.

+

Definition at line 840 of file OverlayImpl.cpp.

@@ -2539,7 +2539,7 @@ template<typename... Args>

Using a /vl/<hex-encoded public key> URL, will retrieve the latest valdiator list (or UNL) that this node has for that public key, if the node trusts that public key.

Returns
true if the request was handled.
-

Definition at line 874 of file OverlayImpl.cpp.

+

Definition at line 877 of file OverlayImpl.cpp.

@@ -2581,7 +2581,7 @@ template<typename... Args>

Health returns information about the health of the node.

Returns
true if the request was handled.
-

Definition at line 942 of file OverlayImpl.cpp.

+

Definition at line 945 of file OverlayImpl.cpp.

@@ -2622,7 +2622,7 @@ template<typename... Args>

Handles non-peer protocol requests.

Returns
true if the request was handled.
-

Definition at line 1040 of file OverlayImpl.cpp.

+

Definition at line 1043 of file OverlayImpl.cpp.

@@ -2652,7 +2652,7 @@ template<typename... Args>

Returns information about peers on the overlay network.

Reported through the /crawl API Controlled through the config section [crawl] overlay=[0|1]

-

Definition at line 716 of file OverlayImpl.cpp.

+

Definition at line 719 of file OverlayImpl.cpp.

@@ -2682,7 +2682,7 @@ template<typename... Args>

Returns information about the local server.

Reported through the /crawl API Controlled through the config section [crawl] server=[0|1]

-

Definition at line 761 of file OverlayImpl.cpp.

+

Definition at line 764 of file OverlayImpl.cpp.

@@ -2712,7 +2712,7 @@ template<typename... Args>

Returns information about the local server's performance counters.

Reported through the /crawl API Controlled through the config section [crawl] counts=[0|1]

-

Definition at line 789 of file OverlayImpl.cpp.

+

Definition at line 792 of file OverlayImpl.cpp.

@@ -2742,7 +2742,7 @@ template<typename... Args>

Returns information about the local server's UNL.

Reported through the /crawl API Controlled through the config section [crawl] unl=[0|1]

-

Definition at line 795 of file OverlayImpl.cpp.

+

Definition at line 798 of file OverlayImpl.cpp.

@@ -2775,7 +2775,7 @@ template<typename... Args>

Reimplemented from beast::PropertyStream::Source.

-

Definition at line 576 of file OverlayImpl.cpp.

+

Definition at line 579 of file OverlayImpl.cpp.

@@ -2803,7 +2803,7 @@ template<typename... Args>
-

Definition at line 1299 of file OverlayImpl.cpp.

+

Definition at line 1302 of file OverlayImpl.cpp.

@@ -2830,7 +2830,7 @@ template<typename... Args>
-

Definition at line 1308 of file OverlayImpl.cpp.

+

Definition at line 1311 of file OverlayImpl.cpp.

@@ -2857,7 +2857,7 @@ template<typename... Args>
-

Definition at line 1340 of file OverlayImpl.cpp.

+

Definition at line 1343 of file OverlayImpl.cpp.

@@ -2884,7 +2884,7 @@ template<typename... Args>
-

Definition at line 1348 of file OverlayImpl.cpp.

+

Definition at line 1351 of file OverlayImpl.cpp.

@@ -2913,7 +2913,7 @@ template<typename... Args>

Send once a second transactions' hashes aggregated by peers.

-

Definition at line 1366 of file OverlayImpl.cpp.

+

Definition at line 1369 of file OverlayImpl.cpp.

@@ -2942,7 +2942,7 @@ template<typename... Args>

Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.

-

Definition at line 1456 of file OverlayImpl.cpp.

+

Definition at line 1459 of file OverlayImpl.cpp.

diff --git a/make__Overlay_8h_source.html b/make__Overlay_8h_source.html index 4f95e8945e..99f7091499 100644 --- a/make__Overlay_8h_source.html +++ b/make__Overlay_8h_source.html @@ -125,8 +125,8 @@ $(function() {
48
49#endif
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
-
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1467
-
ripple::make_Overlay
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
Definition: OverlayImpl.cpp:1572
+
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1470
+
ripple::make_Overlay
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
Definition: OverlayImpl.cpp:1575
std::shared_ptr< Collector >
std::unique_ptr
diff --git a/namespaceripple.html b/namespaceripple.html index 7195ad1034..745689905c 100644 --- a/namespaceripple.html +++ b/namespaceripple.html @@ -40693,7 +40693,7 @@ template<typename headers >
-

Definition at line 1375 of file OverlayImpl.cpp.

+

Definition at line 1378 of file OverlayImpl.cpp.

@@ -40713,7 +40713,7 @@ template<typename headers >
-

Definition at line 1467 of file OverlayImpl.cpp.

+

Definition at line 1470 of file OverlayImpl.cpp.

@@ -40781,7 +40781,7 @@ template<typename headers >

Creates the implementation of Overlay.

-

Definition at line 1572 of file OverlayImpl.cpp.

+

Definition at line 1575 of file OverlayImpl.cpp.