Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
websocketpp::transport::asio::local_endpoint< config > Class Template Reference

Asio based endpoint transport component. More...

#include <local_endpoint.hpp>

Inheritance diagram for websocketpp::transport::asio::local_endpoint< config >:
Collaboration diagram for websocketpp::transport::asio::local_endpoint< config >:

Public Types

typedef local_endpoint< configtype
 Type of this endpoint transport component.
 
typedef config::concurrency_type concurrency_type
 Type of the concurrency policy.
 
typedef config::socket_type socket_type
 Type of the socket policy.
 
typedef config::elog_type elog_type
 Type of the error logging policy.
 
typedef config::alog_type alog_type
 Type of the access logging policy.
 
typedef socket_type::socket_con_type socket_con_type
 Type of the socket connection component.
 
typedef socket_con_type::ptr socket_con_ptr
 Type of a shared pointer to the socket connection component.
 
typedef asio::connection< configtransport_con_type
 
typedef transport_con_type::ptr transport_con_ptr
 
typedef lib::asio::io_service * io_service_ptr
 Type of a pointer to the ASIO io_service being used.
 
typedef lib::shared_ptr< lib::asio::local::stream_protocol::acceptor > acceptor_ptr
 Type of a shared pointer to the acceptor being used.
 
typedef lib::shared_ptr< lib::asio::steady_timertimer_ptr
 Type of timer handle.
 
typedef lib::shared_ptr< lib::asio::io_service::work > work_ptr
 Type of a shared pointer to an io_service work object.
 

Public Member Functions

 local_endpoint ()
 
 ~local_endpoint ()
 
bool is_secure () const
 Return whether or not the endpoint produces secure connections.
 
void init_asio (io_service_ptr ptr, lib::error_code &ec)
 initialize asio transport with external io_service (exception free)
 
void init_asio (io_service_ptr ptr)
 initialize asio transport with external io_service
 
void set_tcp_pre_init_handler (tcp_init_handler h)
 Sets the tcp pre init handler.
 
void set_tcp_init_handler (tcp_init_handler h)
 Sets the tcp pre init handler (deprecated)
 
void set_tcp_post_init_handler (tcp_init_handler h)
 Sets the tcp post init handler.
 
lib::asio::io_service & get_io_service ()
 Retrieve a reference to the endpoint's io_service.
 
void listen (lib::asio::local::stream_protocol::endpoint const &ep, lib::error_code &ec)
 Set up endpoint for listening manually (exception free)
 
void listen (lib::asio::local::stream_protocol::endpoint const &ep)
 Set up endpoint for listening manually.
 
void stop_listening (lib::error_code &ec)
 Stop listening (exception free)
 
void stop_listening ()
 Stop listening.
 
bool is_listening () const
 Check if the endpoint is listening.
 
std::size_t run ()
 wraps the run method of the internal io_service object
 
std::size_t run_one ()
 wraps the run_one method of the internal io_service object
 
void stop ()
 wraps the stop method of the internal io_service object
 
std::size_t poll ()
 wraps the poll method of the internal io_service object
 
std::size_t poll_one ()
 wraps the poll_one method of the internal io_service object
 
void reset ()
 wraps the reset method of the internal io_service object
 
bool stopped () const
 wraps the stopped method of the internal io_service object
 
void start_perpetual ()
 Marks the endpoint as perpetual, stopping it from exiting when empty.
 
void stop_perpetual ()
 Clears the endpoint's perpetual flag, allowing it to exit when empty.
 
timer_ptr set_timer (long duration, timer_handler callback)
 Call back a function after a period of time.
 
void handle_timer (timer_ptr, timer_handler callback, lib::asio::error_code const &ec)
 Timer handler.
 
void async_accept (transport_con_ptr tcon, accept_handler callback, lib::error_code &ec)
 Accept the next connection attempt and assign it to con (exception free)
 
void async_accept (transport_con_ptr tcon, accept_handler callback)
 Accept the next connection attempt and assign it to con.
 

Protected Member Functions

void init_logging (alog_type *a, elog_type *e)
 Initialize logging.
 
void handle_accept (accept_handler callback, lib::asio::error_code const &asio_ec)
 
void handle_connect_timeout (transport_con_ptr tcon, timer_ptr, connect_handler callback, lib::error_code const &ec)
 Asio connect timeout handler.
 
void handle_connect (transport_con_ptr tcon, timer_ptr con_timer, connect_handler callback, lib::asio::error_code const &ec)
 
lib::error_code init (transport_con_ptr tcon)
 Initialize a connection.
 

