mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix CI unit tests (#5196)
- Add retries for rpc client - Add dynamic port allocation for rpc servers
This commit is contained in:
@@ -21,18 +21,21 @@
|
||||
#define RIPPLE_BASICS_BASICCONFIG_H_INCLUDED
|
||||
|
||||
#include <xrpl/basics/contract.h>
|
||||
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
using IniFileSections = std::map<std::string, std::vector<std::string>>;
|
||||
using IniFileSections =
|
||||
std::unordered_map<std::string, std::vector<std::string>>;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -43,7 +46,7 @@ class Section
|
||||
{
|
||||
private:
|
||||
std::string name_;
|
||||
std::map<std::string, std::string> lookup_;
|
||||
std::unordered_map<std::string, std::string> lookup_;
|
||||
std::vector<std::string> lines_;
|
||||
std::vector<std::string> values_;
|
||||
bool had_trailing_comments_ = false;
|
||||
@@ -215,7 +218,7 @@ public:
|
||||
class BasicConfig
|
||||
{
|
||||
private:
|
||||
std::map<std::string, Section, boost::beast::iless> map_;
|
||||
std::unordered_map<std::string, Section> map_;
|
||||
|
||||
public:
|
||||
/** Returns `true` if a section with the given name exists. */
|
||||
|
||||
@@ -22,19 +22,22 @@
|
||||
|
||||
#include <xrpl/basics/chrono.h>
|
||||
#include <xrpl/beast/core/List.h>
|
||||
#include <xrpl/server/Server.h>
|
||||
#include <xrpl/server/detail/Door.h>
|
||||
#include <xrpl/server/detail/UDPDoor.h>
|
||||
#include <xrpl/server/detail/io_list.h>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
using Endpoints = std::vector<boost::asio::ip::tcp::endpoint>;
|
||||
using Endpoints =
|
||||
std::unordered_map<std::string, boost::asio::ip::tcp::endpoint>;
|
||||
|
||||
/** A multi-protocol server.
|
||||
|
||||
@@ -171,14 +174,18 @@ ServerImpl<Handler>::ports(std::vector<Port> const& ports)
|
||||
for (auto const& port : ports)
|
||||
{
|
||||
ports_.push_back(port);
|
||||
|
||||
auto& internalPort = ports_.back();
|
||||
if (port.has_udp())
|
||||
{
|
||||
// UDP-RPC door
|
||||
if (auto sp = ios_.emplace<UDPDoor<Handler>>(
|
||||
handler_, io_service_, ports_.back(), j_))
|
||||
handler_, io_service_, internalPort, j_))
|
||||
{
|
||||
eps.push_back(sp->get_endpoint());
|
||||
auto ep = sp->get_endpoint();
|
||||
if (!internalPort.port)
|
||||
internalPort.port = ep.port();
|
||||
eps.emplace(port.name, std::move(ep));
|
||||
|
||||
sp->run();
|
||||
}
|
||||
}
|
||||
@@ -186,10 +193,15 @@ ServerImpl<Handler>::ports(std::vector<Port> const& ports)
|
||||
{
|
||||
// Standard TCP door
|
||||
if (auto sp = ios_.emplace<Door<Handler>>(
|
||||
handler_, io_service_, ports_.back(), j_))
|
||||
handler_, io_service_, internalPort, j_))
|
||||
{
|
||||
list_.push_back(sp);
|
||||
eps.push_back(sp->get_endpoint());
|
||||
|
||||
auto ep = sp->get_endpoint();
|
||||
if (!internalPort.port)
|
||||
internalPort.port = ep.port();
|
||||
eps.emplace(port.name, std::move(ep));
|
||||
|
||||
sp->run();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user