45 carla::SharedBufferView BufView = carla::BufferView::CreateFrom(std::move(msg));
46 DEBUG_ASSERT_EQ(BufView->size(), _message->size());
47 boost::asio::post(_client_callback, [this]() {
48 CARLA_PROFILE_FPS(client, listen_callback);
49 ++_number_of_messages_received;
62 void Run(
size_t number_of_messages) {
63 _threads.CreateThread([
this]() { _client_callback.run(); });
64 _server.AsyncRun(_streams.size());
65 _client.AsyncRun(_streams.size());
67 std::this_thread::sleep_for(1s);
70 for (
auto &&stream : _streams) {
71 _threads.CreateThread([=]()
mutable {
72 for (
auto i = 0u; i < number_of_messages; ++i) {
73 std::this_thread::sleep_for(11ms);
76 stream.Write(_message);
82 const auto expected_number_of_messages = _streams.size() * number_of_messages;
83 const auto threshold =
84 static_cast<size_t>(_success_ratio *
static_cast<double>(expected_number_of_messages));
86 for (
auto i = 0u; i < 10; ++i) {
87 std::cout <<
"received " << _number_of_messages_received
88 <<
" of " << expected_number_of_messages
90 if (_number_of_messages_received >= expected_number_of_messages) {
93 std::cout <<
" waiting..." << std::endl;
94 std::this_thread::sleep_for(1s);
97 _client_callback.stop();
99 std::cout <<
" done." << std::endl;
102 ASSERT_GE(_number_of_messages_received, threshold);
104 if (_number_of_messages_received < threshold) {