Detailed Description

template<typename config>
class websocketpp::transport::asio::local_endpoint< config >

transport::asio::endpoint implements an endpoint transport component using Asio.

Definition at line 159 of file local_endpoint.hpp.

Member Typedef Documentation

◆ acceptor_ptr

template<typename config >
lib::shared_ptr<lib::asio::local::stream_protocol::acceptor> websocketpp::transport::asio::local_endpoint< config >::acceptor_ptr

Definition at line 188 of file local_endpoint.hpp.

◆ alog_type

template<typename config >
config::alog_type websocketpp::transport::asio::local_endpoint< config >::alog_type

Definition at line 171 of file local_endpoint.hpp.

◆ concurrency_type

template<typename config >
config::concurrency_type websocketpp::transport::asio::local_endpoint< config >::concurrency_type

Definition at line 165 of file local_endpoint.hpp.

◆ elog_type

template<typename config >
config::elog_type websocketpp::transport::asio::local_endpoint< config >::elog_type

Definition at line 169 of file local_endpoint.hpp.

◆ io_service_ptr

template<typename config >
lib::asio::io_service* websocketpp::transport::asio::local_endpoint< config >::io_service_ptr

Definition at line 186 of file local_endpoint.hpp.

◆ socket_con_ptr

template<typename config >
socket_con_type::ptr websocketpp::transport::asio::local_endpoint< config >::socket_con_ptr

Definition at line 176 of file local_endpoint.hpp.

◆ socket_con_type

template<typename config >
socket_type::socket_con_type websocketpp::transport::asio::local_endpoint< config >::socket_con_type

Definition at line 174 of file local_endpoint.hpp.

◆ socket_type

template<typename config >
config::socket_type websocketpp::transport::asio::local_endpoint< config >::socket_type

Definition at line 167 of file local_endpoint.hpp.

◆ timer_ptr

template<typename config >
lib::shared_ptr<lib::asio::steady_timer> websocketpp::transport::asio::local_endpoint< config >::timer_ptr

Definition at line 190 of file local_endpoint.hpp.

◆ transport_con_ptr

template<typename config >
transport_con_type::ptr websocketpp::transport::asio::local_endpoint< config >::transport_con_ptr

Type of a shared pointer to the connection transport component associated with this endpoint transport component

Definition at line 183 of file local_endpoint.hpp.

◆ transport_con_type

template<typename config >
asio::connection<config> websocketpp::transport::asio::local_endpoint< config >::transport_con_type

Type of the connection transport component associated with this endpoint transport component

Definition at line 180 of file local_endpoint.hpp.

◆ type

Definition at line 162 of file local_endpoint.hpp.

◆ work_ptr

template<typename config >
lib::shared_ptr<lib::asio::io_service::work> websocketpp::transport::asio::local_endpoint< config >::work_ptr

Definition at line 192 of file local_endpoint.hpp.

Constructor & Destructor Documentation

◆ local_endpoint()

template<typename config >
websocketpp::transport::asio::local_endpoint< config >::local_endpoint ( )
inlineexplicit

Definition at line 195 of file local_endpoint.hpp.

196 : m_io_service(NULL)
197 , m_state(UNINITIALIZED)
198 {
199 //std::cout << "transport::asio::endpoint constructor" << std::endl;
200 }

◆ ~local_endpoint()

Definition at line 202 of file local_endpoint.hpp.

202 {
203 if (m_acceptor && m_state == LISTENING)
204 ::unlink(m_acceptor->local_endpoint().path().c_str());
205
206 // Explicitly destroy local objects
207 m_acceptor.reset();
208 m_work.reset();
209 }

Member Function Documentation

◆ async_accept() [1/2]

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::async_accept ( transport_con_ptr tcon,
accept_handler callback )
inline
Parameters
tconThe connection to accept into.
callbackThe function to call when the operation is complete.

Definition at line 630 of file local_endpoint.hpp.

630 {
631 lib::error_code ec;
632 async_accept(tcon,callback,ec);
633 if (ec) { throw exception(ec); }
634 }
void async_accept(transport_con_ptr tcon, accept_handler callback, lib::error_code &ec)
Accept the next connection attempt and assign it to con (exception free)
Here is the call graph for this function:

◆ async_accept() [2/2]

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::async_accept ( transport_con_ptr tcon,
accept_handler callback,
lib::error_code & ec )
inline
Parameters
tconThe connection to accept into.
callbackThe function to call when the operation is complete.
ecA status code indicating an error, if any.

