Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
integration.cpp File Reference
Include dependency graph for integration.cpp:

Go to the source code of this file.

Classes

struct  config
 
struct  config::transport_config
 
struct  config_tls
 
struct  config_tls::transport_config
 

Macros

#define BOOST_TEST_MODULE   transport_integration
 

Typedefs

typedef websocketpp::server< configserver
 
typedef websocketpp::client< configclient
 
typedef websocketpp::server< config_tlsserver_tls
 
typedef websocketpp::client< config_tlsclient_tls
 
typedef websocketpp::server< websocketpp::config::coreiostream_server
 
typedef websocketpp::client< websocketpp::config::core_clientiostream_client
 

Functions

template<typename T >
void close_after_timeout (T &e, websocketpp::connection_hdl hdl, long timeout)
 
void run_server (server *s, int port, bool log=false)
 
void run_client (client &c, std::string uri, bool log=false)
 
void run_client_and_mark (client *c, bool *flag, websocketpp::lib::mutex *mutex)
 
void run_time_limited_client (client &c, std::string uri, long timeout, bool log)
 
void run_dummy_server (int port)
 
void run_dummy_client (std::string port)
 
bool on_ping (server *s, websocketpp::connection_hdl, std::string)
 
void cancel_on_open (server *s, websocketpp::connection_hdl)
 
void stop_on_close (server *s, websocketpp::connection_hdl hdl)
 
template<typename T >
void ping_on_open (T *c, std::string payload, websocketpp::connection_hdl hdl)
 
void fail_on_pong (websocketpp::connection_hdl, std::string)
 
void fail_on_pong_timeout (websocketpp::connection_hdl, std::string)
 
void req_pong (std::string expected_payload, websocketpp::connection_hdl, std::string payload)
 
void fail_on_open (websocketpp::connection_hdl)
 
void delay (websocketpp::connection_hdl, long duration)
 
template<typename T >
void check_ec (T *c, websocketpp::lib::error_code ec, websocketpp::connection_hdl hdl)
 
template<typename T >
void check_ec_and_stop (T *e, websocketpp::lib::error_code ec, websocketpp::connection_hdl hdl)
 
template<typename T >
void req_pong_timeout (T *c, std::string expected_payload, websocketpp::connection_hdl hdl, std::string payload)
 
template<typename T >
void close (T *e, websocketpp::connection_hdl hdl)
 
void run_test_timer (long value)
 
 BOOST_AUTO_TEST_CASE (pong_no_timeout)
 
 BOOST_AUTO_TEST_CASE (pong_timeout)
 
 BOOST_AUTO_TEST_CASE (client_open_handshake_timeout)
 
 BOOST_AUTO_TEST_CASE (server_open_handshake_timeout)
 
 BOOST_AUTO_TEST_CASE (client_self_initiated_close_handshake_timeout)
 
 BOOST_AUTO_TEST_CASE (client_peer_initiated_close_handshake_timeout)
 
 BOOST_AUTO_TEST_CASE (server_self_initiated_close_handshake_timeout)
 
 BOOST_AUTO_TEST_CASE (client_runs_out_of_work)
 
 BOOST_AUTO_TEST_CASE (client_is_perpetual)
 
 BOOST_AUTO_TEST_CASE (client_failed_connection)
 
 BOOST_AUTO_TEST_CASE (stop_listening)
 
 BOOST_AUTO_TEST_CASE (pause_reading)
 
 BOOST_AUTO_TEST_CASE (server_connection_cleanup)
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   transport_integration

Definition at line 28 of file integration.cpp.

Typedef Documentation

◆ client

Definition at line 126 of file integration.cpp.

◆ client_tls

Definition at line 129 of file integration.cpp.

◆ iostream_client

◆ iostream_server

◆ server

Definition at line 125 of file integration.cpp.

◆ server_tls

Definition at line 128 of file integration.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/13]

BOOST_AUTO_TEST_CASE ( client_failed_connection )

Definition at line 552 of file integration.cpp.

552 {
553 client c;
554
555 run_time_limited_client(c,"http://localhost:9005", 5, false);
556}
void run_time_limited_client(client &c, std::string uri, long timeout, bool log)
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/13]

BOOST_AUTO_TEST_CASE ( client_is_perpetual )

