Fix CI unit tests (#5196)

- Add retries for rpc client
- Add dynamic port allocation for rpc servers
This commit is contained in:
Olek
2025-01-28 10:45:59 -05:00
committed by GitHub
parent b6e3453f49
commit 50b8f19cb5
31 changed files with 293 additions and 146 deletions

View File

@@ -22,18 +22,21 @@
#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/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.
@@ -168,11 +171,17 @@ ServerImpl<Handler>::ports(std::vector<Port> const& ports)
for (auto const& port : ports)
{
ports_.push_back(port);
auto& internalPort = ports_.back();
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();
}
}