Definition at line 591 of file local_endpoint.hpp.

593 {
594 if (m_state != LISTENING) {
597 return;
598 }
599
600 m_alog->write(log::alevel::devel, "asio::async_accept");
601
602 if (config::enable_multithreading) {
603 m_acceptor->async_accept(
604 tcon->get_raw_socket(),
605 tcon->get_strand()->wrap(lib::bind(
607 this,
608 callback,
609 lib::placeholders::_1
610 ))
611 );
612 } else {
613 m_acceptor->async_accept(
614 tcon->get_raw_socket(),
615 lib::bind(
617 this,
618 callback,
619 lib::placeholders::_1
620 )
621 );
622 }
623 }
void handle_accept(accept_handler callback, lib::asio::error_code const &asio_ec)
lib::error_code make_error_code(error::value e)
Definition error.hpp:235
static level const devel
Development messages (warning: very chatty)
Definition levels.hpp:141
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_io_service()

template<typename config >
lib::asio::io_service & websocketpp::transport::asio::local_endpoint< config >::get_io_service ( )
inline

The io_service may be an internal or external one. This may be used to call methods of the io_service that are not explicitly wrapped by the endpoint.

This method is only valid after the endpoint has been initialized with init_asio. No error will be returned if it isn't.

Returns
A reference to the endpoint's io_service

Definition at line 342 of file local_endpoint.hpp.

342 {
343 return *m_io_service;
344 }
Here is the caller graph for this function:

◆ handle_accept()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::handle_accept ( accept_handler callback,
lib::asio::error_code const & asio_ec )
inlineprotected

Definition at line 651 of file local_endpoint.hpp.

653 {
654 lib::error_code ret_ec;
655
656 m_alog->write(log::alevel::devel, "asio::handle_accept");
657
658 if (asio_ec) {
659 if (asio_ec == lib::asio::errc::operation_canceled) {
660 ret_ec = make_error_code(websocketpp::error::operation_canceled);
661 } else {
662 log_err(log::elevel::info,"asio handle_accept",asio_ec);
663 ret_ec = asio_ec;
664 }
665 }
666
667 callback(ret_ec);
668 }
@ operation_canceled
The requested operation was canceled.
Definition error.hpp:127
static level const info
Definition levels.hpp:69
Here is the caller graph for this function:

◆ handle_connect()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::handle_connect ( transport_con_ptr tcon,
timer_ptr con_timer,
connect_handler callback,
lib::asio::error_code const & ec )
inlineprotected

Definition at line 703 of file local_endpoint.hpp.

705 {
706 if (ec == lib::asio::error::operation_aborted ||
707 lib::asio::is_neg(con_timer->expires_from_now()))
708 {
709 m_alog->write(log::alevel::devel,"async_connect cancelled");
710 return;
711 }
712
713 con_timer->cancel();
714
715 if (ec) {
716 log_err(log::elevel::info,"asio async_connect",ec);
717 callback(ec);
718 return;
719 }
720
721 if (m_alog->static_test(log::alevel::devel)) {
722 m_alog->write(log::alevel::devel,
723 "Async connect to "+tcon->get_remote_endpoint()+" successful.");
724 }
725
726 callback(lib::error_code());
727 }
bool is_neg(T duration)
Definition asio.hpp:114
Here is the call graph for this function:

◆ handle_connect_timeout()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::handle_connect_timeout ( transport_con_ptr tcon,
timer_ptr ,
connect_handler callback,
lib::error_code const & ec )
inlineprotected

The timer pointer is included to ensure the timer isn't destroyed until after it has expired.

Parameters
tconPointer to the transport connection that is being connected
con_timerPointer to the timer in question
callbackThe function to call back
ecA status code indicating an error, if any.

Definition at line 680 of file local_endpoint.hpp.

682 {
683 lib::error_code ret_ec;
684
685 if (ec) {
687 m_alog->write(log::alevel::devel,
688 "asio handle_connect_timeout timer cancelled");
689 return;
690 }
691
692 log_err(log::elevel::devel,"asio handle_connect_timeout",ec);
693 ret_ec = ec;
694 } else {
695 ret_ec = make_error_code(transport::error::timeout);
696 }
697
698 m_alog->write(log::alevel::devel,"TCP connect timed out");
699 tcon->cancel_socket_checked();
700 callback(ret_ec);
701 }
@ operation_aborted
Operation aborted.
static level const devel
Low level debugging information (warning: very chatty)
Definition levels.hpp:63

◆ handle_timer()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::handle_timer ( timer_ptr ,
timer_handler callback,
lib::asio::error_code const & ec )
inline

The timer pointer is included to ensure the timer isn't destroyed until after it has expired.

Parameters
tPointer to the timer in question
callbackThe function to call back
ecA status code indicating an error, if any.

Definition at line 568 of file local_endpoint.hpp.

570 {
571 if (ec) {
572 if (ec == lib::asio::error::operation_aborted) {
573 callback(make_error_code(transport::error::operation_aborted));
574 } else {
575 m_elog->write(log::elevel::info,
576 "asio handle_timer error: "+ec.message());
577 log_err(log::elevel::info,"asio handle_timer",ec);
578 callback(ec);
579 }
580 } else {
581 callback(lib::error_code());
582 }
583 }
Here is the caller graph for this function:

◆ init()

template<typename config >
lib::error_code websocketpp::transport::asio::local_endpoint< config >::init ( transport_con_ptr tcon)
inlineprotected

init is called by an endpoint once for each newly created connection. It's purpose is to give the transport policy the chance to perform any transport specific initialization that couldn't be done via the default constructor.

Parameters
tconA pointer to the transport portion of the connection.
Returns
A status code indicating the success or failure of the operation

Definition at line 740 of file local_endpoint.hpp.

740 {
741 m_alog->write(log::alevel::devel, "transport::asio::init");
742
743 lib::error_code ec;
744
745 ec = tcon->init_asio(m_io_service);
746 if (ec) {return ec;}
747
748 tcon->set_tcp_pre_init_handler(m_tcp_pre_init_handler);
749 tcon->set_tcp_post_init_handler(m_tcp_post_init_handler);
750
751 return lib::error_code();
752 }

◆ init_asio() [1/2]

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::init_asio ( io_service_ptr ptr)
inline

Initialize the ASIO transport policy for this endpoint using the provided io_service object. asio_init must be called exactly once on any endpoint that uses transport::asio before it can be used.

Parameters
ptrA pointer to the io_service to use for asio events

Definition at line 282 of file local_endpoint.hpp.

282 {
283 lib::error_code ec;
284 init_asio(ptr,ec);
285 if (ec) { throw exception(ec); }
286 }
void init_asio(io_service_ptr ptr, lib::error_code &ec)
initialize asio transport with external io_service (exception free)
Here is the call graph for this function:

◆ init_asio() [2/2]

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::init_asio ( io_service_ptr ptr,
lib::error_code & ec )
inline

Initialize the ASIO transport policy for this endpoint using the provided io_service object. asio_init must be called exactly once on any endpoint that uses transport::asio before it can be used.

Parameters
ptrA pointer to the io_service to use for asio events
ecSet to indicate what error occurred, if any.

Definition at line 256 of file local_endpoint.hpp.

256 {
257 if (m_state != UNINITIALIZED) {
258 m_elog->write(log::elevel::library,
259 "asio::init_asio called from the wrong state");
261 ec = make_error_code(websocketpp::error::invalid_state);
262 return;
263 }
264
265 m_alog->write(log::alevel::devel,"asio::init_asio");
266
267 m_io_service = ptr;
268 m_acceptor = lib::make_shared<lib::asio::local::stream_protocol::acceptor>(*m_io_service);
269
270 m_state = READY;
271 ec = lib::error_code();
272 }
@ invalid_state
The connection was in the wrong state for this operation.
Definition error.hpp:74
static level const library
Definition levels.hpp:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_logging()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::init_logging ( alog_type * a,
elog_type * e )
inlineprotected

The loggers are located in the main endpoint class. As such, the transport doesn't have direct access to them. This method is called by the endpoint constructor to allow shared logging from the transport component. These are raw pointers to member variables of the endpoint. In particular, they cannot be used in the transport constructor as they haven't been constructed yet, and cannot be used in the transport destructor as they will have been destroyed by then.

Definition at line 646 of file local_endpoint.hpp.

646 {
647 m_alog = a;
648 m_elog = e;
649 }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181

◆ is_listening()

template<typename config >
bool websocketpp::transport::asio::local_endpoint< config >::is_listening ( ) const
inline
Returns
Whether or not the endpoint is listening.

Definition at line 456 of file local_endpoint.hpp.

456 {
457 return (m_state == LISTENING);
458 }

◆ is_secure()

template<typename config >
bool websocketpp::transport::asio::local_endpoint< config >::is_secure ( ) const
inline

Definition at line 243 of file local_endpoint.hpp.