Definition at line 518 of file integration.cpp.

518 {
519 client c;
520 bool flag = false;
521 websocketpp::lib::mutex mutex;
522
523 websocketpp::lib::error_code ec;
524 c.init_asio(ec);
525 BOOST_CHECK(!ec);
526
527 c.start_perpetual();
528
529 websocketpp::lib::thread cthread(websocketpp::lib::bind(&run_client_and_mark,&c,&flag,&mutex));
530
531 sleep(1);
532
533 {
534 // Checks that the thread hasn't exited yet
535 websocketpp::lib::lock_guard<websocketpp::lib::mutex> lock(mutex);
536 BOOST_CHECK( !flag );
537 }
538
539 c.stop_perpetual();
540
541 sleep(1);
542
543 {
544 // Checks that the thread has exited
545 websocketpp::lib::lock_guard<websocketpp::lib::mutex> lock(mutex);
546 BOOST_CHECK( flag );
547 }
548
549 cthread.join();
550}
void run_client_and_mark(client *c, bool *flag, websocketpp::lib::mutex *mutex)
void lock()
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/13]

BOOST_AUTO_TEST_CASE ( client_open_handshake_timeout )

Definition at line 409 of file integration.cpp.

409 {
410 client c;
411
412 // set open handler to fail test
413 c.set_open_handler(bind(&fail_on_open,::_1));
414 // set fail hander to test for the right fail error code
417
418 websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_dummy_server,9005));
419 websocketpp::lib::thread tthread(websocketpp::lib::bind(&run_test_timer,10));
420 sthread.detach();
421 tthread.detach();
422
423 run_client(c, "http://localhost:9005");
424}
void set_fail_handler(fail_handler h)
Definition endpoint.hpp:287
void set_open_handler(open_handler h)
Definition endpoint.hpp:277
void run_client(client &c, std::string uri, bool log=false)
void run_test_timer(long value)
void fail_on_open(websocketpp::connection_hdl)
void check_ec(T *c, websocketpp::lib::error_code ec, websocketpp::connection_hdl hdl)
void run_dummy_server(int port)
@ open_handshake_timeout
WebSocket opening handshake timed out.
Definition error.hpp:114
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/13]

BOOST_AUTO_TEST_CASE ( client_peer_initiated_close_handshake_timeout )

Definition at line 467 of file integration.cpp.

467 {
468 // on open server sends close
469 // client should ack normally and then wait
470 // server leaves TCP connection open
471 // client handshake timer should be triggered
472
473 // TODO: how to make a mock server that leaves the TCP connection open?
474}

◆ BOOST_AUTO_TEST_CASE() [5/13]

BOOST_AUTO_TEST_CASE ( client_runs_out_of_work )

Definition at line 499 of file integration.cpp.

499 {
500 client c;
501
502 websocketpp::lib::thread tthread(websocketpp::lib::bind(&run_test_timer,3));
503 tthread.detach();
504
505 websocketpp::lib::error_code ec;
506 c.init_asio(ec);
507 BOOST_CHECK(!ec);
508
509 c.run();
510
511 // This test checks that an io_service with no work ends immediately.
512 BOOST_CHECK(true);
513}
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/13]

BOOST_AUTO_TEST_CASE ( client_self_initiated_close_handshake_timeout )

Definition at line 444 of file integration.cpp.

444 {
445 server s;
446 client c;
447
448 // on open server sleeps for longer than the timeout
449 // on open client sends close handshake
450 // client handshake timer should be triggered
451 s.set_open_handler(bind(&delay,::_1,1));
452 s.set_close_handler(bind(&stop_on_close,&s,::_1));
453
454 c.set_open_handler(bind(&close<client>,&c,::_1));
457
458 websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
459 websocketpp::lib::thread tthread(websocketpp::lib::bind(&run_test_timer,10));
460 tthread.detach();
461
462 run_client(c, "http://localhost:9005", false);
463
464 sthread.join();
465}
void set_close_handler(close_handler h)
Definition endpoint.hpp:282
void stop_on_close(server *s, websocketpp::connection_hdl hdl)
void run_server(server *s, int port, bool log=false)
void close(T *e, websocketpp::connection_hdl hdl)
@ close_handshake_timeout
WebSocket close handshake timed out.
Definition error.hpp:117
char * s
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/13]

