Panda3D
Loading...
Searching...
No Matches
queuedConnectionManager.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file queuedConnectionManager.cxx
10 * @author drose
11 * @date 2000-02-09
12 */
13
15
16#include <algorithm>
17
18template class QueuedReturn< PT(Connection) >;
19
20/**
21 *
22 */
23QueuedConnectionManager::
24QueuedConnectionManager() {
25}
26
27/**
28 *
29 */
30QueuedConnectionManager::
31~QueuedConnectionManager() {
32}
33
34/**
35 * Returns true if one of the readers/writers/listeners reported a connection
36 * reset recently. If so, the particular connection that has been reset can
37 * be extracted via get_reset_connection().
38 *
39 * Only connections which were externally reset are certain to appear in this
40 * list. Those which were explicitly closed via a call to close_connection()
41 * may or may not be reported. Furthermore, it is the responsibility of the
42 * caller to subsequently call close_connection() with any connection reported
43 * reset by this call. (There is no harm in calling close_connection() more
44 * than once on a given socket.)
45 */
48 return thing_available();
49}
50
51/**
52 * If a previous call to reset_connection_available() returned true, this
53 * function will return information about the newly reset connection.
54 *
55 * Only connections which were externally reset are certain to appear in this
56 * list. Those which were explicitly closed via a call to close_connection()
57 * may or may not be reported. Furthermore, it is the responsibility of the
58 * caller to subsequently call close_connection() with any connection reported
59 * reset by this call. (There is no harm in calling close_connection() more
60 * than once on a given socket.)
61 *
62 * The return value is true if a connection was successfully returned, or
63 * false if there was, in fact, no reset connection. (This may happen if
64 * there are multiple threads accessing the QueuedConnectionManager).
65 */
67get_reset_connection(PT(Connection) &connection) {
68 return get_thing(connection);
69}
70
71
72/**
73 * An internal function called by the ConnectionReader, ConnectionWriter, or
74 * ConnectionListener when a connection has been externally reset. This adds
75 * the connection to the queue of those which have recently been reset.
76 */
77void QueuedConnectionManager::
78connection_reset(const PT(Connection) &connection, bool okflag) {
79 ConnectionManager::connection_reset(connection, okflag);
80
81 // Largely, we don't care if this particular queue fills up. If it does, it
82 // probably just means the user isn't bothering to track this.
83 enqueue_unique_thing(connection);
84}
Represents a single TCP or UDP socket for input or output.
Definition connection.h:29
bool reset_connection_available() const
Returns true if one of the readers/writers/listeners reported a connection reset recently.
bool get_reset_connection(PT(Connection) &connection)
If a previous call to reset_connection_available() returned true, this function will return informati...
This is the implementation of a family of things that queue up their return values for later retrieva...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.