|
bitsim
Model, simulate, estimate and control robots in C++
|
A transport that delays and loses some of the messages of another, as a network would. More...
#include <transport.h>


Classes | |
| struct | Config |
Public Member Functions | |
| LossyTransport (std::unique_ptr< Transport > inner, const Config &config) | |
| void | publish (const std::string &bytes) override |
| Send bytes to every other participant. | |
| std::optional< std::string > | receive (std::chrono::milliseconds timeout) override |
| The next message from another participant, waiting at most timeout. | |
| uint_t | n_lost () const noexcept |
| Public Member Functions inherited from bitsim::distributed::Transport | |
| virtual | ~Transport ()=default |
A transport that delays and loses some of the messages of another, as a network would.
Every received message is held back for latency plus a random jitter, and dropped with probability loss, both drawn from a generator seeded with seed. Messages can overtake each other when the jitter is larger than the time between them. It is for testing how a simulation copes, without a network.
| bitsim::distributed::LossyTransport::LossyTransport | ( | std::unique_ptr< Transport > | inner, |
| const Config & | config ) |
|
inlinenoexcept |
|
inlineoverridevirtual |
Send bytes to every other participant.
Implements bitsim::distributed::Transport.
|
overridevirtual |
The next message from another participant, waiting at most timeout.
Implements bitsim::distributed::Transport.