243 {
244 return socket_type::is_secure();
245 }

◆ listen() [1/2]

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::listen ( lib::asio::local::stream_protocol::endpoint const & ep)
inline

Bind the internal acceptor using the settings specified by the endpoint e

Parameters
epAn endpoint to read settings from

Definition at line 410 of file local_endpoint.hpp.

410 {
411 lib::error_code ec;
412 listen(ep,ec);
413 if (ec) { throw exception(ec); }
414 }
void listen(lib::asio::local::stream_protocol::endpoint const &ep, lib::error_code &ec)
Set up endpoint for listening manually (exception free)
Here is the call graph for this function:

◆ listen() [2/2]

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::listen ( lib::asio::local::stream_protocol::endpoint const & ep,
lib::error_code & ec )
inline

Bind the internal acceptor using the specified settings. The endpoint must have been initialized by calling init_asio before listening.

Parameters
epAn endpoint to read settings from
ecSet to indicate what error occurred, if any.

Definition at line 354 of file local_endpoint.hpp.

355 {
356 if (m_state != READY) {
357 m_elog->write(log::elevel::library,
358 "asio::listen called from the wrong state");
360 ec = make_error_code(websocketpp::error::invalid_state);
361 return;
362 }
363
364 m_alog->write(log::alevel::devel,"asio::listen");
365
366 lib::asio::error_code bec;
367
368 {
369 boost::system::error_code test_ec;
370 lib::asio::local::stream_protocol::socket test_socket(get_io_service());
371 test_socket.connect(ep, test_ec);
372
373 //looks like a service is already running on that socket, probably another kiod, don't touch it
374 if(test_ec == boost::system::errc::success)
375 bec = boost::system::errc::make_error_code(boost::system::errc::address_in_use);
376 //socket exists but no one home, go ahead and remove it and continue on
377 else if(test_ec == boost::system::errc::connection_refused)
378 ::unlink(ep.path().c_str());
379 else if(test_ec != boost::system::errc::no_such_file_or_directory)
380 bec = test_ec;
381 }
382
383 if (!bec) {
384 m_acceptor->open(ep.protocol(),bec);
385 }
386 if (!bec) {
387 m_acceptor->bind(ep,bec);
388 }
389 if (!bec) {
390 m_acceptor->listen(boost::asio::socket_base::max_listen_connections,bec);
391 }
392 if (bec) {
393 if (m_acceptor->is_open()) {
394 m_acceptor->close();
395 }
396 log_err(log::elevel::info,"asio listen",bec);
397 ec = bec;
398 } else {
399 m_state = LISTENING;
400 ec = lib::error_code();
401 }
402 }
lib::asio::io_service & get_io_service()
Retrieve a reference to the endpoint's io_service.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ poll()

template<typename config >
std::size_t websocketpp::transport::asio::local_endpoint< config >::poll ( )
inline

Definition at line 479 of file local_endpoint.hpp.

479 {
480 return m_io_service->poll();
481 }

◆ poll_one()

template<typename config >
std::size_t websocketpp::transport::asio::local_endpoint< config >::poll_one ( )
inline

Definition at line 484 of file local_endpoint.hpp.

484 {
485 return m_io_service->poll_one();
486 }

◆ reset()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::reset ( )
inline

Definition at line 489 of file local_endpoint.hpp.

489 {
490 m_io_service->reset();
491 }

◆ run()

template<typename config >
std::size_t websocketpp::transport::asio::local_endpoint< config >::run ( )
inline

Definition at line 461 of file local_endpoint.hpp.

461 {
462 return m_io_service->run();
463 }

◆ run_one()

template<typename config >
std::size_t websocketpp::transport::asio::local_endpoint< config >::run_one ( )
inline
Since
0.3.0-alpha4

Definition at line 469 of file local_endpoint.hpp.

469 {
470 return m_io_service->run_one();
471 }

◆ set_tcp_init_handler()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::set_tcp_init_handler ( tcp_init_handler h)
inline

The tcp pre init handler is called after the raw tcp connection has been established but before any additional wrappers (proxy connects, TLS handshakes, etc) have been performed.

Deprecated
Use set_tcp_pre_init_handler instead
Parameters
hThe handler to call on tcp pre init.

Definition at line 312 of file local_endpoint.hpp.

312 {
314 }
void set_tcp_pre_init_handler(tcp_init_handler h)
Sets the tcp pre init handler.
Here is the call graph for this function:

◆ set_tcp_post_init_handler()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::set_tcp_post_init_handler ( tcp_init_handler h)
inline

