Panda3D
Public Member Functions | List of all members
QueuedConnectionListener Class Reference

This flavor of ConnectionListener will queue up all of the TCP connections it established for later detection by the client code. More...

#include "queuedConnectionListener.h"

Inheritance diagram for QueuedConnectionListener:
ConnectionListener QueuedReturn< ConnectionListenerData > ConnectionReader

Public Member Functions

 QueuedConnectionListener (ConnectionManager *manager, int num_threads)
 
bool get_new_connection (PT(Connection) &rendezvous, NetAddress &address, PT(Connection) &new_connection)
 If a previous call to new_connection_available() returned true, this function will return information about the newly established connection. More...
 
bool get_new_connection (PT(Connection) &new_connection)
 This flavor of get_new_connection() simply returns a new connection, assuming the user doesn't care about the rendezvous socket that originated it or the address it came from. More...
 
bool new_connection_available ()
 Returns true if a new connection was recently established; the connection information may then be retrieved via get_new_connection(). More...
 
- Public Member Functions inherited from ConnectionListener
 ConnectionListener (ConnectionManager *manager, int num_threads, const std::string &thread_name=std::string())
 
- Public Member Functions inherited from ConnectionReader
 ConnectionReader (ConnectionManager *manager, int num_threads, const std::string &thread_name=std::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...
 
ConnectionManagerget_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...
 
- Public Member Functions inherited from QueuedReturn< ConnectionListenerData >
int get_current_queue_size () const
 Returns the current number of things in the queue. More...
 
int get_max_queue_size () const
 Returns the maximum size the queue is allowed to grow to. More...
 
bool get_overflow_flag () const
 Returns true if the queue has overflowed since the last call to reset_overflow_flag() (implying that some elements have been dropped from the queue), or false otherwise. More...
 
void reset_overflow_flag ()
 Resets the overflow flag so that get_overflow_flag() will return false until a new overflow occurs. More...
 
void set_max_queue_size (int max_size)
 Sets the maximum size the queue is allowed to grow to. More...
 

Detailed Description

This flavor of ConnectionListener will queue up all of the TCP connections it established for later detection by the client code.

Definition at line 45 of file queuedConnectionListener.h.

Member Function Documentation

◆ get_new_connection() [1/2]

bool QueuedConnectionListener::get_new_connection ( PT(Connection) &  rendezvous,
NetAddress address,
PT(Connection) &  new_connection 
)

If a previous call to new_connection_available() returned true, this function will return information about the newly established connection.

The rendezvous parameter is the particular rendezvous socket this new connection originally communicated with; it is provided in case the ConnectionListener was monitorind more than one and you care which one it was. The address parameter is the net address of the new client, and new_connection is the socket of the newly established connection.

The return value is true if a connection was successfully returned, or false if there was, in fact, no new connection. (This may happen if there are multiple threads accessing the QueuedConnectionListener).

Definition at line 63 of file queuedConnectionListener.cxx.

Referenced by MayaToEggServer::poll().

◆ get_new_connection() [2/2]

bool QueuedConnectionListener::get_new_connection ( PT(Connection) &  new_connection)

This flavor of get_new_connection() simply returns a new connection, assuming the user doesn't care about the rendezvous socket that originated it or the address it came from.

Definition at line 83 of file queuedConnectionListener.cxx.

◆ new_connection_available()

bool QueuedConnectionListener::new_connection_available ( )

Returns true if a new connection was recently established; the connection information may then be retrieved via get_new_connection().

Definition at line 43 of file queuedConnectionListener.cxx.

References ConnectionReader::poll().

Referenced by MayaToEggServer::poll().


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