87{
89 ASSERT_TRUE(srv.init_server(test_server_port, test_server_host));
90
91 boost::mutex mtx;
92 boost::condition_variable cond;
93 int counter = 0;
94
95 auto counter_incrementer = [&counter, &cond, &mtx]()
96 {
97 boost::unique_lock<boost::mutex> lock(mtx);
98 ++counter;
99 if (4 <= counter)
100 {
101 cond.notify_one();
102 }
103 };
104
105
107 ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw std::runtime_error(
"test 1"); }));
108 ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw std::string(
"test 2"); }));
109 ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw
"test 3"; }));
110 ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw 4; }));
111
112 {
113 boost::unique_lock<boost::mutex> lock(mtx);
114 ASSERT_NE(boost::cv_status::timeout, cond.wait_for(lock, boost::chrono::seconds(5)));
116 }
117
118
119 counter = 0;
120
125
126 {
127 boost::unique_lock<boost::mutex> lock(mtx);
128 ASSERT_NE(boost::cv_status::timeout, cond.wait_for(lock, boost::chrono::seconds(5)));
130 }
131
132 srv.send_stop_signal();
135}
#define ASSERT_EQ(val1, val2)
#define ASSERT_NE(val1, val2)
#define ASSERT_TRUE(condition)
epee::net_utils::boosted_tcp_server< test_levin_protocol_handler > test_tcp_server