To use the asynchronous library synchronously, objects of this type lock a mutex until enough calls have been made to the associated handler. More...
#include <network_manager_ana.hpp>


Public Member Functions | |
| ana_multiple_receive_handler (ana_component_set &components) | |
| Constructs a reader handler object. | |
| ~ana_multiple_receive_handler () | |
| Destructor. | |
| void | wait_completion (size_t timeout_ms=0) |
| Attempts to read from those network components associated with this handler object up until timeout_ms milliseconds. | |
| const ana::error_code & | error () const |
| Returns the error_code from the operation. | |
| ana::read_buffer | buffer () const |
| Returns the buffer from the operation. | |
| network::connection | get_wesnoth_id () const |
Private Member Functions | |
| virtual void | handle_receive (ana::error_code, ana::net_id, ana::read_buffer) |
| Handle an incoming message event. | |
| virtual void | handle_disconnect (ana::error_code, ana::net_id) |
| Handle a disconnect event. | |
| void | handle_timeout (ana::error_code error_code) |
Private Attributes | |
| ana_component_set & | components_ |
| boost::mutex | mutex_ |
| boost::mutex | handler_mutex_ |
| boost::mutex | timeout_called_mutex_ |
| ana::error_code | error_code_ |
| ana::read_buffer | buffer_ |
| network::connection | wesnoth_id_ |
| ana::timer * | receive_timer_ |
| bool | finished_ |
To use the asynchronous library synchronously, objects of this type lock a mutex until enough calls have been made to the associated handler.
Definition at line 270 of file network_manager_ana.hpp.
| ana_multiple_receive_handler::ana_multiple_receive_handler | ( | ana_component_set & | components | ) |
Constructs a reader handler object.
Definition at line 197 of file network_manager_ana.cpp.
References components_, mutex_, and timeout_called_mutex_.
| ana_multiple_receive_handler::~ana_multiple_receive_handler | ( | ) |
Destructor.
Definition at line 224 of file network_manager_ana.cpp.
References handler_mutex_, and timeout_called_mutex_.
| ana::read_buffer ana_multiple_receive_handler::buffer | ( | ) | const [inline] |
Returns the buffer from the operation.
Definition at line 301 of file network_manager_ana.hpp.
References buffer_.
Referenced by ana_network_manager::read_from().

| const ana::error_code& ana_multiple_receive_handler::error | ( | ) | const [inline] |
Returns the error_code from the operation.
Definition at line 295 of file network_manager_ana.hpp.
References error_code_.
Referenced by ana_network_manager::read_from().

| network::connection ana_multiple_receive_handler::get_wesnoth_id | ( | ) | const [inline] |
Definition at line 306 of file network_manager_ana.hpp.
References wesnoth_id_.
Referenced by ana_network_manager::read_from().

| void ana_multiple_receive_handler::handle_disconnect | ( | ana::error_code | , | |
| ana::net_id | ||||
| ) | [private, virtual] |
Handle a disconnect event.
| error_code | : Error code of the disconnecting client, it could shed some light into why it got disconnected. | |
| net_id | : ID of the client that gets disconnected. |
Implements ana::listener_handler.
Definition at line 295 of file network_manager_ana.cpp.
References error_code_, finished_, handler_mutex_, mutex_, and receive_timer_.
| void ana_multiple_receive_handler::handle_receive | ( | ana::error_code | , | |
| ana::net_id | , | |||
| ana::read_buffer | ||||
| ) | [private, virtual] |
Handle an incoming message event.
| error_code | : Error code of the client sending the message, if it evaluates to false, then no error occurred. | |
| net_id | : ID of the client that sends the message. | |
| shared_buffer | : The buffer from the incoming message. |
Implements ana::listener_handler.
Definition at line 266 of file network_manager_ana.cpp.
References buffer_, components_, error_code_, finished_, ana_component::get_id(), handler_mutex_, mutex_, receive_timer_, and wesnoth_id_.

| void ana_multiple_receive_handler::handle_timeout | ( | ana::error_code | error_code | ) | [private] |
Definition at line 310 of file network_manager_ana.cpp.
References error_code_, finished_, handler_mutex_, mutex_, receive_timer_, and timeout_called_mutex_.
Referenced by wait_completion().

| void ana_multiple_receive_handler::wait_completion | ( | size_t | timeout_ms = 0 |
) |
Attempts to read from those network components associated with this handler object up until timeout_ms milliseconds.
If the timeout parameter is 0, it will lock the current thread until one of these components has received a message.
| component | : A network component running an io_service which supports timeout capabilities. | |
| timeout_ms | : Amount of milliseconds to timeout the operation. |
Definition at line 232 of file network_manager_ana.cpp.
References components_, ana::detail::timed_sender::create_timer(), finished_, handle_timeout(), handler_mutex_, ana::time::milliseconds(), mutex_, receive_timer_, timeout_called_mutex_, ana::timeout_error, and ana::timer::wait().
Referenced by ana_network_manager::read_from().


Definition at line 323 of file network_manager_ana.hpp.
Referenced by buffer(), and handle_receive().
Definition at line 317 of file network_manager_ana.hpp.
Referenced by ana_multiple_receive_handler(), handle_receive(), and wait_completion().
Definition at line 322 of file network_manager_ana.hpp.
Referenced by error(), handle_disconnect(), handle_receive(), and handle_timeout().
bool ana_multiple_receive_handler::finished_ [private] |
Definition at line 326 of file network_manager_ana.hpp.
Referenced by handle_disconnect(), handle_receive(), handle_timeout(), and wait_completion().
boost::mutex ana_multiple_receive_handler::handler_mutex_ [private] |
Definition at line 320 of file network_manager_ana.hpp.
Referenced by handle_disconnect(), handle_receive(), handle_timeout(), wait_completion(), and ~ana_multiple_receive_handler().
boost::mutex ana_multiple_receive_handler::mutex_ [private] |
Definition at line 319 of file network_manager_ana.hpp.
Referenced by ana_multiple_receive_handler(), handle_disconnect(), handle_receive(), handle_timeout(), and wait_completion().
Definition at line 325 of file network_manager_ana.hpp.
Referenced by handle_disconnect(), handle_receive(), handle_timeout(), and wait_completion().
boost::mutex ana_multiple_receive_handler::timeout_called_mutex_ [private] |
Definition at line 321 of file network_manager_ana.hpp.
Referenced by ana_multiple_receive_handler(), handle_timeout(), wait_completion(), and ~ana_multiple_receive_handler().
Definition at line 324 of file network_manager_ana.hpp.
Referenced by get_wesnoth_id(), and handle_receive().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:12:43 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |