#include <pStatReader.h>
Inheritance diagram for PStatReader:
Public Member Functions | |
PStatReader (PStatServer *manager, PStatMonitor *monitor) | |
~PStatReader () | |
void | close () |
This will be called by the PStatClientData in response to its close() call. | |
void | set_tcp_connection (Connection *tcp_connection) |
This is intended to be called only once, immediately after construction, by the PStatListener that created it. | |
void | lost_connection () |
This is called by the PStatServer when it detects that the connection has been lost. | |
void | idle () |
Called each frame to do what needs to be done for the monitor's user-defined idle routines. | |
bool | add_connection (const PointerTo< Connection > &connection) |
bool | remove_connection (const PointerTo< Connection > &connection) |
bool | is_connection_ok (const PointerTo< Connection > &connection) |
void | poll () |
ConnectionManager * | get_manager () const |
bool | is_polling () const |
int | get_num_threads () const |
void | set_raw_mode (bool mode) |
bool | get_raw_mode () const |
void | shutdown () |
void | clear_manager () |
void | finish_socket (SocketInfo *sinfo) |
virtual void | process_incoming_data (SocketInfo *sinfo) |
virtual void | process_incoming_udp_data (SocketInfo *sinfo) |
virtual void | process_incoming_tcp_data (SocketInfo *sinfo) |
virtual void | process_raw_incoming_udp_data (SocketInfo *sinfo) |
virtual void | process_raw_incoming_tcp_data (SocketInfo *sinfo) |
Protected Member Functions | |
void | thread_run () |
SocketInfo * | get_next_available_socket (PRIntervalTime timeout, PRInt32 current_thread_index) |
void | rebuild_poll_list () |
Static Protected Member Functions | |
void | thread_start (void *data) |
Protected Attributes | |
pvector< PRThread * > | Threads |
pvector< PRPollDesc > | Poll |
pvector< SocketInfo * > | Sockets |
bool | _raw_mode |
bool | _shutdown |
Threads | _threads |
PRLock * | _startup_mutex |
bool | _polling |
Poll | _poll |
Sockets | _polled_sockets |
int | _next_index |
int | _num_results |
PRLock * | _select_mutex |
PRInt32 | _currently_polling_thread |
Sockets | _sockets |
Sockets | _removed_sockets |
bool | _reexamine_sockets |
PRLock * | _sockets_mutex |
Private Types | |
typedef CircBuffer< FrameData, queued_frame_records > | QueuedFrameData |
Private Member Functions | |
string | get_hostname () |
Returns the current machine's hostname. | |
void | send_hello () |
Sends the initial greeting message to the client. | |
virtual void | receive_datagram (const NetDatagram &datagram) |
Called by the net code whenever a new datagram is detected on a either the TCP or UDP connection. | |
void | handle_client_control_message (const PStatClientControlMessage &message) |
Called when a control message has been received by the client over the TCP connection. | |
void | handle_client_udp_data (const Datagram &datagram) |
Called when a UDP datagram has been received by the client. | |
void | dequeue_frame_data () |
Called during the idle loop to pull out all the frame data that we might have read while the threaded reader was running. | |
Private Attributes | |
PStatServer * | _manager |
PointerTo< PStatMonitor > | _monitor |
ConnectionWriter | _writer |
PointerTo< Connection > | _tcp_connection |
PointerTo< Connection > | _udp_connection |
int | _udp_port |
PointerTo< PStatClientData > | _client_data |
string | _hostname |
QueuedFrameData | _queued_frame_data |
Friends | |
class | ConnectionManager |
It reads sockets received from the client and boils them down into PStatData.
Definition at line 57 of file pStatReader.h.
|
Definition at line 97 of file pStatReader.h. |
|
Definition at line 42 of file pStatReader.cxx. References _client_data, _monitor, and _udp_port. |
|
Definition at line 61 of file pStatReader.cxx. References _manager, _tcp_connection, lost_connection(), and PStatServer::remove_reader(). |
|
This will be called by the PStatClientData in response to its close() call. It will tell the server to let go of the reader so it can shut down its connection. Definition at line 80 of file pStatReader.cxx. References _manager, _tcp_connection, _udp_connection, _udp_port, ConnectionReader::add_connection(), PStatServer::get_udp_port(), PointerTo< Connection >::is_null(), ConnectionManager::open_UDP_connection(), and send_hello(). |
|
Called during the idle loop to pull out all the frame data that we might have read while the threaded reader was running.
Definition at line 344 of file pStatReader.cxx. |
|
Returns the current machine's hostname.
Definition at line 166 of file pStatReader.cxx. References _client_data, _tcp_connection, PStatClientControlMessage::_type, PStatClientControlMessage::decode(), NetDatagram::get_connection(), handle_client_control_message(), handle_client_udp_data(), nout, and PStatClientControlMessage::T_datagram. |
|
Called when a control message has been received by the client over the TCP connection.
Definition at line 242 of file pStatReader.cxx. References nout. Referenced by get_hostname(). |
|
Called when a UDP datagram has been received by the client. This should be a single frame's worth of data. Definition at line 301 of file pStatReader.cxx. References _client_data, and _monitor. Referenced by get_hostname(). |
|
Called each frame to do what needs to be done for the monitor's user-defined idle routines.
Definition at line 152 of file pStatReader.cxx. References _monitor, _udp_port, _writer, and PStatServerControlMessage::T_hello. |
|
This is called by the PStatServer when it detects that the connection has been lost. It should clean itself up and shut down nicely. Definition at line 130 of file pStatReader.cxx. References _hostname, and ConnectionManager::get_host_name(). Referenced by ~PStatReader(). |
|
Called by the net code whenever a new datagram is detected on a either the TCP or UDP connection.
Implements ConnectionReader. Definition at line 208 of file pStatReader.cxx. References PStatClientControlMessage::_client_hostname, PStatClientControlMessage::_client_progname, PStatClientControlMessage::_major_version, PStatClientControlMessage::_minor_version, and _monitor. |
|
Sends the initial greeting message to the client.
Definition at line 185 of file pStatReader.cxx. Referenced by close(). |
|
This is intended to be called only once, immediately after construction, by the PStatListener that created it. It tells the reader about the newly-established TCP connection to a client. Definition at line 100 of file pStatReader.cxx. References _client_data, _manager, _monitor, _tcp_connection, _udp_connection, PointerTo< Connection >::clear(), PointerTo< PStatClientData >::clear(), and ConnectionManager::close_connection(). |
|
Definition at line 87 of file pStatReader.h. Referenced by get_hostname(), handle_client_udp_data(), PStatReader(), and set_tcp_connection(). |
|
Definition at line 89 of file pStatReader.h. Referenced by lost_connection(). |
|
Reimplemented from ConnectionReader. Definition at line 79 of file pStatReader.h. Referenced by close(), set_tcp_connection(), and ~PStatReader(). |
|
Definition at line 80 of file pStatReader.h. Referenced by handle_client_udp_data(), idle(), PStatReader(), receive_datagram(), and set_tcp_connection(). |
|
Definition at line 98 of file pStatReader.h. |
|
Definition at line 83 of file pStatReader.h. Referenced by close(), get_hostname(), set_tcp_connection(), and ~PStatReader(). |
|
Definition at line 84 of file pStatReader.h. Referenced by close(), and set_tcp_connection(). |
|
Definition at line 85 of file pStatReader.h. Referenced by close(), idle(), and PStatReader(). |
|
Definition at line 81 of file pStatReader.h. Referenced by idle(). |