aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/lliosocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/lliosocket.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/linden/indra/llmessage/lliosocket.cpp b/linden/indra/llmessage/lliosocket.cpp
index 2667a0e..26fd0b2 100644
--- a/linden/indra/llmessage/lliosocket.cpp
+++ b/linden/indra/llmessage/lliosocket.cpp
@@ -14,12 +14,12 @@
14 * ("GPL"), unless you have obtained a separate licensing agreement 14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * ("Other License"), formally executed by you and Linden Lab. Terms of 15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * the GPL can be found in doc/GPL-license.txt in this distribution, or 16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlife.com/developers/opensource/gplv2 17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 * 18 *
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlife.com/developers/opensource/flossexception 22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 23 *
24 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -64,6 +64,40 @@ bool is_addr_in_use(apr_status_t status)
64#endif 64#endif
65} 65}
66 66
67#if LL_LINUX
68// Define this to see the actual file descriptors being tossed around.
69//#define LL_DEBUG_SOCKET_FILE_DESCRIPTORS 1
70#if LL_DEBUG_SOCKET_FILE_DESCRIPTORS
71#include "apr-1/apr_portable.h"
72#endif
73#endif
74
75
76// Quick function
77void ll_debug_socket(const char* msg, apr_socket_t* apr_sock)
78{
79#if LL_DEBUG_SOCKET_FILE_DESCRIPTORS
80 if(!apr_sock)
81 {
82 lldebugs << "Socket -- " << (msg?msg:"") << ": no socket." << llendl;
83 return;
84 }
85 // *TODO: Why doesn't this work?
86 //apr_os_sock_t os_sock;
87 int os_sock;
88 if(APR_SUCCESS == apr_os_sock_get(&os_sock, apr_sock))
89 {
90 lldebugs << "Socket -- " << (msg?msg:"") << " on fd " << os_sock
91 << " at " << apr_sock << llendl;
92 }
93 else
94 {
95 lldebugs << "Socket -- " << (msg?msg:"") << " no fd "
96 << " at " << apr_sock << llendl;
97 }
98#endif
99}
100
67/// 101///
68/// LLSocket 102/// LLSocket
69/// 103///
@@ -199,6 +233,7 @@ bool LLSocket::blockingConnect(const LLHost& host)
199 return false; 233 return false;
200 } 234 }
201 apr_socket_timeout_set(mSocket, 1000); 235 apr_socket_timeout_set(mSocket, 1000);
236 ll_debug_socket("Blocking connect", mSocket);
202 if(ll_apr_warn_status(apr_socket_connect(mSocket, sa))) return false; 237 if(ll_apr_warn_status(apr_socket_connect(mSocket, sa))) return false;
203 setOptions(); 238 setOptions();
204 return true; 239 return true;
@@ -209,6 +244,7 @@ LLSocket::LLSocket(apr_socket_t* socket, apr_pool_t* pool) :
209 mPool(pool), 244 mPool(pool),
210 mPort(PORT_INVALID) 245 mPort(PORT_INVALID)
211{ 246{
247 ll_debug_socket("Constructing wholely formed socket", mSocket);
212 LLMemType m1(LLMemType::MTYPE_IO_TCP); 248 LLMemType m1(LLMemType::MTYPE_IO_TCP);
213} 249}
214 250
@@ -216,9 +252,9 @@ LLSocket::~LLSocket()
216{ 252{
217 LLMemType m1(LLMemType::MTYPE_IO_TCP); 253 LLMemType m1(LLMemType::MTYPE_IO_TCP);
218 // *FIX: clean up memory we are holding. 254 // *FIX: clean up memory we are holding.
219 //lldebugs << "Destroying LLSocket" << llendl;
220 if(mSocket) 255 if(mSocket)
221 { 256 {
257 ll_debug_socket("Destroying socket", mSocket);
222 apr_socket_close(mSocket); 258 apr_socket_close(mSocket);
223 } 259 }
224 if(mPool) 260 if(mPool)