libs/wampcc/wamp_session.cc
/* Initiate the session termination, including socket closure. The state mutex
 * must be provided as an argument.  This method checks existing state, and if
 * not closed, request actual closure on the event thread. */
Initiate the session termination, including socket closure. The state mutex
must be provided as an argument.  This method checks existing state, and if
not closed, request actual closure on the event thread.
Initiate the session termination including socket closure . The state mutex must be provided as an argument . This method checks existing state and if not closed request actual closure on the event thread .
void wamp_session::terminate(std::lock_guard<std::mutex>&)
{
  if (is_in(m_state, state::closing, state::closed))
    return;
  m_state = state::closing;
  LOG_INFO(m_log_prefix << "closing");
  try { m_socket->close(); } catch (...){};
  std::shared_ptr<wamp_session> sp = shared_from_this();
  m_kernel->get_event_loop()->dispatch([sp](){ sp->transition_to_closed(); });
}
void wamp_session :: terminate ( std :: lock_guard < std :: mutex > & ) { if ( is_in ( m_state , state :: closing , state :: closed ) ) return ; m_state = state :: closing ; LOG_INFO ( m_log_prefix << " " ) ; try { m_socket -> close ( ) ; } catch ( ... ) { } ; std :: shared_ptr < wamp_session > sp = shared_from_this ( ) ; m_kernel -> get_event_loop ( ) -> dispatch ( [ sp ] ( ) { sp -> transition_to_closed ( ) ; } ) ; }
Initiate the session termination, including socket closure.
Initiate the session termination including socket closure .
/* ANY thread */ // TODO: what if the EV thread is closed? Have the EV to throw an exception to // detect this.