aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/lliosocket.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmessage/lliosocket.h')
-rw-r--r--linden/indra/llmessage/lliosocket.h33
1 files changed, 9 insertions, 24 deletions
diff --git a/linden/indra/llmessage/lliosocket.h b/linden/indra/llmessage/lliosocket.h
index ec09ad8..5ad75e9 100644
--- a/linden/indra/llmessage/lliosocket.h
+++ b/linden/indra/llmessage/lliosocket.h
@@ -44,7 +44,6 @@
44 */ 44 */
45 45
46#include "lliopipe.h" 46#include "lliopipe.h"
47#include "apr_pools.h"
48#include "apr_network_io.h" 47#include "apr_network_io.h"
49#include "llchainio.h" 48#include "llchainio.h"
50 49
@@ -94,34 +93,22 @@ public:
94 * socket. If you intend the socket to be known to external 93 * socket. If you intend the socket to be known to external
95 * clients without prior port notification, do not use 94 * clients without prior port notification, do not use
96 * PORT_EPHEMERAL. 95 * PORT_EPHEMERAL.
97 * @param pool The apr pool to use. A child pool will be created
98 * and associated with the socket.
99 * @param type The type of socket to create 96 * @param type The type of socket to create
100 * @param port The port for the socket 97 * @param port The port for the socket
101 * @return A valid socket shared pointer if the call worked. 98 * @return A valid socket shared pointer if the call worked.
102 */ 99 */
103 static ptr_t create( 100 static ptr_t create(
104 apr_pool_t* pool,
105 EType type, 101 EType type,
106 U16 port = PORT_EPHEMERAL); 102 U16 port = PORT_EPHEMERAL);
107 103
108 /** 104 /**
109 * @brief Create a LLSocket when you already have an apr socket. 105 * @brief Create a LLSocket by accepting a connection from a listen socket.
110 * 106 *
111 * This method assumes an ephemeral port. This is typically used 107 * @param status Output. Status of the accept if a valid listen socket was passed.
112 * by calls which spawn a socket such as a call to 108 * @param listen_socket The listen socket to use.
113 * <code>accept()</code> as in the server socket. This call should
114 * not fail if you have a valid apr socket.
115 * Because of the nature of how accept() works, you are expected
116 * to create a new pool for the socket, use that pool for the
117 * accept, and pass it in here where it will be bound with the
118 * socket and destroyed at the same time.
119 * @param socket The apr socket to use
120 * @param pool The pool used to create the socket. *NOTE: The pool
121 * passed in will be DESTROYED.
122 * @return A valid socket shared pointer if the call worked. 109 * @return A valid socket shared pointer if the call worked.
123 */ 110 */
124 static ptr_t create(apr_socket_t* socket, apr_pool_t* pool); 111 static ptr_t create(apr_status_t& status, ptr_t& listen_socket);
125 112
126 /** 113 /**
127 * @brief Perform a blocking connect to a host. Do not use in production. 114 * @brief Perform a blocking connect to a host. Do not use in production.
@@ -156,7 +143,7 @@ protected:
156 * @brief Protected constructor since should only make sockets 143 * @brief Protected constructor since should only make sockets
157 * with one of the two <code>create()</code> calls. 144 * with one of the two <code>create()</code> calls.
158 */ 145 */
159 LLSocket(apr_socket_t* socket, apr_pool_t* pool); 146 LLSocket(void);
160 147
161 /** 148 /**
162 * @brief Set default socket options. 149 * @brief Set default socket options.
@@ -173,8 +160,8 @@ protected:
173 // The apr socket. 160 // The apr socket.
174 apr_socket_t* mSocket; 161 apr_socket_t* mSocket;
175 162
176 // our memory pool 163 // Our memory pool.
177 apr_pool_t* mPool; 164 AIAPRPool mPool;
178 165
179 // The port if we know it. 166 // The port if we know it.
180 U16 mPort; 167 U16 mPort;
@@ -299,7 +286,7 @@ class LLIOServerSocket : public LLIOPipe
299public: 286public:
300 typedef LLSocket::ptr_t socket_t; 287 typedef LLSocket::ptr_t socket_t;
301 typedef boost::shared_ptr<LLChainIOFactory> factory_t; 288 typedef boost::shared_ptr<LLChainIOFactory> factory_t;
302 LLIOServerSocket(apr_pool_t* pool, socket_t listener, factory_t reactor); 289 LLIOServerSocket(socket_t listener, factory_t reactor);
303 virtual ~LLIOServerSocket(); 290 virtual ~LLIOServerSocket();
304 291
305 /** 292 /**
@@ -331,7 +318,6 @@ protected:
331 //@} 318 //@}
332 319
333protected: 320protected:
334 apr_pool_t* mPool;
335 socket_t mListenSocket; 321 socket_t mListenSocket;
336 factory_t mReactor; 322 factory_t mReactor;
337 bool mInitialized; 323 bool mInitialized;
@@ -365,8 +351,7 @@ public:
365 */ 351 */
366 LLIODataSocket( 352 LLIODataSocket(
367 U16 suggested_port, 353 U16 suggested_port,
368 U16 start_discovery_port, 354 U16 start_discovery_port);
369 apr_pool_t* pool);
370 virtual ~LLIODataSocket(); 355 virtual ~LLIODataSocket();
371 356
372protected: 357protected: