3#include <test/csf/Digraph.h>
4#include <test/csf/Scheduler.h>
151 template <
class Function>
162 return links_.outEdges(from);
188 auto const result =
links_.connect(to, from,
LinkType{
true, delay, now});
198 if (!
links_.disconnect(peer1, peer2))
200 bool const r =
links_.disconnect(peer2, peer1);
207template <
class Function>
211 auto link =
links_.edge(from, to);
218 if (auto l = links_.edge(from, to); l && l->established <= sent)
std::chrono::steady_clock::duration duration
std::chrono::steady_clock::time_point time_point
Digraph< Peer, LinkType > links_
clock_type::time_point time_point
BasicNetwork & operator=(BasicNetwork const &)=delete
bool connect(Peer const &from, Peer const &to, duration const &delay=std::chrono::seconds{0})
Connect two peers.
auto links(Peer const &from)
Return the range of active links.
Scheduler::clock_type clock_type
bool disconnect(Peer const &peer1, Peer const &peer2)
Break a link.
clock_type::duration duration
Digraph< Peer, LinkType > const & graph() const
Return the underlying digraph.
void send(Peer const &from, Peer const &to, Function &&f)
Send a message to a peer.
BasicNetwork(BasicNetwork const &)=delete
Simulated discrete-event scheduler.
beast::ManualClock< std::chrono::steady_clock > clock_type
LinkType(bool inbound, duration delay, time_point established)
A single peer in the simulation.