The tcp post init handler is called after the tcp connection has been established and all additional wrappers (proxy connects, TLS handshakes, etc have been performed. This is fired before any bytes are read or any WebSocket specific handshake logic has been performed.

Since
0.3.0
Parameters
hThe handler to call on tcp post init.

Definition at line 327 of file local_endpoint.hpp.

327 {
328 m_tcp_post_init_handler = h;
329 }

◆ set_tcp_pre_init_handler()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::set_tcp_pre_init_handler ( tcp_init_handler h)
inline

The tcp pre init handler is called after the raw tcp connection has been established but before any additional wrappers (proxy connects, TLS handshakes, etc) have been performed.

Since
0.3.0
Parameters
hThe handler to call on tcp pre init.

Definition at line 298 of file local_endpoint.hpp.

298 {
299 m_tcp_pre_init_handler = h;
300 }
Here is the caller graph for this function:

◆ set_timer()

template<typename config >
timer_ptr websocketpp::transport::asio::local_endpoint< config >::set_timer ( long duration,
timer_handler callback )
inline

Sets a timer that calls back a function after the specified period of milliseconds. Returns a handle that can be used to cancel the timer. A cancelled timer will return the error code error::operation_aborted A timer that expired will return no error.

Parameters
durationLength of time to wait in milliseconds
callbackThe function to call back when the timer has expired
Returns
A handle that can be used to cancel the timer if it is no longer needed.

Definition at line 540 of file local_endpoint.hpp.

540 {
541 timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>(
542 *m_io_service,
544 );
545
546 new_timer->async_wait(
547 lib::bind(
549 this,
550 new_timer,
551 callback,
552 lib::placeholders::_1
553 )
554 );
555
556 return new_timer;
557 }
lib::shared_ptr< lib::asio::steady_timer > timer_ptr
Type of timer handle.
void handle_timer(timer_ptr, timer_handler callback, lib::asio::error_code const &ec)
Timer handler.
boost::posix_time::time_duration milliseconds(long duration)
Definition asio.hpp:117
Here is the call graph for this function:

◆ start_perpetual()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::start_perpetual ( )
inline

Marks the endpoint as perpetual. Perpetual endpoints will not automatically exit when they run out of connections to process. To stop a perpetual endpoint call end_perpetual.

An endpoint may be marked perpetual at any time by any thread. It must be called either before the endpoint has run out of work or before it was started

Since
0.3.0

Definition at line 510 of file local_endpoint.hpp.

510 {
511 m_work = lib::make_shared<lib::asio::io_service::work>(
512 lib::ref(*m_io_service)
513 );
514 }

◆ stop()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::stop ( )
inline

Definition at line 474 of file local_endpoint.hpp.

474 {
475 m_io_service->stop();
476 }

◆ stop_listening() [1/2]

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::stop_listening ( )
inline

Stop listening and accepting new connections. This will not end any existing connections.

Since
0.3.0-alpha4

Definition at line 446 of file local_endpoint.hpp.

446 {
447 lib::error_code ec;
448 stop_listening(ec);
449 if (ec) { throw exception(ec); }
450 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop_listening() [2/2]

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::stop_listening ( lib::error_code & ec)
inline

Stop listening and accepting new connections. This will not end any existing connections.

Since
0.3.0-alpha4
Parameters
ecA status code indicating an error, if any.

Definition at line 424 of file local_endpoint.hpp.

424 {
425 if (m_state != LISTENING) {
426 m_elog->write(log::elevel::library,
427 "asio::listen called from the wrong state");
429 ec = make_error_code(websocketpp::error::invalid_state);
430 return;
431 }
432
433 ::unlink(m_acceptor->local_endpoint().path().c_str());
434 m_acceptor->close();
435 m_state = READY;
436 ec = lib::error_code();
437 }
Here is the call graph for this function:

◆ stop_perpetual()

template<typename config >
void websocketpp::transport::asio::local_endpoint< config >::stop_perpetual ( )
inline

Clears the endpoint's perpetual flag. This will cause the endpoint's run method to exit normally when it runs out of connections. If there are currently active connections it will not end until they are complete.

Since
0.3.0

Definition at line 524 of file local_endpoint.hpp.

524 {
525 m_work.reset();
526 }

◆ stopped()

template<typename config >
bool websocketpp::transport::asio::local_endpoint< config >::stopped ( ) const
inline

Definition at line 494 of file local_endpoint.hpp.

494 {
495 return m_io_service->stopped();
496 }

The documentation for this class was generated from the following file: