|
|
@@ -89,7 +89,7 @@ thread_main() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::Constructor
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Creates a new ConnectionReader with the indicated
|
|
|
// number of threads to handle requests. If num_threads
|
|
|
// is 0, the sockets will only be read by polling,
|
|
|
@@ -137,7 +137,7 @@ ConnectionReader(ConnectionManager *manager, int num_threads) :
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::Destructor
|
|
|
-// Access: Public, Virtual
|
|
|
+// Access: Published, Virtual
|
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
ConnectionReader::
|
|
|
@@ -170,7 +170,7 @@ ConnectionReader::
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::add_connection
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Adds a new socket to the list of sockets the
|
|
|
// ConnectionReader will monitor. A datagram that comes
|
|
|
// in on any of the monitored sockets will be reported.
|
|
|
@@ -207,7 +207,7 @@ add_connection(Connection *connection) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::remove_connection
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Removes a socket from the list of sockets being
|
|
|
// monitored. Returns true if the socket was correctly
|
|
|
// removed, false if it was not on the list in the first
|
|
|
@@ -238,7 +238,7 @@ remove_connection(Connection *connection) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::is_connection_ok
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: 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
|
|
|
@@ -271,7 +271,7 @@ is_connection_ok(Connection *connection) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::poll
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Explicitly polls the available sockets to see if any
|
|
|
// of them have any noise. This function does nothing
|
|
|
// unless this is a polling-type ConnectionReader,
|
|
|
@@ -315,7 +315,7 @@ poll() {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::get_manager
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns a pointer to the ConnectionManager object
|
|
|
// that serves this ConnectionReader.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -326,7 +326,7 @@ get_manager() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::get_num_threads
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the number of threads the ConnectionReader
|
|
|
// has been created with.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -337,7 +337,7 @@ get_num_threads() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::set_raw_mode
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Sets the ConnectionReader into raw mode (or turns off
|
|
|
// raw mode). In raw mode, datagram headers are not
|
|
|
// expected; instead, all the data available on the pipe
|
|
|
@@ -353,7 +353,7 @@ set_raw_mode(bool mode) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::get_raw_mode
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the current setting of the raw mode flag.
|
|
|
// See set_raw_mode().
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -364,7 +364,7 @@ get_raw_mode() const {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::set_tcp_header_size
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Sets the header size of TCP packets. At the present,
|
|
|
// legal values for this are 0, 2, or 4; this specifies
|
|
|
// the number of bytes to use encode the datagram length
|
|
|
@@ -378,7 +378,7 @@ set_tcp_header_size(int tcp_header_size) {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::get_tcp_header_size
|
|
|
-// Access: Public
|
|
|
+// Access: Published
|
|
|
// Description: Returns the current setting of TCP header size.
|
|
|
// See set_tcp_header_size().
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
@@ -387,6 +387,30 @@ get_tcp_header_size() const {
|
|
|
return _tcp_header_size;
|
|
|
}
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: ConnectionReader::shutdown
|
|
|
+// Access: Published
|
|
|
+// Description: Terminates all threads cleanly. Normally this is
|
|
|
+// only called by the destructor, but it may be called
|
|
|
+// explicitly before destruction.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+void ConnectionReader::
|
|
|
+shutdown() {
|
|
|
+ if (_shutdown) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // First, begin the shutdown. This will tell our threads we want
|
|
|
+ // them to quit.
|
|
|
+ _shutdown = true;
|
|
|
+
|
|
|
+ // Now wait for all of our threads to terminate.
|
|
|
+ Threads::iterator ti;
|
|
|
+ for (ti = _threads.begin(); ti != _threads.end(); ++ti) {
|
|
|
+ (*ti)->join();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::flush_read_connection
|
|
|
// Access: Protected, Virtual
|
|
|
@@ -426,29 +450,6 @@ flush_read_connection(Connection *connection) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
-// Function: ConnectionReader::shutdown
|
|
|
-// Access: Protected
|
|
|
-// Description: Terminates all threads cleanly. Normally this is
|
|
|
-// only called by the destructor.
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
-void ConnectionReader::
|
|
|
-shutdown() {
|
|
|
- if (_shutdown) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // First, begin the shutdown. This will tell our threads we want
|
|
|
- // them to quit.
|
|
|
- _shutdown = true;
|
|
|
-
|
|
|
- // Now wait for all of our threads to terminate.
|
|
|
- Threads::iterator ti;
|
|
|
- for (ti = _threads.begin(); ti != _threads.end(); ++ti) {
|
|
|
- (*ti)->join();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: ConnectionReader::clear_manager
|
|
|
// Access: Protected
|