summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2019-04-26 11:17:53 -0400
committerNat Goodspeed <nat@lindenlab.com>2019-04-26 11:17:53 -0400
commit0d596aa4de2f583862274350ce6287c0ed8c2bec (patch)
tree90a6ca5b29d5c99b585233d059e16dccc23a2e19 /indra/llmessage
parent70aa89f708254c47766f4629e9131ea492829129 (diff)
parent85b431d5137886927efef35ca558bc8a998a5212 (diff)
Automated merge with file:///Users/nat/linden/viewer-gridselect
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llbuffer.cpp2
-rw-r--r--indra/llmessage/lliosocket.cpp2
-rw-r--r--indra/llmessage/llproxy.cpp10
-rw-r--r--indra/llmessage/llproxy.h2
-rw-r--r--indra/llmessage/llpumpio.cpp54
-rw-r--r--indra/llmessage/llpumpio.h11
6 files changed, 10 insertions, 71 deletions
diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp
index d07d9980c3..1a0eceba0f 100644
--- a/indra/llmessage/llbuffer.cpp
+++ b/indra/llmessage/llbuffer.cpp
@@ -265,7 +265,7 @@ void LLBufferArray::setThreaded(bool threaded)
{
if(!mMutexp)
{
- mMutexp = new LLMutex(NULL);
+ mMutexp = new LLMutex();
}
}
else
diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp
index b15b98db80..7caf0766b7 100644
--- a/indra/llmessage/lliosocket.cpp
+++ b/indra/llmessage/lliosocket.cpp
@@ -265,7 +265,7 @@ LLSocket::~LLSocket()
void LLSocket::setBlocking(S32 timeout)
{
// set up the socket options
- ll_apr_warn_status(apr_socket_timeout_set(mSocket, timeout));
+ ll_apr_warn_status(apr_socket_timeout_set(mSocket, timeout)); // Sets both receive and send timeout SO_RCVTIMEO, SO_SNDTIMEO
ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_NONBLOCK, 0));
ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_SNDBUF, LL_SEND_BUFFER_SIZE));
ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_RCVBUF, LL_RECV_BUFFER_SIZE));
diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp
index 537efa69d8..dea03aab85 100644
--- a/indra/llmessage/llproxy.cpp
+++ b/indra/llmessage/llproxy.cpp
@@ -48,7 +48,7 @@ static void tcp_close_channel(LLSocket::ptr_t* handle_ptr); // Close an open TCP
LLProxy::LLProxy():
mHTTPProxyEnabled(false),
- mProxyMutex(NULL),
+ mProxyMutex(),
mUDPProxy(),
mTCPProxy(),
mHTTPProxy(),
@@ -473,7 +473,8 @@ static apr_status_t tcp_blocking_handshake(LLSocket::ptr_t handle, char * dataou
rv = apr_socket_send(apr_socket, dataout, &outlen);
if (APR_SUCCESS != rv)
{
- LL_WARNS("Proxy") << "Error sending data to proxy control channel, status: " << rv << LL_ENDL;
+ char buf[MAX_STRING];
+ LL_WARNS("Proxy") << "Error sending data to proxy control channel, status: " << rv << " " << apr_strerror(rv, buf, MAX_STRING) << LL_ENDL;
ll_apr_warn_status(rv);
}
else if (expected_len != outlen)
@@ -483,13 +484,16 @@ static apr_status_t tcp_blocking_handshake(LLSocket::ptr_t handle, char * dataou
rv = -1;
}
+ ms_sleep(1);
+
if (APR_SUCCESS == rv)
{
expected_len = maxinlen;
rv = apr_socket_recv(apr_socket, datain, &maxinlen);
if (rv != APR_SUCCESS)
{
- LL_WARNS("Proxy") << "Error receiving data from proxy control channel, status: " << rv << LL_ENDL;
+ char buf[MAX_STRING];
+ LL_WARNS("Proxy") << "Error receiving data from proxy control channel, status: " << rv << " " << apr_strerror(rv, buf, MAX_STRING) << LL_ENDL;
ll_apr_warn_status(rv);
}
else if (expected_len < maxinlen)
diff --git a/indra/llmessage/llproxy.h b/indra/llmessage/llproxy.h
index 688dff7c83..87891901ad 100644
--- a/indra/llmessage/llproxy.h
+++ b/indra/llmessage/llproxy.h
@@ -298,7 +298,7 @@ private:
private:
// Is the HTTP proxy enabled? Safe to read in any thread, but do not write directly.
// Instead use enableHTTPProxy() and disableHTTPProxy() instead.
- mutable LLAtomic32<bool> mHTTPProxyEnabled;
+ mutable LLAtomicBool mHTTPProxyEnabled;
// Mutex to protect shared members in non-main thread calls to applyProxySettings().
mutable LLMutex mProxyMutex;
diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp
index 506ccc98a4..a2524e9804 100644
--- a/indra/llmessage/llpumpio.cpp
+++ b/indra/llmessage/llpumpio.cpp
@@ -54,11 +54,7 @@
// constants for poll timeout. if we are threading, we want to have a
// longer poll timeout.
-#if LL_THREADS_APR
-static const S32 DEFAULT_POLL_TIMEOUT = 1000;
-#else
static const S32 DEFAULT_POLL_TIMEOUT = 0;
-#endif
// The default (and fallback) expiration time for chains
const F32 DEFAULT_CHAIN_EXPIRY_SECS = 30.0f;
@@ -169,8 +165,6 @@ LLPumpIO::LLPumpIO(apr_pool_t* pool) :
mPool(NULL),
mCurrentPool(NULL),
mCurrentPoolReallocCount(0),
- mChainsMutex(NULL),
- mCallbackMutex(NULL),
mCurrentChain(mRunningChains.end())
{
mCurrentChain = mRunningChains.end();
@@ -194,9 +188,6 @@ bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request
{
if(chain.empty()) return false;
-#if LL_THREADS_APR
- LLScopedLock lock(mChainsMutex);
-#endif
LLChainInfo info;
info.mHasCurlRequest = has_curl_request;
info.setTimeoutSeconds(timeout);
@@ -234,9 +225,6 @@ bool LLPumpIO::addChain(
if(!data) return false;
if(links.empty()) return false;
-#if LL_THREADS_APR
- LLScopedLock lock(mChainsMutex);
-#endif
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << " '"
<< typeid(*(links[0].mPipe)).name() << "'" << LL_ENDL;
@@ -391,9 +379,6 @@ void LLPumpIO::clearLock(S32 key)
// therefore won't be treading into deleted memory. I think we can
// also clear the lock on the chain safely since the pump only
// reads that value.
-#if LL_THREADS_APR
- LLScopedLock lock(mChainsMutex);
-#endif
mClearLocks.insert(key);
}
@@ -457,9 +442,6 @@ void LLPumpIO::pump(const S32& poll_timeout)
PUMP_DEBUG;
if(true)
{
-#if LL_THREADS_APR
- LLScopedLock lock(mChainsMutex);
-#endif
// bail if this pump is paused.
if(PAUSING == mState)
{
@@ -724,25 +706,10 @@ void LLPumpIO::pump(const S32& poll_timeout)
END_PUMP_DEBUG;
}
-//bool LLPumpIO::respond(const chain_t& pipes)
-//{
-//#if LL_THREADS_APR
-// LLScopedLock lock(mCallbackMutex);
-//#endif
-// LLChainInfo info;
-// links_t links;
-//
-// mPendingCallbacks.push_back(info);
-// return true;
-//}
-
bool LLPumpIO::respond(LLIOPipe* pipe)
{
if(NULL == pipe) return false;
-#if LL_THREADS_APR
- LLScopedLock lock(mCallbackMutex);
-#endif
LLChainInfo info;
LLLinkInfo link;
link.mPipe = pipe;
@@ -761,10 +728,6 @@ bool LLPumpIO::respond(
if(!data) return false;
if(links.empty()) return false;
-#if LL_THREADS_APR
- LLScopedLock lock(mCallbackMutex);
-#endif
-
// Add the callback response
LLChainInfo info;
info.mChainLinks = links;
@@ -781,9 +744,6 @@ void LLPumpIO::callback()
//LL_INFOS() << "LLPumpIO::callback()" << LL_ENDL;
if(true)
{
-#if LL_THREADS_APR
- LLScopedLock lock(mCallbackMutex);
-#endif
std::copy(
mPendingCallbacks.begin(),
mPendingCallbacks.end(),
@@ -809,9 +769,6 @@ void LLPumpIO::callback()
void LLPumpIO::control(LLPumpIO::EControl op)
{
-#if LL_THREADS_APR
- LLScopedLock lock(mChainsMutex);
-#endif
switch(op)
{
case PAUSE:
@@ -829,22 +786,11 @@ void LLPumpIO::control(LLPumpIO::EControl op)
void LLPumpIO::initialize(apr_pool_t* pool)
{
if(!pool) return;
-#if LL_THREADS_APR
- // SJB: Windows defaults to NESTED and OSX defaults to UNNESTED, so use UNNESTED explicitly.
- apr_thread_mutex_create(&mChainsMutex, APR_THREAD_MUTEX_UNNESTED, pool);
- apr_thread_mutex_create(&mCallbackMutex, APR_THREAD_MUTEX_UNNESTED, pool);
-#endif
mPool = pool;
}
void LLPumpIO::cleanup()
{
-#if LL_THREADS_APR
- if(mChainsMutex) apr_thread_mutex_destroy(mChainsMutex);
- if(mCallbackMutex) apr_thread_mutex_destroy(mCallbackMutex);
-#endif
- mChainsMutex = NULL;
- mCallbackMutex = NULL;
if(mPollset)
{
// LL_DEBUGS() << "cleaning up pollset" << LL_ENDL;
diff --git a/indra/llmessage/llpumpio.h b/indra/llmessage/llpumpio.h
index d2c5d37571..b9eabee710 100644
--- a/indra/llmessage/llpumpio.h
+++ b/indra/llmessage/llpumpio.h
@@ -40,9 +40,6 @@
#include "lliopipe.h"
#include "llrun.h"
-// Define this to enable use with the APR thread library.
-//#define LL_THREADS_APR 1
-
// some simple constants to help with timeouts
extern const F32 DEFAULT_CHAIN_EXPIRY_SECS;
extern const F32 SHORT_CHAIN_EXPIRY_SECS;
@@ -393,14 +390,6 @@ protected:
apr_pool_t* mCurrentPool;
S32 mCurrentPoolReallocCount;
-#if LL_THREADS_APR
- apr_thread_mutex_t* mChainsMutex;
- apr_thread_mutex_t* mCallbackMutex;
-#else
- int* mChainsMutex;
- int* mCallbackMutex;
-#endif
-
protected:
void initialize(apr_pool_t* pool);
void cleanup();