summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2007-05-02 21:24:47 +0000
committerDon Kjer <don@lindenlab.com>2007-05-02 21:24:47 +0000
commit1c909afe3998778e4cc045c9ab733e8afbf7c25b (patch)
tree75c00a32a8e305280cbec253195d1113d628fc3e /indra/llmessage
parentbc59c04653bf1404e8148a8169208b146a123b28 (diff)
svn merge -r 60342:61148 svn+ssh://svn/svn/linden/branches/maintenance into release
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llassetstorage.cpp41
-rw-r--r--indra/llmessage/llassetstorage.h11
-rw-r--r--indra/llmessage/llcircuit.cpp8
-rw-r--r--indra/llmessage/llcircuit.h4
-rw-r--r--indra/llmessage/llhttpassetstorage.cpp39
-rw-r--r--indra/llmessage/llhttpassetstorage.h4
-rw-r--r--indra/llmessage/lliohttpserver.cpp44
-rw-r--r--indra/llmessage/lliohttpserver.h20
-rw-r--r--indra/llmessage/lliosocket.cpp15
-rw-r--r--indra/llmessage/llmail.cpp2
-rw-r--r--indra/llmessage/llpacketbuffer.cpp10
-rw-r--r--indra/llmessage/llregionflags.h3
-rw-r--r--indra/llmessage/lltransfermanager.cpp1
-rw-r--r--indra/llmessage/llurlrequest.cpp5
-rw-r--r--indra/llmessage/llxfer_file.cpp23
-rw-r--r--indra/llmessage/llxfer_mem.cpp3
-rw-r--r--indra/llmessage/llxfermanager.cpp8
-rw-r--r--indra/llmessage/message.cpp45
18 files changed, 197 insertions, 89 deletions
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index 5b758c88b4..b05636a45c 100644
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -37,10 +37,6 @@ LLAssetStorage *gAssetStorage = NULL;
const LLUUID CATEGORIZE_LOST_AND_FOUND_ID("00000000-0000-0000-0000-000000000010");
-const F32 LL_ASSET_STORAGE_TIMEOUT = 300.0f; // anything that takes longer than this will abort
-
-
-
///----------------------------------------------------------------------------
/// LLAssetInfo
///----------------------------------------------------------------------------
@@ -817,43 +813,6 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
// Store routines
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// virtual
-void LLAssetStorage::cancelStoreAsset(
- const LLUUID& uuid,
- LLAssetType::EType atype)
-{
- bool do_callback = true;
- LLAssetRequest* req = NULL;
-
- if(mPendingUploads.size() > 0)
- {
- req = mPendingUploads.front();
- if((req->getUUID() == uuid) && (req->getType() == atype))
- {
- // This is probably because the request is in progress - do
- // not attempt to cancel.
- do_callback = false;
- }
- }
-
- if (mPendingLocalUploads.size() > 0)
- {
- req = mPendingLocalUploads.front();
- if((req->getUUID() == uuid) && (req->getType() == atype))
- {
- // This is probably because the request is in progress - do
- // not attempt to cancel.
- do_callback = false;
- }
- }
-
- if (do_callback)
- {
- // clear it out of the upload queue if it is there.
- _callUploadCallbacks(uuid, atype, FALSE);
- }
-}
-
// static
void LLAssetStorage::uploadCompleteCallback(const LLUUID& uuid, void *user_data, S32 result) // StoreAssetData callback (fixed)
{
diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h
index 9d73bf71eb..9777b8f1e4 100644
--- a/indra/llmessage/llassetstorage.h
+++ b/indra/llmessage/llassetstorage.h
@@ -28,6 +28,10 @@ class LLAssetStorage;
class LLVFS;
class LLSD;
+// anything that takes longer than this to download will abort.
+// HTTP Uploads also timeout if they take longer than this.
+const F32 LL_ASSET_STORAGE_TIMEOUT = 5 * 60.0f;
+
class LLAssetInfo
{
protected:
@@ -244,13 +248,6 @@ public:
bool store_local = false,
const LLUUID& requesting_agent_id = LLUUID::null);
- // This call will attempt to clear a store asset. This will only
- // attempt to cancel an upload that has not yet begun. The
- // callback will be called with an error code.
- virtual void cancelStoreAsset(
- const LLUUID& uuid,
- LLAssetType::EType oatype);
-
virtual void checkForTimeouts();
void getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,
diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp
index 451fb2e807..e9a60e4eb8 100644
--- a/indra/llmessage/llcircuit.cpp
+++ b/indra/llmessage/llcircuit.cpp
@@ -1147,13 +1147,13 @@ std::ostream& operator<<(std::ostream& s, LLCircuitData& circuit)
return s;
}
-const char* LLCircuitData::getInfoString() const
+const LLString LLCircuitData::getInfoString() const
{
std::ostringstream info;
info << "Circuit: " << mHost << std::endl
<< (mbAlive ? "Alive" : "Not Alive") << std::endl
<< "Age: " << mExistenceTimer.getElapsedTimeF32() << std::endl;
- return info.str().c_str();
+ return LLString(info.str());
}
void LLCircuitData::dumpResendCountAndReset()
@@ -1177,7 +1177,7 @@ std::ostream& operator<<(std::ostream& s, LLCircuit &circuit)
return s;
}
-const char* LLCircuit::getInfoString() const
+const LLString LLCircuit::getInfoString() const
{
std::ostringstream info;
info << "Circuit Info:" << std::endl;
@@ -1187,7 +1187,7 @@ const char* LLCircuit::getInfoString() const
{
info << (*it).second->getInfoString() << std::endl;
}
- return info.str().c_str();
+ return LLString(info.str());
}
void LLCircuit::getCircuitRange(
diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h
index 003734df29..a02c67e41d 100644
--- a/indra/llmessage/llcircuit.h
+++ b/indra/llmessage/llcircuit.h
@@ -131,7 +131,7 @@ public:
//
void checkPeriodTime(); // Reset per-period counters if necessary.
friend std::ostream& operator<<(std::ostream& s, LLCircuitData &circuit);
- const char* getInfoString() const;
+ const LLString getInfoString() const;
friend class LLCircuit;
friend class LLMessageSystem;
@@ -277,7 +277,7 @@ public:
void sendAcks();
friend std::ostream& operator<<(std::ostream& s, LLCircuit &circuit);
- const char* getInfoString() const;
+ const LLString getInfoString() const;
void dumpResends();
diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp
index 7cb6f5f95a..bca4e2364d 100644
--- a/indra/llmessage/llhttpassetstorage.cpp
+++ b/indra/llmessage/llhttpassetstorage.cpp
@@ -14,6 +14,7 @@
#include <sys/stat.h>
#include "indra_constants.h"
+#include "message.h"
#include "llvfile.h"
#include "llvfs.h"
@@ -497,6 +498,8 @@ void LLHTTPAssetStorage::storeAssetData(
callback(LLUUID::null, user_data, LL_ERR_CANNOT_OPEN_FILE);
}
}
+ // Coverity CID-269 says there's a leak of 'legacy' here, but
+ // legacyStoreDataCallback() will delete it somewhere down the line.
}
// virtual
@@ -917,9 +920,45 @@ void LLHTTPAssetStorage::checkForTimeouts()
} while (curl_msg && queue_length > 0);
+ // Cleanup
+ // We want to bump to the back of the line any running uploads that have timed out.
+ bumpTimedOutUploads();
+
LLAssetStorage::checkForTimeouts();
}
+void LLHTTPAssetStorage::bumpTimedOutUploads()
+{
+ // No point bumping currently running uploads if there are no others in line.
+ if (!(mPendingUploads.size() > mRunningUploads.size()))
+ {
+ return;
+ }
+
+ F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
+
+ // deletePendingRequest will modify the mRunningUploads list so we don't want to iterate over it.
+ request_list_t temp_running = mRunningUploads;
+
+ request_list_t::iterator it = temp_running.begin();
+ request_list_t::iterator end = temp_running.end();
+ for ( ; it != end; ++it)
+ {
+ //request_list_t::iterator curiter = iter++;
+ LLAssetRequest* req = *it;
+
+ if ( LL_ASSET_STORAGE_TIMEOUT < (mt_secs - req->mTime) )
+ {
+ llwarns << "Asset upload request timed out for "
+ << req->getUUID() << "."
+ << LLAssetType::lookup(req->getType())
+ << ", bumping to the back of the line!" << llendl;
+
+ deletePendingRequest(RT_UPLOAD, req->getType(), req->getUUID());
+ }
+ }
+}
+
// static
size_t LLHTTPAssetStorage::curlDownCallback(void *data, size_t size, size_t nmemb, void *user_data)
{
diff --git a/indra/llmessage/llhttpassetstorage.h b/indra/llmessage/llhttpassetstorage.h
index b1be7431b9..a9cd88d629 100644
--- a/indra/llmessage/llhttpassetstorage.h
+++ b/indra/llmessage/llhttpassetstorage.h
@@ -113,6 +113,10 @@ private:
// This will return the correct base URI for any http asset request
std::string getBaseURL(const LLUUID& asset_id, LLAssetType::EType asset_type);
+ // Check for running uploads that have timed out
+ // Bump these to the back of the line to let other uploads complete.
+ void bumpTimedOutUploads();
+
protected:
std::string mBaseURL;
std::string mLocalBaseURL;
diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp
index 869012e431..ca5fe849f7 100644
--- a/indra/llmessage/lliohttpserver.cpp
+++ b/indra/llmessage/lliohttpserver.cpp
@@ -9,9 +9,8 @@
*/
#include "linden_common.h"
-#include "lliohttpserver.h"
-#include "boost/tokenizer.hpp"
+#include "lliohttpserver.h"
#include "llapr.h"
#include "llbuffer.h"
@@ -26,9 +25,12 @@
#include "llsd.h"
#include "llsdserialize_xml.h"
#include "llstl.h"
+#include "lltimer.h"
#include <sstream>
+#include "boost/tokenizer.hpp"
+
static const char HTTP_VERSION_STR[] = "HTTP/1.0";
static const std::string CONTEXT_REQUEST("request");
static const std::string HTTP_VERB_GET("GET");
@@ -36,6 +38,8 @@ static const std::string HTTP_VERB_PUT("PUT");
static const std::string HTTP_VERB_POST("POST");
static const std::string HTTP_VERB_DELETE("DELETE");
+static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL;
+static void* sTimingCallbackData = NULL;
class LLHTTPPipe : public LLIOPipe
{
@@ -131,6 +135,12 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
// TODO: Babbage: Parameterize parser?
LLBufferStream istr(channels, buffer.get());
+ static LLTimer timer;
+ if (sTimingCallback)
+ {
+ timer.reset();
+ }
+
std::string verb = context[CONTEXT_REQUEST]["verb"];
if(verb == HTTP_VERB_GET)
{
@@ -159,6 +169,18 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
mResponse->methodNotAllowed();
}
+ if (sTimingCallback)
+ {
+ LLHTTPNode::Description desc;
+ mNode.describe(desc);
+ LLSD info = desc.getInfo();
+ std::string timing_name = info["description"];
+ timing_name += " ";
+ timing_name += verb;
+ F32 delta = timer.getElapsedTimeF32();
+ sTimingCallback(timing_name.c_str(), delta, sTimingCallbackData);
+ }
+
// Log Internal Server Errors
if(mStatusCode == 500)
{
@@ -799,9 +821,9 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
}
-
-void LLCreateHTTPPipe(LLPumpIO::chain_t& chain,
- const LLHTTPNode& root, const LLSD& ctx)
+// static
+void LLIOHTTPServer::createPipe(LLPumpIO::chain_t& chain,
+ const LLHTTPNode& root, const LLSD& ctx)
{
chain.push_back(LLIOPipe::ptr_t(new LLHTTPResponder(root, ctx)));
}
@@ -812,7 +834,7 @@ class LLHTTPResponseFactory : public LLChainIOFactory
public:
bool build(LLPumpIO::chain_t& chain, LLSD ctx) const
{
- LLCreateHTTPPipe(chain, mTree, ctx);
+ LLIOHTTPServer::createPipe(chain, mTree, ctx);
return true;
}
@@ -823,7 +845,8 @@ private:
};
-LLHTTPNode& LLCreateHTTPServer(
+// static
+LLHTTPNode& LLIOHTTPServer::create(
apr_pool_t* pool, LLPumpIO& pump, U16 port)
{
LLSocket::ptr_t socket = LLSocket::create(
@@ -847,3 +870,10 @@ LLHTTPNode& LLCreateHTTPServer(
return factory->getRootNode();
}
+// static
+void LLIOHTTPServer::setTimingCallback(timing_callback_t callback,
+ void* data)
+{
+ sTimingCallback = callback;
+ sTimingCallbackData = data;
+}
diff --git a/indra/llmessage/lliohttpserver.h b/indra/llmessage/lliohttpserver.h
index f11a1eccf6..4f788db377 100644
--- a/indra/llmessage/lliohttpserver.h
+++ b/indra/llmessage/lliohttpserver.h
@@ -16,7 +16,12 @@
class LLPumpIO;
-LLHTTPNode& LLCreateHTTPServer(apr_pool_t* pool, LLPumpIO& pump, U16 port);
+class LLIOHTTPServer
+{
+public:
+ typedef void (*timing_callback_t)(const char* hashed_name, F32 time, void* data);
+
+ static LLHTTPNode& create(apr_pool_t* pool, LLPumpIO& pump, U16 port);
/**< Creates an HTTP wire server on the pump for the given TCP port.
*
* Returns the root node of the new server. Add LLHTTPNode instances
@@ -31,14 +36,23 @@ LLHTTPNode& LLCreateHTTPServer(apr_pool_t* pool, LLPumpIO& pump, U16 port);
* for example), use the helper templates below.
*/
-void LLCreateHTTPPipe(LLPumpIO::chain_t& chain,
- const LLHTTPNode& root, const LLSD& ctx);
+ static void createPipe(LLPumpIO::chain_t& chain,
+ const LLHTTPNode& root, const LLSD& ctx);
/**< Create a pipe on the chain that handles HTTP requests.
* The requests are served by the node tree given at root.
*
* This is primarily useful for unit testing.
*/
+ static void setTimingCallback(timing_callback_t callback, void* data);
+ /**< Register a callback function that will be called every time
+ * a GET, PUT, POST, or DELETE is handled.
+ *
+ * This is used to time the LLHTTPNode handler code, which often hits
+ * the database or does other, slow operations. JC
+ */
+};
+
/* @name Helper Templates
*
* These templates make it easy to create nodes that use thier own protocol
diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp
index 7c33153086..6ccaa7fb1a 100644
--- a/indra/llmessage/lliosocket.cpp
+++ b/indra/llmessage/lliosocket.cpp
@@ -403,23 +403,35 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
bool done = false;
while(it != end)
{
+
PUMP_DEBUG;
if((*it).isOnChannel(channels.in()))
{
PUMP_DEBUG;
// *FIX: check return code - sockets will fail (broken, etc.)
len = (apr_size_t)segment.size();
- apr_socket_send(
+ apr_status_t status = apr_socket_send(
mDestination->getSocket(),
(const char*)segment.data(),
&len);
+ // We sometimes get a 'non-blocking socket operation could not be
+ // completed immediately' error from apr_socket_send. In this
+ // case we break and the data will be sent the next time the chain
+ // is pumped.
+#if LL_WINDOWS
+ if (status == 730035)
+ break;
+#endif
mLastWritten = segment.data() + len - 1;
+
PUMP_DEBUG;
if((S32)len < segment.size())
{
break;
}
+
}
+
++it;
if(it != end)
{
@@ -429,6 +441,7 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
{
done = true;
}
+
}
PUMP_DEBUG;
if(done && eos)
diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp
index dd878e1679..c694bc3530 100644
--- a/indra/llmessage/llmail.cpp
+++ b/indra/llmessage/llmail.cpp
@@ -44,7 +44,7 @@ static apr_sockaddr_t* gSockAddr;
static apr_socket_t* gMailSocket;
// According to RFC2822
-static const boost::regex valid_subject_chars("[\\x1-\\x9\\xb\\xc\\xe-\\x7f]+");
+static const boost::regex valid_subject_chars("[\\x1-\\x9\\xb\\xc\\xe-\\x7f]*");
bool connect_smtp();
void disconnect_smtp();
diff --git a/indra/llmessage/llpacketbuffer.cpp b/indra/llmessage/llpacketbuffer.cpp
index d5796c131b..405a5241cd 100644
--- a/indra/llmessage/llpacketbuffer.cpp
+++ b/indra/llmessage/llpacketbuffer.cpp
@@ -22,11 +22,13 @@ LLPacketBuffer::LLPacketBuffer(const LLHost &host, const char *datap, const S32
{
llerrs << "Sending packet > " << NET_BUFFER_SIZE << " of size " << size << llendl;
}
-
- if (datap != NULL)
+ else // we previously relied on llerrs being fatal to not get here...
{
- memcpy(mData, datap, size); /*Flawfinder: ignore*/
- mSize = size;
+ if (datap != NULL)
+ {
+ memcpy(mData, datap, size);
+ mSize = size;
+ }
}
}
diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h
index e7797ea158..15e7a32257 100644
--- a/indra/llmessage/llregionflags.h
+++ b/indra/llmessage/llregionflags.h
@@ -43,7 +43,7 @@ const U32 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid
const U32 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13);
const U32 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics
const U32 REGION_FLAGS_EXTERNALLY_VISIBLE = (1 << 15);
-const U32 REGION_FLAGS_MAINLAND_VISIBLE = (1 << 16);
+//const U32 REGION_FLAGS_MAINLAND_VISIBLE = (1 << 16);
const U32 REGION_FLAGS_PUBLIC_ALLOWED = (1 << 17);
const U32 REGION_FLAGS_BLOCK_DWELL = (1 << 18);
@@ -79,7 +79,6 @@ const U32 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK
| REGION_FLAGS_ALLOW_SET_HOME;
const U32 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE
- | REGION_FLAGS_MAINLAND_VISIBLE
| REGION_FLAGS_PUBLIC_ALLOWED
| REGION_FLAGS_SUN_FIXED
| REGION_FLAGS_DENY_ANONYMOUS
diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp
index bddd79367a..36553f8cf1 100644
--- a/indra/llmessage/lltransfermanager.cpp
+++ b/indra/llmessage/lltransfermanager.cpp
@@ -938,6 +938,7 @@ void LLTransferTargetChannel::requestTransfer(
if (!ttp)
{
llwarns << "LLTransferManager::requestTransfer aborting due to target creation failure!" << llendl;
+ return;
}
ttp->applyParams(target_params);
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index df9c0149d4..a7b8573b0d 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -524,7 +524,10 @@ size_t headerCallback(void* data, size_t size, size_t nmemb, void* user)
int statusCode = atoi(status.c_str());
if (statusCode > 0)
{
- complete->httpStatus((U32)statusCode, reason);
+ if (complete)
+ {
+ complete->httpStatus((U32)statusCode, reason);
+ }
}
}
diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp
index 14c266950d..299c043d93 100644
--- a/indra/llmessage/llxfer_file.cpp
+++ b/indra/llmessage/llxfer_file.cpp
@@ -62,7 +62,8 @@ void LLXfer_File::init (const LLString& local_filename, BOOL delete_local_on_com
if (!local_filename.empty())
{
- strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH); /* Flawfinder : ignore */
+ strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1);
+ mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy.
// You can only automatically delete .tmp file as a safeguard against nasty messages.
mDeleteLocalOnCompletion = (delete_local_on_completion && (strstr(mLocalFilename,".tmp") == &mLocalFilename[strlen(mLocalFilename)-4])); /* Flawfinder : ignore */
@@ -97,19 +98,21 @@ void LLXfer_File::free ()
///////////////////////////////////////////////////////////
S32 LLXfer_File::initializeRequest(U64 xfer_id,
- const LLString& local_filename,
- const LLString& remote_filename,
- ELLPath remote_path,
- const LLHost& remote_host,
- BOOL delete_remote_on_completion,
- void (*callback)(void**,S32),
- void** user_data)
+ const LLString& local_filename,
+ const LLString& remote_filename,
+ ELLPath remote_path,
+ const LLHost& remote_host,
+ BOOL delete_remote_on_completion,
+ void (*callback)(void**,S32),
+ void** user_data)
{
S32 retval = 0; // presume success
mID = xfer_id;
- strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH); /* Flawfinder : ignore */
- strncpy(mRemoteFilename,remote_filename.c_str(), LL_MAX_PATH); /* Flawfinder : ignore */
+ strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1);
+ mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy.
+ strncpy(mRemoteFilename,remote_filename.c_str(), LL_MAX_PATH-1);
+ mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy.
mRemotePath = remote_path;
mRemoteHost = remote_host;
mDeleteRemoteOnCompletion = delete_remote_on_completion;
diff --git a/indra/llmessage/llxfer_mem.cpp b/indra/llmessage/llxfer_mem.cpp
index 8f48247e20..ff878dc9f2 100644
--- a/indra/llmessage/llxfer_mem.cpp
+++ b/indra/llmessage/llxfer_mem.cpp
@@ -142,7 +142,8 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id,
mCallbackDataHandle = user_data;
mCallbackResult = LL_ERR_NOERR;
- strncpy(mRemoteFilename, remote_filename.c_str(), LL_MAX_PATH); /* Flawfinder : ignore */
+ strncpy(mRemoteFilename, remote_filename.c_str(), LL_MAX_PATH-1);
+ mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy.
mRemotePath = remote_path;
mDeleteRemoteOnCompletion = delete_remote_on_completion;
diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp
index bafa783799..98d8a626e5 100644
--- a/indra/llmessage/llxfermanager.cpp
+++ b/indra/llmessage/llxfermanager.cpp
@@ -203,8 +203,8 @@ LLXfer *LLXferManager::findXfer (U64 id, LLXfer *list_head)
void LLXferManager::removeXfer (LLXfer *delp, LLXfer **list_head)
{
- LLXfer *xferp;
-
+ // This function assumes that delp will only occur in the list
+ // zero or one times.
if (delp)
{
if (*list_head == delp)
@@ -214,14 +214,14 @@ void LLXferManager::removeXfer (LLXfer *delp, LLXfer **list_head)
}
else
{
- xferp = *list_head;
+ LLXfer *xferp = *list_head;
while (xferp->mNext)
{
if (xferp->mNext == delp)
{
xferp->mNext = delp->mNext;
delete (delp);
- continue;
+ break;
}
xferp = xferp->mNext;
}
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index 78d12cbda9..dfc18e0b2e 100644
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -515,6 +515,8 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
if(!filename)
{
llerrs << "No template filename specified" << llendl;
+ mbError = TRUE;
+ return;
}
char token[MAX_MESSAGE_INTERNAL_NAME_SIZE]; /* Flawfinder: ignore */
@@ -635,6 +637,13 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
// add data!
// we've gotten a complete variable! hooray!
// add it!
+ if (NULL == templatep)
+ {
+ llerrs << "Trying to addTemplate a NULL templatep during load." << llendl;
+ mbError = TRUE;
+ fclose(messagefilep);
+ return;
+ }
addTemplate(templatep);
//llinfos << "Read template: "templatep->mNametemp_str
@@ -652,7 +661,13 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
// add data!
// we've gotten a complete variable! hooray!
// add it to template
-
+ if (NULL == templatep)
+ {
+ llerrs << "Trying to addBlock to NULL templatep during load." << llendl;
+ mbError = TRUE;
+ fclose(messagefilep);
+ return;
+ }
templatep->addBlock(blockp);
// start working on it!
@@ -856,10 +871,24 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
if (strcmp(token, "Trusted") == 0)
{
+ if (NULL == templatep)
+ {
+ llerrs << "Trying to setTrust for NULL templatep during load." << llendl;
+ mbError = TRUE;
+ fclose(messagefilep);
+ return;
+ }
templatep->setTrust(MT_TRUST);
}
else if (strcmp(token, "NotTrusted") == 0)
{
+ if (NULL == templatep)
+ {
+ llerrs << "Trying to setTrust for NULL templatep during load." << llendl;
+ mbError = TRUE;
+ fclose(messagefilep);
+ return;
+ }
templatep->setTrust(MT_NOTRUST);
}
else
@@ -892,10 +921,24 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
if(0 == strcmp(token, "Unencoded"))
{
+ if (NULL == templatep)
+ {
+ llerrs << "Trying to setEncoding for NULL templatep during load." << llendl;
+ mbError = TRUE;
+ fclose(messagefilep);
+ return;
+ }
templatep->setEncoding(ME_UNENCODED);
}
else if(0 == strcmp(token, "Zerocoded"))
{
+ if (NULL == templatep)
+ {
+ llerrs << "Trying to setEncoding for NULL templatep during load." << llendl;
+ mbError = TRUE;
+ fclose(messagefilep);
+ return;
+ }
templatep->setEncoding(ME_ZEROCODED);
}
else