BOOST_AUTO_TEST_CASE ( pause_reading )

Definition at line 577 of file integration.cpp.

577 {
579 std::string handshake = "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n\r\n";
580 char buffer[2] = { char(0x81), char(0x80) };
581
582 // suppress output (it needs a place to go to avoid error but we don't care what it is)
583 std::stringstream null_output;
584 s.register_ostream(&null_output);
585
587 con->start();
588
589 // read handshake, should work
590 BOOST_CHECK_EQUAL( con->read_some(handshake.data(), handshake.length()), handshake.length());
591
592 // pause reading and try again. The first read should work, the second should return 0
593 // the first read was queued already after the handshake so it will go through because
594 // reading wasn't paused when it was queued. The byte it reads wont be enough to
595 // complete the frame so another read will be requested. This one wont actually happen
596 // because the connection is paused now.
597 con->pause_reading();
598 BOOST_CHECK_EQUAL( con->read_some(buffer, 1), 1);
599 BOOST_CHECK_EQUAL( con->read_some(buffer+1, 1), 0);
600 // resume reading and try again. Should work this time because the resume should have
601 // re-queued a read.
602 con->resume_reading();
603 BOOST_CHECK_EQUAL( con->read_some(buffer+1, 1), 1);
604}
connection_ptr get_connection()
Create and initialize a new connection.
connection_type::ptr connection_ptr
Type of a shared pointer to the connections this server will create.
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/13]

BOOST_AUTO_TEST_CASE ( pong_no_timeout )

Definition at line 363 of file integration.cpp.

363 {
364 server s;
365 client c;
366
367 s.set_close_handler(bind(&stop_on_close,&s,::_1));
368
369 // send a ping when the connection is open
370 c.set_open_handler(bind(&ping_on_open<client>,&c,"foo",::_1));
371 // require that a pong with matching payload is received
372 c.set_pong_handler(bind(&req_pong,"foo",::_1,::_2));
373 // require that a pong timeout is NOT received
375
376 websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
377
378 // Run a client that closes the connection after 1 seconds
379 run_time_limited_client(c, "http://localhost:9005", 1, false);
380
381 sthread.join();
382}
void set_pong_timeout_handler(pong_timeout_handler h)
Definition endpoint.hpp:302
void set_pong_handler(pong_handler h)
Definition endpoint.hpp:297
void ping_on_open(T *c, std::string payload, websocketpp::connection_hdl hdl)
void fail_on_pong_timeout(websocketpp::connection_hdl, std::string)
void req_pong(std::string expected_payload, websocketpp::connection_hdl, std::string payload)
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/13]

BOOST_AUTO_TEST_CASE ( pong_timeout )

Definition at line 384 of file integration.cpp.

384 {
385 server s;
386 client c;
387
388 s.set_ping_handler(bind(&on_ping, &s,::_1,::_2));
389 s.set_close_handler(bind(&stop_on_close,&s,::_1));
390
392 websocketpp::lib::error_code(),::_1));
393
394 c.set_pong_handler(bind(&fail_on_pong,::_1,::_2));
395 c.set_open_handler(bind(&ping_on_open<client>,&c,"foo",::_1));
396 c.set_pong_timeout_handler(bind(&req_pong_timeout<client>,&c,"foo",::_1,::_2));
398 websocketpp::lib::error_code(),::_1));
399
400 websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
401 websocketpp::lib::thread tthread(websocketpp::lib::bind(&run_test_timer,10));
402 tthread.detach();
403
404 run_client(c, "http://localhost:9005",false);
405
406 sthread.join();
407}
void set_ping_handler(ping_handler h)
Definition endpoint.hpp:292
void req_pong_timeout(T *c, std::string expected_payload, websocketpp::connection_hdl hdl, std::string payload)
bool on_ping(server *s, websocketpp::connection_hdl, std::string)
void fail_on_pong(websocketpp::connection_hdl, std::string)
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/13]

BOOST_AUTO_TEST_CASE ( server_connection_cleanup )

Definition at line 607 of file integration.cpp.

607 {
609}

◆ BOOST_AUTO_TEST_CASE() [11/13]

BOOST_AUTO_TEST_CASE ( server_open_handshake_timeout )

Definition at line 426 of file integration.cpp.

426 {
427 server s;
428
429 // set open handler to fail test
430 s.set_open_handler(bind(&fail_on_open,::_1));
431 // set fail hander to test for the right fail error code
432 s.set_fail_handler(bind(&check_ec_and_stop<server>,&s,
434
435 websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
436 websocketpp::lib::thread tthread(websocketpp::lib::bind(&run_test_timer,10));
437 tthread.detach();
438
439 run_dummy_client("9005");
440
441 sthread.join();
442}
void run_dummy_client(std::string port)
void check_ec_and_stop(T *e, websocketpp::lib::error_code ec, websocketpp::connection_hdl hdl)
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/13]

BOOST_AUTO_TEST_CASE ( server_self_initiated_close_handshake_timeout )

Definition at line 476 of file integration.cpp.

476 {
477 server s;
478 client c;
479
480 // on open server sends close
481 // on open client sleeps for longer than the timeout
482 // server handshake timer should be triggered
483
484 s.set_open_handler(bind(&close<server>,&s,::_1));
485 s.set_close_handler(bind(&check_ec_and_stop<server>,&s,
487
488 c.set_open_handler(bind(&delay,::_1,1));
489
490 websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
491 websocketpp::lib::thread tthread(websocketpp::lib::bind(&run_test_timer,10));
492 tthread.detach();
493
494 run_client(c, "http://localhost:9005",false);
495
496 sthread.join();
497}
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/13]

BOOST_AUTO_TEST_CASE ( stop_listening )

Definition at line 558 of file integration.cpp.

558 {
559 server s;
560 client c;
561
562 // the first connection stops the server from listening
563 s.set_open_handler(bind(&cancel_on_open,&s,::_1));
564
565 // client immediately closes after opening a connection
566 c.set_open_handler(bind(&close<client>,&c,::_1));
567
568 websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
569 websocketpp::lib::thread tthread(websocketpp::lib::bind(&run_test_timer,5));
570 tthread.detach();
571
572 run_client(c, "http://localhost:9005",false);
573
574 sthread.join();
575}
void cancel_on_open(server *s, websocketpp::connection_hdl)
Here is the call graph for this function:

◆ cancel_on_open()

void cancel_on_open ( server * s,
websocketpp::connection_hdl  )

Definition at line 281 of file integration.cpp.

281 {
282 s->stop_listening();
283}
Here is the caller graph for this function:

◆ check_ec()

template<typename T >
void check_ec ( T * c,
websocketpp::lib::error_code ec,
websocketpp::connection_hdl hdl )

Definition at line 323 of file integration.cpp.

325{
326 typename T::connection_ptr con = c->get_con_from_hdl(hdl);
327 BOOST_CHECK_EQUAL( con->get_ec(), ec );
328 //BOOST_CHECK_EQUAL( con->get_local_close_code(), websocketpp::close::status::normal );
329 //BOOST_CHECK_EQUAL( con->get_remote_close_code(), websocketpp::close::status::normal );
330}
Here is the caller graph for this function:

◆ check_ec_and_stop()

template<typename T >
void check_ec_and_stop ( T * e,
websocketpp::lib::error_code ec,
websocketpp::connection_hdl hdl )

Definition at line 333 of file integration.cpp.

335{
336 typename T::connection_ptr con = e->get_con_from_hdl(hdl);
337 BOOST_CHECK_EQUAL( con->get_ec(), ec );
338 //BOOST_CHECK_EQUAL( con->get_local_close_code(), websocketpp::close::status::normal );
339 //BOOST_CHECK_EQUAL( con->get_remote_close_code(), websocketpp::close::status::normal );
340 e->stop();
341}
Here is the caller graph for this function:

◆ close()

template<typename T >
void close ( T * e,
websocketpp::connection_hdl hdl )

Definition at line 353 of file integration.cpp.

353 {
354 e->get_con_from_hdl(hdl)->close(websocketpp::close::status::normal,"");
355}
Here is the caller graph for this function:

◆ close_after_timeout()

template<typename T >
void close_after_timeout ( T & e,
websocketpp::connection_hdl hdl,
long timeout )

Definition at line 139 of file integration.cpp.

139 {
140 sleep(timeout);
141
142 websocketpp::lib::error_code ec;
143 e.close(hdl,websocketpp::close::status::normal,"",ec);
144 BOOST_CHECK(!ec);
145}
Here is the caller graph for this function:

◆ delay()

void delay ( websocketpp::connection_hdl ,
long duration )

Definition at line 318 of file integration.cpp.

318 {
319 sleep(duration);
320}
Here is the caller graph for this function:

◆ fail_on_open()

void fail_on_open ( websocketpp::connection_hdl )

Definition at line 314 of file integration.cpp.

314 {
315 BOOST_FAIL( "expected no open handler" );
316}
Here is the caller graph for this function:

◆ fail_on_pong()

void fail_on_pong ( websocketpp::connection_hdl ,
std::string  )

Definition at line 300 of file integration.cpp.

300 {
301 BOOST_FAIL( "expected no pong handler" );
302}
Here is the caller graph for this function:

◆ fail_on_pong_timeout()

void fail_on_pong_timeout ( websocketpp::connection_hdl ,
std::string  )

Definition at line 304 of file integration.cpp.

304 {
305 BOOST_FAIL( "expected no pong timeout" );
306}
Here is the caller graph for this function:

◆ on_ping()

bool on_ping ( server * s,
websocketpp::connection_hdl ,
std::string  )

Definition at line 276 of file integration.cpp.

276 {
277 s->get_alog().write(websocketpp::log::alevel::app,"got ping");
278 return false;
279}
static level const app
Special channel for application specific logs. Not used by the library.
Definition levels.hpp:143
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ping_on_open()

template<typename T >
void ping_on_open ( T * c,
std::string payload,
websocketpp::connection_hdl hdl )

Definition at line 293 of file integration.cpp.

293 {
294 typename T::connection_ptr con = c->get_con_from_hdl(hdl);
295 websocketpp::lib::error_code ec;
296 con->ping(payload,ec);
297 BOOST_CHECK_EQUAL(ec, websocketpp::lib::error_code());
298}
Here is the caller graph for this function:

◆ req_pong()

void req_pong ( std::string expected_payload,
websocketpp::connection_hdl ,
std::string payload )

Definition at line 308 of file integration.cpp.

310{
311 BOOST_CHECK_EQUAL( expected_payload, payload );
312}
Here is the caller graph for this function:

◆ req_pong_timeout()

template<typename T >
void req_pong_timeout ( T * c,
std::string expected_payload,
websocketpp::connection_hdl hdl,
std::string payload )

Definition at line 344 of file integration.cpp.

346{
347 typename T::connection_ptr con = c->get_con_from_hdl(hdl);
348 BOOST_CHECK_EQUAL( payload, expected_payload );
349 con->close(websocketpp::close::status::normal,"");
350}
Here is the caller graph for this function:

◆ run_client()

void run_client ( client & c,
std::string uri,
bool log = false )

Definition at line 164 of file integration.cpp.

164 {
165 if (log) {
168 } else {
171 }
172 websocketpp::lib::error_code ec;
173 c.init_asio(ec);
174 c.set_reuse_addr(true);
175 BOOST_CHECK(!ec);
176
178 BOOST_CHECK( !ec );
179 c.connect(con);
180
181 c.run();
182}
connection_ptr connect(connection_ptr con)
Begin the connection process for the given connection.
connection_ptr get_connection(uri_ptr location, lib::error_code &ec)
Get a new connection.
void clear_access_channels(log::level channels)
Clear Access logging channels.
Definition endpoint.hpp:231
void set_access_channels(log::level channels)
Set Access logging channel.
Definition endpoint.hpp:220
void set_error_channels(log::level channels)
Set Error logging channel.
Definition endpoint.hpp:242
void clear_error_channels(log::level channels)
Clear Error logging channels.
Definition endpoint.hpp:253
static level const all
Special aggregate value representing "all levels".
Definition levels.hpp:152
static level const all
Special aggregate value representing "all levels".
Definition levels.hpp:80
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_client_and_mark()

void run_client_and_mark ( client * c,
bool * flag,
websocketpp::lib::mutex * mutex )

Definition at line 184 of file integration.cpp.

184 {
185 c->run();
186 BOOST_CHECK( true );
187 websocketpp::lib::lock_guard<websocketpp::lib::mutex> lock(*mutex);
188 *flag = true;
189 BOOST_CHECK( true );
190}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_dummy_client()

void run_dummy_client ( std::string port)

Definition at line 247 of file integration.cpp.

247 {
248 using boost::asio::ip::tcp;
249
250 try {
251 boost::asio::io_service io_service;
252 tcp::resolver resolver(io_service);
253 tcp::resolver::query query("localhost", port);
254 tcp::resolver::iterator iterator = resolver.resolve(query);
255 tcp::socket socket(io_service);
256
257 boost::asio::connect(socket, iterator);
258 for (;;) {
259 char data[512];
260 boost::system::error_code ec;
261 socket.read_some(boost::asio::buffer(data), ec);
262 if (ec == boost::asio::error::eof) {
263 break;
264 } else if (ec) {
265 // other error
266 throw ec;
267 }
268 }
269 } catch (std::exception & e) {
270 std::cout << e.what() << std::endl;
271 } catch (boost::system::error_code & ec) {
272 std::cout << ec.message() << std::endl;
273 }
274}
Here is the caller graph for this function:

◆ run_dummy_server()

void run_dummy_server ( int port)

Definition at line 220 of file integration.cpp.

220 {
221 using boost::asio::ip::tcp;
222
223 try {
224 boost::asio::io_service io_service;
225 tcp::acceptor acceptor(io_service, tcp::endpoint(tcp::v6(), port));
226 tcp::socket socket(io_service);
227
228 acceptor.accept(socket);
229 for (;;) {
230 char data[512];
231 boost::system::error_code ec;
232 socket.read_some(boost::asio::buffer(data), ec);
233 if (ec == boost::asio::error::eof) {
234 break;
235 } else if (ec) {
236 // other error
237 throw ec;
238 }
239 }
240 } catch (std::exception & e) {
241 std::cout << e.what() << std::endl;
242 } catch (boost::system::error_code & ec) {
243 std::cout << ec.message() << std::endl;
244 }
245}
Here is the caller graph for this function:

◆ run_server()

void run_server ( server * s,
int port,
bool log = false )

Definition at line 147 of file integration.cpp.

147 {
148 if (log) {
149 s->set_access_channels(websocketpp::log::alevel::all);
150 s->set_error_channels(websocketpp::log::elevel::all);
151 } else {
152 s->clear_access_channels(websocketpp::log::alevel::all);
153 s->clear_error_channels(websocketpp::log::elevel::all);
154 }
155
156 s->init_asio();
157 s->set_reuse_addr(true);
158
159 s->listen(port);
160 s->start_accept();
161 s->run();
162}
Here is the caller graph for this function:

◆ run_test_timer()

void run_test_timer ( long value)

Definition at line 358 of file integration.cpp.

358 {
359 sleep(value);
360 BOOST_FAIL( "Test timed out" );
361}
#define value
Definition pkcs11.h:157
Here is the caller graph for this function:

◆ run_time_limited_client()

void run_time_limited_client ( client & c,
std::string uri,
long timeout,
bool log )

Definition at line 192 of file integration.cpp.

194{
195 if (log) {
198 } else {
201 }
202 c.init_asio();
203
204 websocketpp::lib::error_code ec;
206 BOOST_CHECK( !ec );
207 c.connect(con);
208
209 websocketpp::lib::thread tthread(websocketpp::lib::bind(
211 websocketpp::lib::ref(c),
212 con->get_handle(),
213 timeout
214 ));
215 tthread.detach();
216
217 c.run();
218}
void close_after_timeout(T &e, websocketpp::connection_hdl hdl, long timeout)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop_on_close()

void stop_on_close ( server * s,
websocketpp::connection_hdl hdl )

Definition at line 285 of file integration.cpp.

285 {
286 server::connection_ptr con = s->get_con_from_hdl(hdl);
287 //BOOST_CHECK_EQUAL( con->get_local_close_code(), websocketpp::close::status::normal );
288 //BOOST_CHECK_EQUAL( con->get_remote_close_code(), websocketpp::close::status::normal );
289 s->stop();
290}
Here is the caller graph for this function: