Panda3D
|
This is the class that does all the work for handling communications from a single Panda client. More...
#include "pStatReader.h"
Public Member Functions | |
PStatReader (PStatServer *manager, PStatMonitor *monitor) | |
void | close () |
This will be called by the PStatClientData in response to its close() call. More... | |
PStatMonitor * | get_monitor () |
Returns the monitor that this reader serves. More... | |
void | idle () |
Called each frame to do what needs to be done for the monitor's user-defined idle routines. More... | |
void | lost_connection () |
This is called by the PStatServer when it detects that the connection has been lost. More... | |
void | set_tcp_connection (Connection *tcp_connection) |
This is intended to be called only once, immediately after construction, by the PStatListener that created it. More... | |
![]() | |
ConnectionReader (ConnectionManager *manager, int num_threads, const string &thread_name=string()) | |
Creates a new ConnectionReader with the indicated number of threads to handle requests. More... | |
bool | add_connection (Connection *connection) |
Adds a new socket to the list of sockets the ConnectionReader will monitor. More... | |
ConnectionManager * | get_manager () const |
Returns a pointer to the ConnectionManager object that serves this ConnectionReader. More... | |
int | get_num_threads () const |
Returns the number of threads the ConnectionReader has been created with. More... | |
bool | get_raw_mode () const |
Returns the current setting of the raw mode flag. More... | |
int | get_tcp_header_size () const |
Returns the current setting of TCP header size. More... | |
bool | is_connection_ok (Connection *connection) |
Returns true if the indicated connection has been added to the ConnectionReader and is being monitored properly, false if it is not known, or if there was some error condition detected on the connection. More... | |
bool | is_polling () const |
Returns true if the reader is a polling reader, i.e. More... | |
void | poll () |
Explicitly polls the available sockets to see if any of them have any noise. More... | |
bool | remove_connection (Connection *connection) |
Removes a socket from the list of sockets being monitored. More... | |
void | set_raw_mode (bool mode) |
Sets the ConnectionReader into raw mode (or turns off raw mode). More... | |
void | set_tcp_header_size (int tcp_header_size) |
Sets the header size of TCP packets. More... | |
void | shutdown () |
Terminates all threads cleanly. More... | |
This is the class that does all the work for handling communications from a single Panda client.
It reads sockets received from the client and boils them down into PStatData.
Definition at line 44 of file pStatReader.h.
void PStatReader::close | ( | ) |
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 69 of file pStatReader.cxx.
References set_tcp_connection().
PStatMonitor * PStatReader::get_monitor | ( | ) |
Returns the monitor that this reader serves.
Definition at line 137 of file pStatReader.cxx.
References PStatClientControlMessage::decode(), PStatServerControlMessage::encode(), ConnectionManager::get_host_name(), DatagramIterator::get_uint16(), DatagramIterator::get_uint32(), DatagramIterator::get_uint8(), and PStatFrameData::read_datagram().
Referenced by idle().
void PStatReader::idle | ( | ) |
Called each frame to do what needs to be done for the monitor's user-defined idle routines.
Definition at line 126 of file pStatReader.cxx.
References get_monitor().
Referenced by lost_connection(), and PStatServer::poll().
void PStatReader::lost_connection | ( | ) |
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 108 of file pStatReader.cxx.
References idle().
Referenced by PStatServer::poll(), and set_tcp_connection().
void PStatReader::set_tcp_connection | ( | Connection * | tcp_connection | ) |
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 83 of file pStatReader.cxx.
References lost_connection().
Referenced by close().