summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage')
-rwxr-xr-xindra/llmessage/CMakeLists.txt14
-rwxr-xr-xindra/llmessage/llares.cpp59
-rwxr-xr-xindra/llmessage/llares.h1
-rwxr-xr-xindra/llmessage/llareslistener.cpp2
-rwxr-xr-xindra/llmessage/llassetstorage.cpp149
-rwxr-xr-xindra/llmessage/llassetstorage.h31
-rw-r--r--indra/llmessage/llavatarname.cpp254
-rw-r--r--indra/llmessage/llavatarname.h139
-rwxr-xr-xindra/llmessage/llavatarnamecache.cpp49
-rwxr-xr-xindra/llmessage/llavatarnamecache.h2
-rwxr-xr-xindra/llmessage/llblowfishcipher.cpp10
-rwxr-xr-xindra/llmessage/llbuffer.cpp31
-rwxr-xr-xindra/llmessage/llbufferstream.cpp2
-rwxr-xr-xindra/llmessage/llcachename.cpp30
-rwxr-xr-xindra/llmessage/llcircuit.cpp249
-rwxr-xr-xindra/llmessage/llcircuit.h81
-rwxr-xr-xindra/llmessage/llcurl.cpp287
-rwxr-xr-xindra/llmessage/llcurl.h116
-rwxr-xr-xindra/llmessage/lldatapacker.cpp74
-rwxr-xr-xindra/llmessage/lldatapacker.h9
-rwxr-xr-xindra/llmessage/lldispatcher.cpp3
-rwxr-xr-xindra/llmessage/llextendedstatus.h67
-rwxr-xr-xindra/llmessage/llfiltersd2xmlrpc.cpp93
-rwxr-xr-xindra/llmessage/llhost.cpp18
-rwxr-xr-xindra/llmessage/llhttpassetstorage.cpp128
-rwxr-xr-xindra/llmessage/llhttpassetstorage.h4
-rwxr-xr-xindra/llmessage/llhttpclient.cpp214
-rwxr-xr-xindra/llmessage/llhttpclient.h26
-rwxr-xr-xindra/llmessage/llhttpclientadapter.cpp25
-rwxr-xr-xindra/llmessage/llhttpclientadapter.h8
-rwxr-xr-xindra/llmessage/llhttpconstants.cpp228
-rwxr-xr-xindra/llmessage/llhttpconstants.h225
-rwxr-xr-xindra/llmessage/llhttpnode.cpp43
-rwxr-xr-xindra/llmessage/llhttpnode.h30
-rwxr-xr-xindra/llmessage/llhttpsender.cpp4
-rwxr-xr-xindra/llmessage/llinstantmessage.cpp6
-rwxr-xr-xindra/llmessage/lliobuffer.cpp2
-rwxr-xr-xindra/llmessage/lliohttpserver.cpp165
-rwxr-xr-xindra/llmessage/lliohttpserver.h12
-rwxr-xr-xindra/llmessage/lliopipe.cpp2
-rwxr-xr-xindra/llmessage/lliopipe.h1
-rwxr-xr-xindra/llmessage/lliosocket.cpp66
-rwxr-xr-xindra/llmessage/lliosocket.h4
-rwxr-xr-xindra/llmessage/llioutil.cpp9
-rwxr-xr-xindra/llmessage/llmail.cpp45
-rwxr-xr-xindra/llmessage/llmessageconfig.cpp12
-rwxr-xr-xindra/llmessage/llmessagetemplate.cpp8
-rwxr-xr-xindra/llmessage/llmessagetemplate.h14
-rwxr-xr-xindra/llmessage/llmessagetemplateparser.cpp78
-rwxr-xr-xindra/llmessage/llmime.cpp629
-rwxr-xr-xindra/llmessage/llmime.h292
-rwxr-xr-xindra/llmessage/llnamevalue.cpp38
-rwxr-xr-xindra/llmessage/llnamevalue.h2
-rwxr-xr-xindra/llmessage/llpacketack.cpp6
-rwxr-xr-xindra/llmessage/llpacketack.h11
-rwxr-xr-xindra/llmessage/llpacketbuffer.cpp4
-rwxr-xr-xindra/llmessage/llpacketring.cpp7
-rwxr-xr-xindra/llmessage/llproxy.cpp10
-rwxr-xr-xindra/llmessage/llpumpio.cpp147
-rwxr-xr-xindra/llmessage/llregionflags.h2
-rwxr-xr-xindra/llmessage/llregionhandle.h4
-rwxr-xr-xindra/llmessage/llregionpresenceverifier.cpp153
-rwxr-xr-xindra/llmessage/llregionpresenceverifier.h98
-rwxr-xr-xindra/llmessage/llsdappservices.cpp18
-rwxr-xr-xindra/llmessage/llsdhttpserver.cpp2
-rwxr-xr-xindra/llmessage/llsdmessage.cpp22
-rwxr-xr-xindra/llmessage/llsdmessage.h6
-rwxr-xr-xindra/llmessage/llsdmessagebuilder.cpp6
-rwxr-xr-xindra/llmessage/llsdmessagereader.cpp12
-rwxr-xr-xindra/llmessage/llsdrpcclient.cpp25
-rwxr-xr-xindra/llmessage/llsdrpcclient.h16
-rwxr-xr-xindra/llmessage/llsdrpcserver.cpp17
-rwxr-xr-xindra/llmessage/llsdrpcserver.h4
-rwxr-xr-xindra/llmessage/llservice.cpp12
-rwxr-xr-xindra/llmessage/llservicebuilder.cpp18
-rwxr-xr-xindra/llmessage/lltemplatemessagebuilder.cpp70
-rwxr-xr-xindra/llmessage/lltemplatemessagereader.cpp120
-rwxr-xr-xindra/llmessage/llthrottle.cpp54
-rwxr-xr-xindra/llmessage/llthrottle.h6
-rwxr-xr-xindra/llmessage/lltransfermanager.cpp126
-rwxr-xr-xindra/llmessage/lltransfersourceasset.cpp24
-rwxr-xr-xindra/llmessage/lltransfersourcefile.cpp16
-rwxr-xr-xindra/llmessage/lltransfertargetfile.cpp16
-rwxr-xr-xindra/llmessage/lltransfertargetvfile.cpp20
-rwxr-xr-xindra/llmessage/lltrustedmessageservice.cpp14
-rwxr-xr-xindra/llmessage/lltrustedmessageservice.h4
-rwxr-xr-xindra/llmessage/llurlrequest.cpp140
-rwxr-xr-xindra/llmessage/llurlrequest.h54
-rwxr-xr-xindra/llmessage/lluseroperation.cpp6
-rwxr-xr-xindra/llmessage/llxfer.cpp24
-rwxr-xr-xindra/llmessage/llxfer.h4
-rwxr-xr-xindra/llmessage/llxfer_file.cpp44
-rwxr-xr-xindra/llmessage/llxfer_mem.cpp4
-rwxr-xr-xindra/llmessage/llxfer_vfile.cpp8
-rwxr-xr-xindra/llmessage/llxfermanager.cpp94
-rwxr-xr-xindra/llmessage/llxfermanager.h4
-rwxr-xr-xindra/llmessage/machine.cpp4
-rwxr-xr-xindra/llmessage/message.cpp311
-rwxr-xr-xindra/llmessage/message.h101
-rwxr-xr-xindra/llmessage/message_string_table.cpp4
-rwxr-xr-xindra/llmessage/net.cpp64
-rwxr-xr-xindra/llmessage/net.h3
-rwxr-xr-xindra/llmessage/partsyspacket.cpp4
-rwxr-xr-xindra/llmessage/patch_code.cpp6
-rwxr-xr-xindra/llmessage/tests/llareslistener_test.cpp16
-rwxr-xr-xindra/llmessage/tests/llcurl_stub.cpp59
-rwxr-xr-xindra/llmessage/tests/llhttpclient_test.cpp33
-rwxr-xr-xindra/llmessage/tests/llhttpclientadapter_test.cpp81
-rwxr-xr-xindra/llmessage/tests/llhttpnode_stub.cpp107
-rwxr-xr-xindra/llmessage/tests/llmime_test.cpp445
-rwxr-xr-xindra/llmessage/tests/llregionpresenceverifier_test.cpp108
-rwxr-xr-xindra/llmessage/tests/lltrustedmessageservice_test.cpp1
112 files changed, 3289 insertions, 3600 deletions
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt
index d193e367eb..8bd134dc84 100755
--- a/indra/llmessage/CMakeLists.txt
+++ b/indra/llmessage/CMakeLists.txt
@@ -27,6 +27,7 @@ set(llmessage_SOURCE_FILES
llares.cpp
llareslistener.cpp
llassetstorage.cpp
+ llavatarname.cpp
llavatarnamecache.cpp
llblowfishcipher.cpp
llbuffer.cpp
@@ -43,6 +44,7 @@ set(llmessage_SOURCE_FILES
llhttpassetstorage.cpp
llhttpclient.cpp
llhttpclientadapter.cpp
+ llhttpconstants.cpp
llhttpnode.cpp
llhttpsender.cpp
llinstantmessage.cpp
@@ -58,7 +60,6 @@ set(llmessage_SOURCE_FILES
llmessagetemplate.cpp
llmessagetemplateparser.cpp
llmessagethrottle.cpp
- llmime.cpp
llnamevalue.cpp
llnullcipher.cpp
llpacketack.cpp
@@ -67,7 +68,6 @@ set(llmessage_SOURCE_FILES
llpartdata.cpp
llproxy.cpp
llpumpio.cpp
- llregionpresenceverifier.cpp
llsdappservices.cpp
llsdhttpserver.cpp
llsdmessage.cpp
@@ -114,6 +114,7 @@ set(llmessage_HEADER_FILES
llares.h
llareslistener.h
llassetstorage.h
+ llavatarname.h
llavatarnamecache.h
llblowfishcipher.h
llbuffer.h
@@ -128,6 +129,7 @@ set(llmessage_HEADER_FILES
lldbstrings.h
lldispatcher.h
lleventflags.h
+ llextendedstatus.h
llfiltersd2xmlrpc.h
llfollowcamparams.h
llhost.h
@@ -135,6 +137,7 @@ set(llmessage_HEADER_FILES
llhttpclient.h
llhttpclientinterface.h
llhttpclientadapter.h
+ llhttpconstants.h
llhttpnode.h
llhttpnodeadapter.h
llhttpsender.h
@@ -153,7 +156,6 @@ set(llmessage_HEADER_FILES
llmessagetemplate.h
llmessagetemplateparser.h
llmessagethrottle.h
- llmime.h
llmsgvariabletype.h
llnamevalue.h
llnullcipher.h
@@ -166,7 +168,6 @@ set(llmessage_HEADER_FILES
llqueryflags.h
llregionflags.h
llregionhandle.h
- llregionpresenceverifier.h
llsdappservices.h
llsdhttpserver.h
llsdmessage.h
@@ -230,17 +231,15 @@ target_link_libraries(
# tests
if (LL_TESTS)
SET(llmessage_TEST_SOURCE_FILES
- # llhttpclientadapter.cpp
- llmime.cpp
llnamevalue.cpp
lltrustedmessageservice.cpp
lltemplatemessagedispatcher.cpp
- llregionpresenceverifier.cpp
)
LL_ADD_PROJECT_UNIT_TESTS(llmessage "${llmessage_TEST_SOURCE_FILES}")
# set(TEST_DEBUG on)
set(test_libs
+ ${CURL_LIBRARIES}
${LLMESSAGE_LIBRARIES}
${WINDOWS_LIBRARIES}
${LLVFS_LIBRARIES}
@@ -267,6 +266,7 @@ if (LL_TESTS)
LL_ADD_INTEGRATION_TEST(llavatarnamecache "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llhost "" "${test_libs}")
+ LL_ADD_INTEGRATION_TEST(llhttpclientadapter "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llpartdata "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llxfer_file "" "${test_libs}")
endif (LL_TESTS)
diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp
index 7f74247a13..9f90ae1544 100755
--- a/indra/llmessage/llares.cpp
+++ b/indra/llmessage/llares.cpp
@@ -55,13 +55,13 @@ LLAres::HostResponder::~HostResponder()
void LLAres::HostResponder::hostResult(const hostent *ent)
{
- llinfos << "LLAres::HostResponder::hostResult not implemented" << llendl;
+ LL_INFOS() << "LLAres::HostResponder::hostResult not implemented" << LL_ENDL;
}
void LLAres::HostResponder::hostError(int code)
{
- llinfos << "LLAres::HostResponder::hostError " << code << ": "
- << LLAres::strerror(code) << llendl;
+ LL_INFOS() << "LLAres::HostResponder::hostError " << code << ": "
+ << LLAres::strerror(code) << LL_ENDL;
}
LLAres::NameInfoResponder::~NameInfoResponder()
@@ -71,14 +71,14 @@ LLAres::NameInfoResponder::~NameInfoResponder()
void LLAres::NameInfoResponder::nameInfoResult(const char *node,
const char *service)
{
- llinfos << "LLAres::NameInfoResponder::nameInfoResult not implemented"
- << llendl;
+ LL_INFOS() << "LLAres::NameInfoResponder::nameInfoResult not implemented"
+ << LL_ENDL;
}
void LLAres::NameInfoResponder::nameInfoError(int code)
{
- llinfos << "LLAres::NameInfoResponder::nameInfoError " << code << ": "
- << LLAres::strerror(code) << llendl;
+ LL_INFOS() << "LLAres::NameInfoResponder::nameInfoError " << code << ": "
+ << LLAres::strerror(code) << LL_ENDL;
}
LLAres::QueryResponder::~QueryResponder()
@@ -87,14 +87,14 @@ LLAres::QueryResponder::~QueryResponder()
void LLAres::QueryResponder::queryResult(const char *buf, size_t len)
{
- llinfos << "LLAres::QueryResponder::queryResult not implemented"
- << llendl;
+ LL_INFOS() << "LLAres::QueryResponder::queryResult not implemented"
+ << LL_ENDL;
}
void LLAres::QueryResponder::queryError(int code)
{
- llinfos << "LLAres::QueryResponder::queryError " << code << ": "
- << LLAres::strerror(code) << llendl;
+ LL_INFOS() << "LLAres::QueryResponder::queryError " << code << ": "
+ << LLAres::strerror(code) << LL_ENDL;
}
LLAres::LLAres() :
@@ -104,7 +104,7 @@ LLAres::LLAres() :
if (ares_library_init( ARES_LIB_INIT_ALL ) != ARES_SUCCESS ||
ares_init(&chan_) != ARES_SUCCESS)
{
- llwarns << "Could not succesfully initialize ares!" << llendl;
+ LL_WARNS() << "Could not succesfully initialize ares!" << LL_ENDL;
return;
}
@@ -176,7 +176,7 @@ void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp)
return;
}
- //llinfos << "LLAres::rewriteURI (" << uri << ") search: '" << "_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName() << "'" << llendl;
+ //LL_INFOS() << "LLAres::rewriteURI (" << uri << ") search: '" << "_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName() << "'" << LL_ENDL;
search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), RES_SRV, resp);
@@ -251,8 +251,8 @@ int LLQueryResponder::parseRR(const char *buf, size_t len, const char *&pos,
r = new LLSrvRecord(rrname, rrttl);
break;
default:
- llinfos << "LLQueryResponder::parseRR got unknown RR type " << rrtype
- << llendl;
+ LL_INFOS() << "LLQueryResponder::parseRR got unknown RR type " << rrtype
+ << LL_ENDL;
return ARES_EBADRESP;
}
@@ -333,7 +333,7 @@ void LLQueryResponder::queryResult(const char *buf, size_t len)
mType = (LLResType) t;
break;
default:
- llinfos << "Cannot grok query type " << t << llendl;
+ LL_INFOS() << "Cannot grok query type " << t << LL_ENDL;
ret = ARES_EBADQUERY;
goto bail;
}
@@ -373,7 +373,7 @@ bail:
void LLQueryResponder::querySuccess()
{
- llinfos << "LLQueryResponder::queryResult not implemented" << llendl;
+ LL_INFOS() << "LLQueryResponder::queryResult not implemented" << LL_ENDL;
}
void LLAres::SrvResponder::querySuccess()
@@ -393,23 +393,23 @@ void LLAres::SrvResponder::queryError(int code)
void LLAres::SrvResponder::srvResult(const dns_rrs_t &ents)
{
- llinfos << "LLAres::SrvResponder::srvResult not implemented" << llendl;
+ LL_INFOS() << "LLAres::SrvResponder::srvResult not implemented" << LL_ENDL;
for (size_t i = 0; i < ents.size(); i++)
{
const LLSrvRecord *s = (const LLSrvRecord *) ents[i].get();
- llinfos << "[" << i << "] " << s->host() << ":" << s->port()
+ LL_INFOS() << "[" << i << "] " << s->host() << ":" << s->port()
<< " priority " << s->priority()
<< " weight " << s->weight()
- << llendl;
+ << LL_ENDL;
}
}
void LLAres::SrvResponder::srvError(int code)
{
- llinfos << "LLAres::SrvResponder::srvError " << code << ": "
- << LLAres::strerror(code) << llendl;
+ LL_INFOS() << "LLAres::SrvResponder::srvError " << code << ": "
+ << LLAres::strerror(code) << LL_ENDL;
}
static void nameinfo_callback_1_5(void *arg, int status, int timeouts,
@@ -610,6 +610,15 @@ LLAres *ll_init_ares()
return gAres;
}
+void ll_cleanup_ares()
+{
+ if (gAres != NULL)
+ {
+ delete gAres;
+ gAres = NULL;
+ }
+}
+
LLDnsRecord::LLDnsRecord(LLResType type, const std::string &name,
unsigned ttl)
: LLRefCount(),
@@ -820,11 +829,11 @@ done:
void LLAres::UriRewriteResponder::rewriteResult(
const std::vector<std::string> &uris)
{
- llinfos << "LLAres::UriRewriteResponder::rewriteResult not implemented"
- << llendl;
+ LL_INFOS() << "LLAres::UriRewriteResponder::rewriteResult not implemented"
+ << LL_ENDL;
for (size_t i = 0; i < uris.size(); i++)
{
- llinfos << "[" << i << "] " << uris[i] << llendl;
+ LL_INFOS() << "[" << i << "] " << uris[i] << LL_ENDL;
}
}
diff --git a/indra/llmessage/llares.h b/indra/llmessage/llares.h
index 800781ee88..0b5d49e322 100755
--- a/indra/llmessage/llares.h
+++ b/indra/llmessage/llares.h
@@ -578,5 +578,6 @@ extern LLAres *gAres;
* thread safe.
*/
extern LLAres *ll_init_ares();
+extern void ll_cleanup_ares();
#endif // LL_LLARES_H
diff --git a/indra/llmessage/llareslistener.cpp b/indra/llmessage/llareslistener.cpp
index 0a4effac19..3d65906b98 100755
--- a/indra/llmessage/llareslistener.cpp
+++ b/indra/llmessage/llareslistener.cpp
@@ -99,6 +99,6 @@ void LLAresListener::rewriteURI(const LLSD& data)
}
else
{
- llinfos << "LLAresListener::rewriteURI requested without Ares present. Ignoring: " << data << llendl;
+ LL_INFOS() << "LLAresListener::rewriteURI requested without Ares present. Ignoring: " << data << LL_ENDL;
}
}
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index 9b86daebe5..8ba2535531 100755
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -50,10 +50,14 @@
#include "lltransfertargetvfile.h" // For debugging
#include "llmetrics.h"
+#include "lltrace.h"
LLAssetStorage *gAssetStorage = NULL;
LLMetrics *LLAssetStorage::metric_recipient = NULL;
+static LLTrace::CountStatHandle<> sFailedDownloadCount("faileddownloads", "Number of times LLAssetStorage::getAssetData() has failed");
+
+
const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-000000000010"));
const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds
@@ -149,8 +153,8 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv )
setName( buf );
buf.assign( str, pos2, std::string::npos );
setDescription( buf );
- LL_DEBUGS("AssetStorage") << "uuid: " << mUuid << llendl;
- LL_DEBUGS("AssetStorage") << "creator: " << mCreatorID << llendl;
+ LL_DEBUGS("AssetStorage") << "uuid: " << mUuid << LL_ENDL;
+ LL_DEBUGS("AssetStorage") << "creator: " << mCreatorID << LL_ENDL;
}
///----------------------------------------------------------------------------
@@ -190,8 +194,8 @@ LLSD LLAssetRequest::getTerseDetails() const
sd["asset_id"] = getUUID();
sd["type_long"] = LLAssetType::lookupHumanReadable(getType());
sd["type"] = LLAssetType::lookup(getType());
- sd["time"] = mTime;
- time_t timestamp = (time_t) mTime;
+ sd["time"] = mTime.value();
+ time_t timestamp = (time_t) mTime.value();
std::ostringstream time_string;
time_string << ctime(&timestamp);
sd["time_string"] = time_string.str();
@@ -337,7 +341,7 @@ void LLAssetStorage::checkForTimeouts()
void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
{
- F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds();
request_list_t timed_out;
S32 rt;
@@ -356,10 +360,10 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
|| ((RT_DOWNLOAD == rt)
&& LL_ASSET_STORAGE_TIMEOUT < (mt_secs - tmp->mTime)))
{
- llwarns << "Asset " << getRequestName((ERequestType)rt) << " request "
+ LL_WARNS() << "Asset " << getRequestName((ERequestType)rt) << " request "
<< (all ? "aborted" : "timed out") << " for "
<< tmp->getUUID() << "."
- << LLAssetType::lookup(tmp->getType()) << llendl;
+ << LLAssetType::lookup(tmp->getType()) << LL_ENDL;
timed_out.push_front(tmp);
iter = requests->erase(curiter);
@@ -401,7 +405,7 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
if (user_data)
{
// The *user_data should not be passed without a callback to clean it up.
- llassert(callback != NULL)
+ llassert(callback != NULL);
}
BOOL exists = mStaticVFS->getExists(uuid, type);
@@ -420,8 +424,8 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
}
else
{
- llwarns << "Asset vfile " << uuid << ":" << type
- << " found in static cache with bad size " << file.getSize() << ", ignoring" << llendl;
+ LL_WARNS() << "Asset vfile " << uuid << ":" << type
+ << " found in static cache with bad size " << file.getSize() << ", ignoring" << LL_ENDL;
}
}
return false;
@@ -434,22 +438,23 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
// IW - uuid is passed by value to avoid side effects, please don't re-add &
void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority)
{
- LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
+ LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << LL_ENDL;
- LL_DEBUGS("AssetStorage") << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl;
+ LL_DEBUGS("AssetStorage") << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << LL_ENDL;
if (user_data)
{
// The *user_data should not be passed without a callback to clean it up.
- llassert(callback != NULL)
+ llassert(callback != NULL);
}
if (mShutDown)
{
- LL_DEBUGS("AssetStorage") << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl;
+ LL_DEBUGS("AssetStorage") << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << LL_ENDL;
if (callback)
{
+ add(sFailedDownloadCount, 1);
callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_FAILED, LL_EXSTAT_NONE);
}
return;
@@ -460,6 +465,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
// Special case early out for NULL uuid and for shutting down
if (callback)
{
+ add(sFailedDownloadCount, 1);
callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID);
}
return;
@@ -468,7 +474,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
// Try static VFS first.
if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data))
{
- LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl;
+ LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << LL_ENDL;
return;
}
@@ -486,13 +492,13 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
}
- LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
+ LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << LL_ENDL;
}
else
{
if (exists)
{
- llwarns << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << llendl;
+ LL_WARNS() << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
file.remove();
}
@@ -508,8 +514,8 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
if (callback == tmp->mDownCallback && user_data == tmp->mUserData)
{
// this is a duplicate from the same subsystem - throw it away
- llwarns << "Discarding duplicate request for asset " << uuid
- << "." << LLAssetType::lookup(type) << llendl;
+ LL_WARNS() << "Discarding duplicate request for asset " << uuid
+ << "." << LLAssetType::lookup(type) << LL_ENDL;
return;
}
@@ -521,7 +527,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
if (duplicate)
{
LL_DEBUGS("AssetStorage") << "Adding additional non-duplicate request for asset " << uuid
- << "." << LLAssetType::lookup(type) << llendl;
+ << "." << LLAssetType::lookup(type) << LL_ENDL;
}
// This can be overridden by subclasses
@@ -561,7 +567,7 @@ void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType at
tpvf.setAsset(uuid, atype);
tpvf.setCallback(downloadCompleteCallback, req);
- //llinfos << "Starting transfer for " << uuid << llendl;
+ //LL_INFOS() << "Starting transfer for " << uuid << LL_ENDL;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET);
ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f));
}
@@ -569,9 +575,10 @@ void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType at
else
{
// uh-oh, we shouldn't have gotten here
- llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl;
+ LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
if (callback)
{
+ add(sFailedDownloadCount, 1);
callback(mVFS, uuid, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
}
}
@@ -584,20 +591,20 @@ void LLAssetStorage::downloadCompleteCallback(
LLAssetType::EType file_type,
void* user_data, LLExtStat ext_status)
{
- LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl;
+ LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << LL_ENDL;
LL_DEBUGS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback() for " << file_id
- << "," << LLAssetType::lookup(file_type) << llendl;
+ << "," << LLAssetType::lookup(file_type) << LL_ENDL;
LLAssetRequest* req = (LLAssetRequest*)user_data;
if(!req)
{
- llwarns << "LLAssetStorage::downloadCompleteCallback called without"
- "a valid request." << llendl;
+ LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without"
+ "a valid request." << LL_ENDL;
return;
}
if (!gAssetStorage)
{
- llwarns << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << llendl;
+ LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
return;
}
@@ -620,7 +627,7 @@ void LLAssetStorage::downloadCompleteCallback(
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
if (vfile.getSize() <= 0)
{
- llwarns << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << llendl;
+ LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << LL_ENDL;
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
vfile.remove();
@@ -649,6 +656,10 @@ void LLAssetStorage::downloadCompleteCallback(
LLAssetRequest* tmp = *curiter;
if (tmp->mDownCallback)
{
+ if (result != LL_ERR_NOERR)
+ {
+ add(sFailedDownloadCount, 1);
+ }
tmp->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), tmp->mUserData, result, ext_status);
}
delete tmp;
@@ -659,7 +670,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype,
LLGetAssetCallback callback, void *user_data, BOOL is_priority)
{
- lldebugs << "LLAssetStorage::getEstateAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << ", estatetype " << etype << llendl;
+ LL_DEBUGS() << "LLAssetStorage::getEstateAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << ", estatetype " << etype << LL_ENDL;
//
// Probably will get rid of this early out?
@@ -669,6 +680,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
// Special case early out for NULL uuid
if (callback)
{
+ add(sFailedDownloadCount, 1);
callback(mVFS, asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID);
}
return;
@@ -698,7 +710,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
{
if (exists)
{
- llwarns << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << llendl;
+ LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
file.remove();
}
@@ -731,16 +743,17 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
tpvf.setAsset(asset_id, atype);
tpvf.setCallback(downloadEstateAssetCompleteCallback, req);
- LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << llendl;
+ LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << LL_ENDL;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
ttcp->requestTransfer(spe, tpvf, 100.f + (is_priority ? 1.f : 0.f));
}
else
{
// uh-oh, we shouldn't have gotten here
- llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl;
+ LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
if (callback)
{
+ add(sFailedDownloadCount, 1);
callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
}
}
@@ -757,14 +770,14 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
LLEstateAssetRequest *req = (LLEstateAssetRequest*)user_data;
if(!req)
{
- llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
- " without a valid request." << llendl;
+ LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
+ " without a valid request." << LL_ENDL;
return;
}
if (!gAssetStorage)
{
- llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
- " without any asset system, aborting!" << llendl;
+ LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
+ " without any asset system, aborting!" << LL_ENDL;
return;
}
@@ -776,13 +789,17 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType());
if (vfile.getSize() <= 0)
{
- llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl;
+ LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
vfile.remove();
}
}
+ if (result != LL_ERR_NOERR)
+ {
+ add(sFailedDownloadCount, 1);
+ }
req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getAType(), req->mUserData, result, ext_status);
}
@@ -791,7 +808,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
const LLUUID &asset_id, LLAssetType::EType atype,
LLGetAssetCallback callback, void *user_data, BOOL is_priority)
{
- lldebugs << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << llendl;
+ LL_DEBUGS() << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << LL_ENDL;
//
// Probably will get rid of this early out?
@@ -822,7 +839,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
size = exists ? file.getSize() : 0;
if(exists && size < 1)
{
- llwarns << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << llendl;
+ LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
file.remove();
}
@@ -873,16 +890,17 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
LL_DEBUGS("AssetStorage") << "Starting transfer for inventory asset "
<< item_id << " owned by " << owner_id << "," << task_id
- << llendl;
+ << LL_ENDL;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
ttcp->requestTransfer(spi, tpvf, 100.f + (is_priority ? 1.f : 0.f));
}
else
{
// uh-oh, we shouldn't have gotten here
- llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl;
+ LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
if (callback)
{
+ add(sFailedDownloadCount, 1);
callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
}
}
@@ -900,13 +918,13 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
LLInvItemRequest *req = (LLInvItemRequest*)user_data;
if(!req)
{
- llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
- " without a valid request." << llendl;
+ LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
+ " without a valid request." << LL_ENDL;
return;
}
if (!gAssetStorage)
{
- llwarns << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << llendl;
+ LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
return;
}
@@ -918,13 +936,17 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
if (vfile.getSize() <= 0)
{
- llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl;
+ LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
vfile.remove();
}
}
+ if (result != LL_ERR_NOERR)
+ {
+ add(sFailedDownloadCount, 1);
+ }
req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), req->mUserData, result, ext_status);
}
@@ -937,7 +959,7 @@ void LLAssetStorage::uploadCompleteCallback(const LLUUID& uuid, void *user_data,
{
if (!gAssetStorage)
{
- llwarns << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << llendl;
+ LL_WARNS() << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << LL_ENDL;
return;
}
LLAssetRequest *req = (LLAssetRequest *)user_data;
@@ -945,7 +967,7 @@ void LLAssetStorage::uploadCompleteCallback(const LLUUID& uuid, void *user_data,
if (result)
{
- llwarns << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << llendl;
+ LL_WARNS() << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << LL_ENDL;
success = FALSE;
}
@@ -1027,7 +1049,7 @@ LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStorage::E
case RT_LOCALUPLOAD:
return &mPendingLocalUploads;
default:
- llwarns << "Unable to find request list for request type '" << rt << "'" << llendl;
+ LL_WARNS() << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
return NULL;
}
}
@@ -1043,7 +1065,7 @@ const LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStor
case RT_LOCALUPLOAD:
return &mPendingLocalUploads;
default:
- llwarns << "Unable to find request list for request type '" << rt << "'" << llendl;
+ LL_WARNS() << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
return NULL;
}
}
@@ -1060,7 +1082,7 @@ std::string LLAssetStorage::getRequestName(LLAssetStorage::ERequestType rt)
case RT_LOCALUPLOAD:
return "localupload";
default:
- llwarns << "Unable to find request name for request type '" << rt << "'" << llendl;
+ LL_WARNS() << "Unable to find request name for request type '" << rt << "'" << LL_ENDL;
return "";
}
}
@@ -1213,7 +1235,7 @@ bool LLAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt,
{
LL_DEBUGS("AssetStorage") << "Asset " << getRequestName(rt) << " request for "
<< asset_id << "." << LLAssetType::lookup(asset_type)
- << " removed from pending queue." << llendl;
+ << " removed from pending queue." << LL_ENDL;
return true;
}
return false;
@@ -1237,6 +1259,7 @@ bool LLAssetStorage::deletePendingRequestImpl(LLAssetStorage::request_list_t* re
}
if (req->mDownCallback)
{
+ add(sFailedDownloadCount, 1);
req->mDownCallback(mVFS, req->getUUID(), req->getType(), req->mUserData, error, LL_EXSTAT_REQUEST_DROPPED);
}
if (req->mInfoCallback)
@@ -1307,7 +1330,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData)
{
// this is a duplicate from the same subsystem - throw it away
- LL_DEBUGS("AssetStorage") << "Discarding duplicate request for UUID " << uuid << llendl;
+ LL_DEBUGS("AssetStorage") << "Discarding duplicate request for UUID " << uuid << LL_ENDL;
return;
}
}
@@ -1363,6 +1386,10 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss
}
}
+ if (status != LL_ERR_NOERR)
+ {
+ add(sFailedDownloadCount, 1);
+ }
legacy->mDownCallback(filename.c_str(), uuid, legacy->mUserData, status, ext_status);
delete legacy;
}
@@ -1378,9 +1405,9 @@ void LLAssetStorage::storeAssetData(
bool is_priority,
bool store_local,
bool user_waiting,
- F64 timeout)
+ F64Seconds timeout)
{
- llwarns << "storeAssetData: wrong version called" << llendl;
+ LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
// LLAssetStorage metric: Virtual base call
reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" );
}
@@ -1397,9 +1424,9 @@ void LLAssetStorage::storeAssetData(
bool store_local,
const LLUUID& requesting_agent_id,
bool user_waiting,
- F64 timeout)
+ F64Seconds timeout)
{
- llwarns << "storeAssetData: wrong version called" << llendl;
+ LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
// LLAssetStorage metric: Virtual base call
reportMetric( asset_id, asset_type, LLStringUtil::null, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" );
}
@@ -1415,9 +1442,9 @@ void LLAssetStorage::storeAssetData(
bool temp_file,
bool is_priority,
bool user_waiting,
- F64 timeout)
+ F64Seconds timeout)
{
- llwarns << "storeAssetData: wrong version called" << llendl;
+ LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
// LLAssetStorage metric: Virtual base call
reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" );
}
@@ -1433,9 +1460,9 @@ void LLAssetStorage::storeAssetData(
bool temp_file,
bool is_priority,
bool user_waiting,
- F64 timeout)
+ F64Seconds timeout)
{
- llwarns << "storeAssetData: wrong version called" << llendl;
+ LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
// LLAssetStorage metric: Virtual base call
reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" );
}
@@ -1490,7 +1517,7 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET
{
if( !metric_recipient )
{
- LL_DEBUGS("AssetStorage") << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl;
+ LL_DEBUGS("AssetStorage") << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << LL_ENDL;
return;
}
diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h
index 563ff9e077..1bb4acea9e 100755
--- a/indra/llmessage/llassetstorage.h
+++ b/indra/llmessage/llassetstorage.h
@@ -34,11 +34,11 @@
#include "lltimer.h"
#include "llnamevalue.h"
#include "llhost.h"
-#include "stdenums.h" // for EDragAndDropType
#include "lltransfermanager.h" // For LLTSCode enum
#include "llassettype.h"
#include "llstring.h"
#include "llextendedstatus.h"
+#include "llxfer.h"
// Forward declarations
class LLMessageSystem;
@@ -49,7 +49,16 @@ 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;
+const F32Minutes LL_ASSET_STORAGE_TIMEOUT(5);
+
+
+// Specific error codes
+const int LL_ERR_ASSET_REQUEST_FAILED = -1;
+//const int LL_ERR_ASSET_REQUEST_INVALID = -2;
+const int LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3;
+const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4;
+const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5;
+const int LL_ERR_PRICE_MISMATCH = -23018;
class LLAssetInfo
{
@@ -94,7 +103,7 @@ public:
void setUUID(const LLUUID& id) { mUUID = id; }
void setType(LLAssetType::EType type) { mType = type; }
- void setTimeout (F64 timeout) { mTimeout = timeout; }
+ void setTimeout (F64Seconds timeout) { mTimeout = timeout; }
protected:
LLUUID mUUID;
@@ -110,8 +119,8 @@ public:
BOOL mIsTemp;
BOOL mIsLocal;
BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result.
- F64 mTime; // Message system time
- F64 mTimeout; // Amount of time before timing out.
+ F64Seconds mTime; // Message system time
+ F64Seconds mTimeout; // Amount of time before timing out.
BOOL mIsPriority;
BOOL mDataSentInFirstPacket;
BOOL mDataIsInVFS;
@@ -154,7 +163,7 @@ public:
void *mUserData;
LLHost mHost;
BOOL mIsTemp;
- F64 mTime; // Message system time
+ F64Seconds mTime; // Message system time
BOOL mIsPriority;
BOOL mDataSentInFirstPacket;
BOOL mDataIsInVFS;
@@ -184,7 +193,7 @@ public:
void *mUserData;
LLHost mHost;
BOOL mIsTemp;
- F64 mTime; // Message system time
+ F64Seconds mTime; // Message system time
BOOL mIsPriority;
BOOL mDataSentInFirstPacket;
BOOL mDataIsInVFS;
@@ -270,7 +279,7 @@ public:
bool is_priority = false,
bool store_local = false,
bool user_waiting= false,
- F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
+ F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
/*
* AssetID version
@@ -286,7 +295,7 @@ public:
bool store_local = false,
const LLUUID& requesting_agent_id = LLUUID::null,
bool user_waiting= false,
- F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
+ F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
virtual void checkForTimeouts();
@@ -394,7 +403,7 @@ public:
bool temp_file = false,
bool is_priority = false,
bool user_waiting = false,
- F64 timeout = LL_ASSET_STORAGE_TIMEOUT);
+ F64Seconds timeout = LL_ASSET_STORAGE_TIMEOUT);
/*
* TransactionID version
@@ -408,7 +417,7 @@ public:
bool temp_file = false,
bool is_priority = false,
bool user_waiting = false,
- F64 timeout = LL_ASSET_STORAGE_TIMEOUT);
+ F64Seconds timeout = LL_ASSET_STORAGE_TIMEOUT);
static void legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType, void *user_data, S32 status, LLExtStat ext_status);
static void legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status, LLExtStat ext_status);
diff --git a/indra/llmessage/llavatarname.cpp b/indra/llmessage/llavatarname.cpp
new file mode 100644
index 0000000000..d12f157910
--- /dev/null
+++ b/indra/llmessage/llavatarname.cpp
@@ -0,0 +1,254 @@
+/**
+ * @file llavatarname.cpp
+ * @brief Represents name-related data for an avatar, such as the
+ * username/SLID ("bobsmith123" or "james.linden") and the display
+ * name ("James Cook")
+ *
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+#include "linden_common.h"
+
+#include "llavatarname.h"
+
+#include "lldate.h"
+#include "llframetimer.h"
+#include "llsd.h"
+
+// Store these in pre-built std::strings to avoid memory allocations in
+// LLSD map lookups
+static const std::string USERNAME("username");
+static const std::string DISPLAY_NAME("display_name");
+static const std::string LEGACY_FIRST_NAME("legacy_first_name");
+static const std::string LEGACY_LAST_NAME("legacy_last_name");
+static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default");
+static const std::string DISPLAY_NAME_EXPIRES("display_name_expires");
+static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update");
+
+bool LLAvatarName::sUseDisplayNames = true;
+bool LLAvatarName::sUseUsernames = true;
+
+// Minimum time-to-live (in seconds) for a name entry.
+// Avatar name should always guarantee to expire reasonably soon by default
+// so if the failure to get a valid expiration time was due to something temporary
+// we will eventually request and get the right data.
+const F64 MIN_ENTRY_LIFETIME = 60.0;
+
+LLAvatarName::LLAvatarName()
+: mUsername(),
+ mDisplayName(),
+ mLegacyFirstName(),
+ mLegacyLastName(),
+ mIsDisplayNameDefault(false),
+ mIsTemporaryName(false),
+ mExpires(F64_MAX),
+ mNextUpdate(0.0)
+{ }
+
+bool LLAvatarName::operator<(const LLAvatarName& rhs) const
+{
+ if (mUsername == rhs.mUsername)
+ return mDisplayName < rhs.mDisplayName;
+ else
+ return mUsername < rhs.mUsername;
+}
+
+//static
+void LLAvatarName::setUseDisplayNames(bool use)
+{
+ sUseDisplayNames = use;
+}
+//static
+bool LLAvatarName::useDisplayNames()
+{
+ return sUseDisplayNames;
+}
+
+void LLAvatarName::setUseUsernames(bool use)
+{
+ sUseUsernames = use;
+}
+
+bool LLAvatarName::useUsernames()
+{
+ return sUseUsernames;
+}
+
+LLSD LLAvatarName::asLLSD() const
+{
+ LLSD sd;
+ sd[USERNAME] = mUsername;
+ sd[DISPLAY_NAME] = mDisplayName;
+ sd[LEGACY_FIRST_NAME] = mLegacyFirstName;
+ sd[LEGACY_LAST_NAME] = mLegacyLastName;
+ sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault;
+ sd[DISPLAY_NAME_EXPIRES] = LLDate(mExpires);
+ sd[DISPLAY_NAME_NEXT_UPDATE] = LLDate(mNextUpdate);
+ return sd;
+}
+
+void LLAvatarName::fromLLSD(const LLSD& sd)
+{
+ mUsername = sd[USERNAME].asString();
+ mDisplayName = sd[DISPLAY_NAME].asString();
+ mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString();
+ mLegacyLastName = sd[LEGACY_LAST_NAME].asString();
+ mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean();
+ LLDate expires = sd[DISPLAY_NAME_EXPIRES];
+ mExpires = expires.secondsSinceEpoch();
+ LLDate next_update = sd[DISPLAY_NAME_NEXT_UPDATE];
+ mNextUpdate = next_update.secondsSinceEpoch();
+
+ // Some avatars don't have explicit display names set. Force a legible display name here.
+ if (mDisplayName.empty())
+ {
+ mDisplayName = mUsername;
+ }
+}
+
+// Transform a string (typically provided by the legacy service) into a decent
+// avatar name instance.
+void LLAvatarName::fromString(const std::string& full_name)
+{
+ mDisplayName = full_name;
+ std::string::size_type index = full_name.find(' ');
+ if (index != std::string::npos)
+ {
+ // The name is in 2 parts (first last)
+ mLegacyFirstName = full_name.substr(0, index);
+ mLegacyLastName = full_name.substr(index+1);
+ if (mLegacyLastName != "Resident")
+ {
+ mUsername = mLegacyFirstName + "." + mLegacyLastName;
+ mDisplayName = full_name;
+ LLStringUtil::toLower(mUsername);
+ }
+ else
+ {
+ // Very old names do have a dummy "Resident" last name
+ // that we choose to hide from users.
+ mUsername = mLegacyFirstName;
+ mDisplayName = mLegacyFirstName;
+ }
+ }
+ else
+ {
+ mLegacyFirstName = full_name;
+ mLegacyLastName = "";
+ mUsername = full_name;
+ mDisplayName = full_name;
+ }
+ mIsDisplayNameDefault = true;
+ mIsTemporaryName = true;
+ setExpires(MIN_ENTRY_LIFETIME);
+}
+
+void LLAvatarName::setExpires(F64 expires)
+{
+ mExpires = LLFrameTimer::getTotalSeconds() + expires;
+}
+
+std::string LLAvatarName::getCompleteName() const
+{
+ std::string name;
+ if (sUseDisplayNames)
+ {
+ if (mUsername.empty() || mIsDisplayNameDefault)
+ {
+ // If this particular display name is defaulted (i.e. based on user name),
+ // then display only the easier to read instance of the person's name.
+ name = mDisplayName;
+ }
+ else
+ {
+ name = mDisplayName;
+ if(sUseUsernames)
+ {
+ name += " (" + mUsername + ")";
+ }
+ }
+ }
+ else
+ {
+ name = getUserName();
+ }
+ return name;
+}
+
+std::string LLAvatarName::getLegacyName() const
+{
+ if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled?
+ {
+ return mDisplayName;
+ }
+
+ std::string name;
+ name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() );
+ name = mLegacyFirstName;
+ name += " ";
+ name += mLegacyLastName;
+ return name;
+}
+
+std::string LLAvatarName::getDisplayName() const
+{
+ if (sUseDisplayNames)
+ {
+ return mDisplayName;
+ }
+ else
+ {
+ return getUserName();
+ }
+}
+
+std::string LLAvatarName::getUserName() const
+{
+ std::string name;
+ if (mLegacyLastName.empty() || (mLegacyLastName == "Resident"))
+ {
+ if (mLegacyFirstName.empty())
+ {
+ // If we cannot create a user name from the legacy strings, use the display name
+ name = mDisplayName;
+ }
+ else
+ {
+ // The last name might be empty if it defaulted to "Resident"
+ name = mLegacyFirstName;
+ }
+ }
+ else
+ {
+ name = mLegacyFirstName + " " + mLegacyLastName;
+ }
+ return name;
+}
+
+void LLAvatarName::dump() const
+{
+ LL_DEBUGS("AvNameCache") << "LLAvatarName: "
+ << "user '" << mUsername << "' "
+ << "display '" << mDisplayName << "' "
+ << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds"
+ << LL_ENDL;
+}
+
diff --git a/indra/llmessage/llavatarname.h b/indra/llmessage/llavatarname.h
new file mode 100644
index 0000000000..1cb3ae421f
--- /dev/null
+++ b/indra/llmessage/llavatarname.h
@@ -0,0 +1,139 @@
+/**
+ * @file llavatarname.h
+ * @brief Represents name-related data for an avatar, such as the
+ * username/SLID ("bobsmith123" or "james.linden") and the display
+ * name ("James Cook")
+ *
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+#ifndef LLAVATARNAME_H
+#define LLAVATARNAME_H
+
+#include <string>
+
+class LLSD;
+
+class LL_COMMON_API LLAvatarName
+{
+public:
+ LLAvatarName();
+
+ bool operator<(const LLAvatarName& rhs) const;
+
+ // Conversion to and from LLSD (cache file or server response)
+ LLSD asLLSD() const;
+ void fromLLSD(const LLSD& sd);
+
+ // Used only in legacy mode when the display name capability is not provided server side
+ // or to otherwise create a temporary valid item.
+ void fromString(const std::string& full_name);
+
+ // Set the name object to become invalid in "expires" seconds from now
+ void setExpires(F64 expires);
+
+ // Set and get the display name flag set by the user in preferences.
+ static void setUseDisplayNames(bool use);
+ static bool useDisplayNames();
+
+ static void setUseUsernames(bool use);
+ static bool useUsernames();
+
+ // A name object is valid if not temporary and not yet expired (default is expiration not checked)
+ bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); }
+
+ // Return true if the name is made up from legacy or temporary data
+ bool isDisplayNameDefault() const { return mIsDisplayNameDefault; }
+
+ // For normal names, returns "James Linden (james.linden)"
+ // When display names are disabled returns just "James Linden"
+ std::string getCompleteName() const;
+
+ // Returns "James Linden" or "bobsmith123 Resident" for backwards
+ // compatibility with systems like voice and muting
+ // *TODO: Eliminate this in favor of username only
+ std::string getLegacyName() const;
+
+ // "José Sanchez" or "James Linden", UTF-8 encoded Unicode
+ // Takes the display name preference into account. This is truly the name that should
+ // be used for all UI where an avatar name has to be used unless we truly want something else (rare)
+ std::string getDisplayName() const;
+
+ // Returns "James Linden" or "bobsmith123 Resident"
+ // Used where we explicitely prefer or need a non UTF-8 legacy (ASCII) name
+ // Also used for backwards compatibility with systems like voice and muting
+ std::string getUserName() const;
+
+ // Returns "james.linden" or the legacy name for very old names
+ std::string getAccountName() const { return mUsername; }
+
+ // Debug print of the object
+ void dump() const;
+
+ // Names can change, so need to keep track of when name was
+ // last checked.
+ // Unix time-from-epoch seconds for efficiency
+ F64 mExpires;
+
+ // You can only change your name every N hours, so record
+ // when the next update is allowed
+ // Unix time-from-epoch seconds
+ F64 mNextUpdate;
+
+private:
+ // "bobsmith123" or "james.linden", US-ASCII only
+ std::string mUsername;
+
+ // "José Sanchez" or "James Linden", UTF-8 encoded Unicode
+ // Contains data whether or not user has explicitly set
+ // a display name; may duplicate their username.
+ std::string mDisplayName;
+
+ // For "James Linden", "James"
+ // For "bobsmith123", "bobsmith123"
+ // Used to communicate with legacy systems like voice and muting which
+ // rely on old-style names.
+ // *TODO: Eliminate this in favor of username only
+ std::string mLegacyFirstName;
+
+ // For "James Linden", "Linden"
+ // For "bobsmith123", "Resident"
+ // see above for rationale
+ std::string mLegacyLastName;
+
+ // If true, both display name and SLID were generated from
+ // a legacy first and last name, like "James Linden (james.linden)"
+ bool mIsDisplayNameDefault;
+
+ // Under error conditions, we may insert "dummy" records with
+ // names like "???" into caches as placeholders. These can be
+ // shown in UI, but are not serialized.
+ bool mIsTemporaryName;
+
+ // Global flag indicating if display name should be used or not
+ // This will affect the output of the high level "get" methods
+ static bool sUseDisplayNames;
+
+ // Flag indicating if username should be shown after display name or not
+ static bool sUseUsernames;
+};
+
+#endif
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 31dd264021..d02a60b7b2 100755
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -121,7 +121,7 @@ namespace LLAvatarNameCache
// Erase expired names from cache
void eraseUnrefreshed();
- bool expirationFromCacheControl(LLSD headers, F64 *expires);
+ bool expirationFromCacheControl(const LLSD& headers, F64 *expires);
}
/* Sample response:
@@ -165,33 +165,31 @@ namespace LLAvatarNameCache
class LLAvatarNameResponder : public LLHTTPClient::Responder
{
+ LOG_CLASS(LLAvatarNameResponder);
private:
// need to store agent ids that are part of this request in case of
// an error, so we can flag them as unavailable
std::vector<LLUUID> mAgentIDs;
- // Need the headers to look up Expires: and Retry-After:
- LLSD mHeaders;
-
public:
LLAvatarNameResponder(const std::vector<LLUUID>& agent_ids)
- : mAgentIDs(agent_ids),
- mHeaders()
+ : mAgentIDs(agent_ids)
{ }
- /*virtual*/ void completedHeader(U32 status, const std::string& reason,
- const LLSD& headers)
- {
- mHeaders = headers;
- }
-
- /*virtual*/ void result(const LLSD& content)
+protected:
+ /*virtual*/ void httpSuccess()
{
+ const LLSD& content = getContent();
+ if (!content.isMap())
+ {
+ failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
+ return;
+ }
// Pull expiration out of headers if available
- F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mHeaders);
+ F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(getResponseHeaders());
F64 now = LLFrameTimer::getTotalSeconds();
- LLSD agents = content["agents"];
+ const LLSD& agents = content["agents"];
LLSD::array_const_iterator it = agents.beginArray();
for ( ; it != agents.endArray(); ++it)
{
@@ -212,7 +210,7 @@ public:
}
// Same logic as error response case
- LLSD unresolved_agents = content["bad_ids"];
+ const LLSD& unresolved_agents = content["bad_ids"];
S32 num_unresolved = unresolved_agents.size();
if (num_unresolved > 0)
{
@@ -236,14 +234,13 @@ public:
<< LL_ENDL;
}
- /*virtual*/ void error(U32 status, const std::string& reason)
+ /*virtual*/ void httpFailure()
{
// If there's an error, it might be caused by PeopleApi,
// or when loading textures on startup and using a very slow
// network, this query may time out.
// What we should do depends on whether or not we have a cached name
- LL_WARNS("AvNameCache") << "LLAvatarNameResponder::error " << status << " " << reason
- << LL_ENDL;
+ LL_WARNS("AvNameCache") << dumpResponse() << LL_ENDL;
// Add dummy records for any agent IDs in this request that we do not have cached already
std::vector<LLUUID>::const_iterator it = mAgentIDs.begin();
@@ -700,7 +697,7 @@ void LLAvatarNameCache::insert(const LLUUID& agent_id, const LLAvatarName& av_na
sCache[agent_id] = av_name;
}
-F64 LLAvatarNameCache::nameExpirationFromHeaders(LLSD headers)
+F64 LLAvatarNameCache::nameExpirationFromHeaders(const LLSD& headers)
{
F64 expires = 0.0;
if (expirationFromCacheControl(headers, &expires))
@@ -716,17 +713,21 @@ F64 LLAvatarNameCache::nameExpirationFromHeaders(LLSD headers)
}
}
-bool LLAvatarNameCache::expirationFromCacheControl(LLSD headers, F64 *expires)
+bool LLAvatarNameCache::expirationFromCacheControl(const LLSD& headers, F64 *expires)
{
bool fromCacheControl = false;
F64 now = LLFrameTimer::getTotalSeconds();
// Allow the header to override the default
- LLSD cache_control_header = headers["cache-control"];
- if (cache_control_header.isDefined())
+ std::string cache_control;
+ if (headers.has(HTTP_IN_HEADER_CACHE_CONTROL))
+ {
+ cache_control = headers[HTTP_IN_HEADER_CACHE_CONTROL].asString();
+ }
+
+ if (!cache_control.empty())
{
S32 max_age = 0;
- std::string cache_control = cache_control_header.asString();
if (max_age_from_cache_control(cache_control, &max_age))
{
*expires = now + (F64)max_age;
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index 3a19cee3ed..ea016b3125 100755
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -90,7 +90,7 @@ namespace LLAvatarNameCache
// Compute name expiration time from HTTP Cache-Control header,
// or return default value, in seconds from epoch.
- F64 nameExpirationFromHeaders(LLSD headers);
+ F64 nameExpirationFromHeaders(const LLSD& headers);
void addUseDisplayNamesCallback(const use_display_name_signal_t::slot_type& cb);
}
diff --git a/indra/llmessage/llblowfishcipher.cpp b/indra/llmessage/llblowfishcipher.cpp
index 88aaf7c52a..0b5025a422 100755
--- a/indra/llmessage/llblowfishcipher.cpp
+++ b/indra/llmessage/llblowfishcipher.cpp
@@ -70,10 +70,10 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
int blocksize = EVP_CIPHER_CTX_block_size(&context);
int keylen = EVP_CIPHER_CTX_key_length(&context);
int iv_length = EVP_CIPHER_CTX_iv_length(&context);
- lldebugs << "LLBlowfishCipher blocksize " << blocksize
+ LL_DEBUGS() << "LLBlowfishCipher blocksize " << blocksize
<< " keylen " << keylen
<< " iv_len " << iv_length
- << llendl;
+ << LL_ENDL;
int output_len = 0;
int temp_len = 0;
@@ -83,7 +83,7 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
src,
src_len))
{
- llwarns << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << llendl;
+ LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << LL_ENDL;
goto ERROR;
}
@@ -91,7 +91,7 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
// not an exact multiple of the block size.
if (!EVP_EncryptFinal_ex(&context, (unsigned char*)(dst + output_len), &temp_len))
{
- llwarns << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << llendl;
+ LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << LL_ENDL;
goto ERROR;
}
output_len += temp_len;
@@ -107,7 +107,7 @@ ERROR:
// virtual
U32 LLBlowfishCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
{
- llerrs << "LLBlowfishCipher decrypt unsupported" << llendl;
+ LL_ERRS() << "LLBlowfishCipher decrypt unsupported" << LL_ENDL;
return 0;
}
diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp
index aaa49d2ed6..d07d9980c3 100755
--- a/indra/llmessage/llbuffer.cpp
+++ b/indra/llmessage/llbuffer.cpp
@@ -32,8 +32,9 @@
#include "llmath.h"
#include "llstl.h"
#include "llthread.h"
+#include <iterator>
-#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED llassert(!mMutexp || mMutexp->isSelfLocked());
+#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED() llassert(!mMutexp || mMutexp->isSelfLocked())
/**
* LLSegment
@@ -180,8 +181,8 @@ bool LLHeapBuffer::reclaimSegment(const LLSegment& segment)
}
else if(mReclaimedBytes > mSize)
{
- llwarns << "LLHeapBuffer reclaimed more memory than allocated."
- << " This is probably programmer error." << llendl;
+ LL_WARNS() << "LLHeapBuffer reclaimed more memory than allocated."
+ << " This is probably programmer error." << LL_ENDL;
}
return true;
}
@@ -286,7 +287,7 @@ LLChannelDescriptors LLBufferArray::nextChannel()
//mMutexp should be locked before calling this.
S32 LLBufferArray::capacity() const
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
S32 total = 0;
const_buffer_iterator_t iter = mBuffers.begin();
@@ -314,7 +315,7 @@ bool LLBufferArray::append(S32 channel, const U8* src, S32 len)
//mMutexp should be locked before calling this.
bool LLBufferArray::prepend(S32 channel, const U8* src, S32 len)
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
std::vector<LLSegment> segments;
if(copyIntoBuffers(channel, src, len, segments))
@@ -349,7 +350,7 @@ bool LLBufferArray::insertAfter(
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
segment_iterator_t end = mSegments.end();
segment_iterator_t it = getSegment(address);
@@ -381,14 +382,14 @@ LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address)
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::beginSegment()
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
return mSegments.begin();
}
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::endSegment()
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
return mSegments.end();
}
@@ -397,7 +398,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
U8* address,
LLSegment& segment)
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
segment_iterator_t rv = mSegments.begin();
segment_iterator_t end = mSegments.end();
if(!address)
@@ -446,7 +447,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter(
//mMutexp should be locked before calling this.
LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
segment_iterator_t end = mSegments.end();
if(!address)
{
@@ -468,7 +469,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address)
LLBufferArray::const_segment_iterator_t LLBufferArray::getSegment(
U8* address) const
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
const_segment_iterator_t end = mSegments.end();
if(!address)
{
@@ -623,7 +624,7 @@ U8* LLBufferArray::seek(
U8* start,
S32 delta) const
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
const_segment_iterator_t it;
const_segment_iterator_t end = mSegments.end();
U8* rv = start;
@@ -791,7 +792,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
S32 channel,
S32 len)
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
// start at the end of the buffers, because it is the most likely
// to have free space.
LLSegment segment;
@@ -829,7 +830,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment(
//mMutexp should be locked before calling this.
bool LLBufferArray::eraseSegment(const segment_iterator_t& erase_iter)
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
// Find out which buffer contains the segment, and if it is found,
// ask it to reclaim the memory.
@@ -861,7 +862,7 @@ bool LLBufferArray::copyIntoBuffers(
S32 len,
std::vector<LLSegment>& segments)
{
- ASSERT_LLBUFFERARRAY_MUTEX_LOCKED
+ ASSERT_LLBUFFERARRAY_MUTEX_LOCKED();
if(!src || !len) return false;
S32 copied = 0;
LLSegment segment;
diff --git a/indra/llmessage/llbufferstream.cpp b/indra/llmessage/llbufferstream.cpp
index a51a48edc3..ff1c9993cc 100755
--- a/indra/llmessage/llbufferstream.cpp
+++ b/indra/llmessage/llbufferstream.cpp
@@ -53,7 +53,7 @@ LLBufferStreamBuf::~LLBufferStreamBuf()
// virtual
int LLBufferStreamBuf::underflow()
{
- //lldebugs << "LLBufferStreamBuf::underflow()" << llendl;
+ //LL_DEBUGS() << "LLBufferStreamBuf::underflow()" << LL_ENDL;
if(!mBuffer)
{
return EOF;
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 13d779ff83..4dd8d04656 100755
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -343,7 +343,7 @@ bool LLCacheName::importFile(std::istream& istr)
++count;
}
- llinfos << "LLCacheName loaded " << count << " agent names" << llendl;
+ LL_INFOS() << "LLCacheName loaded " << count << " agent names" << LL_ENDL;
count = 0;
LLSD groups = data[GROUPS];
@@ -364,7 +364,7 @@ bool LLCacheName::importFile(std::istream& istr)
impl.mReverseCache[entry->mGroupName] = id;
++count;
}
- llinfos << "LLCacheName loaded " << count << " group names" << llendl;
+ LL_INFOS() << "LLCacheName loaded " << count << " group names" << LL_ENDL;
return true;
}
@@ -440,7 +440,7 @@ void LLCacheName::localizeCacheName(std::string key, std::string value)
if (key!="" && value!= "" )
sCacheName[key]=value;
else
- llwarns<< " Error localizing cache key " << key << " To "<< value<<llendl;
+ LL_WARNS()<< " Error localizing cache key " << key << " To "<< value<<LL_ENDL;
}
BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname)
@@ -467,7 +467,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
// COUNTER-HACK to combat James' HACK in exportFile()...
// this group name was loaded from a name cache that did not
// bother to save the group name ==> we must ask for it
- lldebugs << "LLCacheName queuing HACK group request: " << id << llendl;
+ LL_DEBUGS() << "LLCacheName queuing HACK group request: " << id << LL_ENDL;
entry = NULL;
}
@@ -676,8 +676,8 @@ void LLCacheName::processPending()
if(!impl.mUpstreamHost.isOk())
{
- lldebugs << "LLCacheName::processPending() - bad upstream host."
- << llendl;
+ LL_DEBUGS() << "LLCacheName::processPending() - bad upstream host."
+ << LL_ENDL;
return;
}
@@ -724,33 +724,33 @@ void LLCacheName::dump()
LLCacheNameEntry* entry = iter->second;
if (entry->mIsGroup)
{
- llinfos
+ LL_INFOS()
<< iter->first << " = (group) "
<< entry->mGroupName
<< " @ " << entry->mCreateTime
- << llendl;
+ << LL_ENDL;
}
else
{
- llinfos
+ LL_INFOS()
<< iter->first << " = "
<< buildFullName(entry->mFirstName, entry->mLastName)
<< " @ " << entry->mCreateTime
- << llendl;
+ << LL_ENDL;
}
}
}
void LLCacheName::dumpStats()
{
- llinfos << "Queue sizes: "
+ LL_INFOS() << "Queue sizes: "
<< " Cache=" << impl.mCache.size()
<< " AskName=" << impl.mAskNameQueue.size()
<< " AskGroup=" << impl.mAskGroupQueue.size()
<< " Pending=" << impl.mPendingQueue.size()
<< " Reply=" << impl.mReplyQueue.size()
// << " Observers=" << impl.mSignal.size()
- << llendl;
+ << LL_ENDL;
}
void LLCacheName::clear()
@@ -886,7 +886,7 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup)
// level, hence having an upstream provider.
if (!mUpstreamHost.isOk())
{
- llwarns << "LLCacheName - got UUID name/group request, but no upstream provider!" << llendl;
+ LL_WARNS() << "LLCacheName - got UUID name/group request, but no upstream provider!" << LL_ENDL;
return;
}
@@ -903,11 +903,11 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup)
{
if (isGroup != entry->mIsGroup)
{
- llwarns << "LLCacheName - Asked for "
+ LL_WARNS() << "LLCacheName - Asked for "
<< (isGroup ? "group" : "user") << " name, "
<< "but found "
<< (entry->mIsGroup ? "group" : "user")
- << ": " << id << llendl;
+ << ": " << id << LL_ENDL;
}
else
{
diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp
index 0c2d4b823d..5aaada63b1 100755
--- a/indra/llmessage/llcircuit.cpp
+++ b/indra/llmessage/llcircuit.cpp
@@ -60,12 +60,12 @@
const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked.
const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked.
-const F32 TARGET_PERIOD_LENGTH = 5.f; // seconds
-const F32 LL_DUPLICATE_SUPPRESSION_TIMEOUT = 60.f; //seconds - this can be long, as time-based cleanup is
+const F32Seconds TARGET_PERIOD_LENGTH(5.f);
+const F32Seconds LL_DUPLICATE_SUPPRESSION_TIMEOUT(60.f); //this can be long, as time-based cleanup is
// only done when wrapping packetids, now...
LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
- const F32 circuit_heartbeat_interval, const F32 circuit_timeout)
+ const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout)
: mHost (host),
mWrapID(0),
mPacketsOutID(0),
@@ -84,7 +84,7 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
mPingsInTransit(0),
mLastPingID(0),
mPingDelay(INITIAL_PING_VALUE_MSEC),
- mPingDelayAveraged((F32)INITIAL_PING_VALUE_MSEC),
+ mPingDelayAveraged(INITIAL_PING_VALUE_MSEC),
mUnackedPacketCount(0),
mUnackedPacketBytes(0),
mLastPacketInTime(0.0),
@@ -110,13 +110,13 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
{
// Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been
// running a message system loop.
- F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE);
+ F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE);
F32 distribution_offset = ll_frand();
mPingTime = mt_sec;
mLastPingSendTime = mt_sec + mHeartbeatInterval * distribution_offset;
mLastPingReceivedTime = mt_sec;
- mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval);
+ mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + F32Seconds(ll_frand(0.1f*mHeartbeatInterval.value()));
mPeriodTime = mt_sec;
mLocalEndPointID.generate();
@@ -183,7 +183,7 @@ LLCircuitData::~LLCircuitData()
std::ostream_iterator<TPACKETID> append(str, " ");
str << "MSG: -> " << mHost << "\tABORTING RELIABLE:\t";
std::copy(doomed.begin(), doomed.end(), append);
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
}
@@ -203,11 +203,11 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num)
std::ostringstream str;
str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t"
<< packetp->mPacketID;
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
if (packetp->mCallback)
{
- if (packetp->mTimeout < 0.f) // negative timeout will always return timeout even for successful ack, for debugging
+ if (packetp->mTimeout < F32Seconds(0.f)) // negative timeout will always return timeout even for successful ack, for debugging
{
packetp->mCallback(packetp->mCallbackData,LL_ERR_TCP_TIMEOUT);
}
@@ -231,17 +231,17 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num)
if (iter != mFinalRetryPackets.end())
{
packetp = iter->second;
- // llinfos << "Packet " << packet_num << " removed from the pending list" << llendl;
+ // LL_INFOS() << "Packet " << packet_num << " removed from the pending list" << LL_ENDL;
if(gMessageSystem->mVerboseLog)
{
std::ostringstream str;
str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t"
<< packetp->mPacketID;
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
if (packetp->mCallback)
{
- if (packetp->mTimeout < 0.f) // negative timeout will always return timeout even for successful ack, for debugging
+ if (packetp->mTimeout < F32Seconds(0.f)) // negative timeout will always return timeout even for successful ack, for debugging
{
packetp->mCallback(packetp->mCallbackData,LL_ERR_TCP_TIMEOUT);
}
@@ -268,7 +268,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num)
-S32 LLCircuitData::resendUnackedPackets(const F64 now)
+S32 LLCircuitData::resendUnackedPackets(const F64Seconds now)
{
S32 resent_packets = 0;
LLReliablePacket *packetp;
@@ -320,8 +320,8 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
if (mUnackedPacketBytes > 256000 && !(getPacketsOut() % 1024))
{
// Warn if we've got a lot of resends waiting.
- llwarns << mHost << " has " << mUnackedPacketBytes
- << " bytes of reliable messages waiting" << llendl;
+ LL_WARNS() << mHost << " has " << mUnackedPacketBytes
+ << " bytes of reliable messages waiting" << LL_ENDL;
}
// Stop resending. There are less than 512000 unacked packets.
break;
@@ -341,7 +341,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
std::ostringstream str;
str << "MSG: -> " << packetp->mHost
<< "\tRESENDING RELIABLE:\t" << packetp->mPacketID;
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
packetp->mBuffer[0] |= LL_RESENT_FLAG; // tag packet id as being a resend
@@ -355,7 +355,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
// The new method, retry time based on ping
if (packetp->mPingBasedRetry)
{
- packetp->mExpirationTime = now + llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, (LL_RELIABLE_TIMEOUT_FACTOR * getPingDelayAveraged()));
+ packetp->mExpirationTime = now + llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, F32Seconds(LL_RELIABLE_TIMEOUT_FACTOR * getPingDelayAveraged()));
}
else
{
@@ -390,10 +390,10 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
if (now > packetp->mExpirationTime)
{
// fail (too many retries)
- //llinfos << "Packet " << packetp->mPacketID << " removed from the pending list: exceeded retry limit" << llendl;
+ //LL_INFOS() << "Packet " << packetp->mPacketID << " removed from the pending list: exceeded retry limit" << LL_ENDL;
//if (packetp->mMessageName)
//{
- // llinfos << "Packet name " << packetp->mMessageName << llendl;
+ // LL_INFOS() << "Packet name " << packetp->mMessageName << LL_ENDL;
//}
gMessageSystem->mFailedResendPackets++;
@@ -402,7 +402,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
std::ostringstream str;
str << "MSG: -> " << packetp->mHost << "\tABORTING RELIABLE:\t"
<< packetp->mPacketID;
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
if (packetp->mCallback)
@@ -427,10 +427,11 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
}
-LLCircuit::LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mLastCircuit(NULL),
- mHeartbeatInterval(circuit_heartbeat_interval), mHeartbeatTimeout(circuit_timeout)
-{
-}
+LLCircuit::LLCircuit(const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout)
+: mLastCircuit(NULL),
+ mHeartbeatInterval(circuit_heartbeat_interval),
+ mHeartbeatTimeout(circuit_timeout)
+{}
LLCircuit::~LLCircuit()
{
@@ -445,7 +446,7 @@ LLCircuit::~LLCircuit()
LLCircuitData *LLCircuit::addCircuitData(const LLHost &host, TPACKETID in_id)
{
// This should really validate if one already exists
- llinfos << "LLCircuit::addCircuitData for " << host << llendl;
+ LL_INFOS() << "LLCircuit::addCircuitData for " << host << LL_ENDL;
LLCircuitData *tempp = new LLCircuitData(host, in_id, mHeartbeatInterval, mHeartbeatTimeout);
mCircuitData.insert(circuit_data_map::value_type(host, tempp));
mPingSet.insert(tempp);
@@ -456,7 +457,7 @@ LLCircuitData *LLCircuit::addCircuitData(const LLHost &host, TPACKETID in_id)
void LLCircuit::removeCircuitData(const LLHost &host)
{
- llinfos << "LLCircuit::removeCircuitData for " << host << llendl;
+ LL_INFOS() << "LLCircuit::removeCircuitData for " << host << LL_ENDL;
mLastCircuit = NULL;
circuit_data_map::iterator it = mCircuitData.find(host);
if(it != mCircuitData.end())
@@ -471,7 +472,7 @@ void LLCircuit::removeCircuitData(const LLHost &host)
}
else
{
- llwarns << "Couldn't find entry for next ping in ping set!" << llendl;
+ LL_WARNS() << "Couldn't find entry for next ping in ping set!" << LL_ENDL;
}
// Clean up from optimization maps
@@ -521,17 +522,17 @@ void LLCircuitData::setAllowTimeout(BOOL allow)
// Reset per-period counters if necessary.
void LLCircuitData::checkPeriodTime()
{
- F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
- F64 period_length = mt_sec - mPeriodTime;
+ F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds period_length = mt_sec - mPeriodTime;
if ( period_length > TARGET_PERIOD_LENGTH)
{
- F32 bps_in = (F32)(mBytesInThisPeriod * 8.f / period_length);
+ F32 bps_in = F32Bits(mBytesInThisPeriod).value() / period_length.value();
if (bps_in > mPeakBPSIn)
{
mPeakBPSIn = bps_in;
}
- F32 bps_out = (F32)(mBytesOutThisPeriod * 8.f / period_length);
+ F32 bps_out = F32Bits(mBytesOutThisPeriod).value() / period_length.value();
if (bps_out > mPeakBPSOut)
{
mPeakBPSOut = bps_out;
@@ -539,23 +540,23 @@ void LLCircuitData::checkPeriodTime()
mBytesInLastPeriod = mBytesInThisPeriod;
mBytesOutLastPeriod = mBytesOutThisPeriod;
- mBytesInThisPeriod = 0;
- mBytesOutThisPeriod = 0;
- mLastPeriodLength = (F32)period_length;
+ mBytesInThisPeriod = S32Bytes(0);
+ mBytesOutThisPeriod = S32Bytes(0);
+ mLastPeriodLength = period_length;
mPeriodTime = mt_sec;
}
}
-void LLCircuitData::addBytesIn(S32 bytes)
+void LLCircuitData::addBytesIn(S32Bytes bytes)
{
mBytesIn += bytes;
mBytesInThisPeriod += bytes;
}
-void LLCircuitData::addBytesOut(S32 bytes)
+void LLCircuitData::addBytesOut(S32Bytes bytes)
{
mBytesOut += bytes;
mBytesOutThisPeriod += bytes;
@@ -584,7 +585,7 @@ void LLCircuitData::addReliablePacket(S32 mSocket, U8 *buf_ptr, S32 buf_len, LLR
void LLCircuit::resendUnackedPackets(S32& unacked_list_length, S32& unacked_list_size)
{
- F64 now = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds now = LLMessageSystem::getMessageTimeSeconds();
unacked_list_length = 0;
unacked_list_size = 0;
@@ -719,14 +720,14 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
{
std::ostringstream str;
str << "MSG: <- " << mHost << "\tRECOVERING LOST:\t" << id;
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
- // llinfos << "removing potential lost: " << id << llendl;
+ // LL_INFOS() << "removing potential lost: " << id << LL_ENDL;
mPotentialLostPackets.erase(id);
}
else if (!receive_resent) // don't freak out over out-of-order reliable resends
{
- U64 time = LLMessageSystem::getMessageTimeUsecs();
+ U64Microseconds time = LLMessageSystem::getMessageTimeUsecs();
TPACKETID index = mPacketsInID;
S32 gap_count = 0;
if ((index < id) && ((id - index) < 16))
@@ -738,10 +739,10 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
std::ostringstream str;
str << "MSG: <- " << mHost << "\tPACKET GAP:\t"
<< index;
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
-// llinfos << "adding potential lost: " << index << llendl;
+// LL_INFOS() << "adding potential lost: " << index << LL_ENDL;
mPotentialLostPackets[index] = time;
index++;
index = index % LL_MAX_OUT_PACKET_ID;
@@ -750,13 +751,13 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
}
else
{
- llinfos << "packet_out_of_order - got packet " << id << " expecting " << index << " from " << mHost << llendl;
+ LL_INFOS() << "packet_out_of_order - got packet " << id << " expecting " << index << " from " << mHost << LL_ENDL;
if(gMessageSystem->mVerboseLog)
{
std::ostringstream str;
str << "MSG: <- " << mHost << "\tPACKET GAP:\t"
<< id << " expected " << index;
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
}
@@ -765,11 +766,11 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
if (gap_count > 128)
{
- llwarns << "Packet loss gap filler running amok!" << llendl;
+ LL_WARNS() << "Packet loss gap filler running amok!" << LL_ENDL;
}
else if (gap_count > 16)
{
- llwarns << "Sustaining large amounts of packet loss!" << llendl;
+ LL_WARNS() << "Sustaining large amounts of packet loss!" << LL_ENDL;
}
}
@@ -780,7 +781,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
{
- F64 cur_time = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds();
S32 count = mPingSet.size();
S32 cur = 0;
@@ -818,7 +819,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
if (cdp->updateWatchDogTimers(msgsys))
{
// Randomize our pings a bit by doing some up to 5% early or late
- F64 dt = 0.95f*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval);
+ F64Seconds dt = 0.95f*mHeartbeatInterval + F32Seconds(ll_frand(0.1f*mHeartbeatInterval.value()));
// Remove it, and reinsert it with the new next ping time.
// Always remove before changing the sorting key.
@@ -846,7 +847,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
{
- F64 cur_time = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds();
mLastPingSendTime = cur_time;
if (!checkCircuitTimeout())
@@ -889,8 +890,8 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
wrapped_final = TRUE;
}
- //llinfos << mHost << " - unacked count " << mUnackedPackets.size() << llendl;
- //llinfos << mHost << " - final count " << mFinalRetryPackets.size() << llendl;
+ //LL_INFOS() << mHost << " - unacked count " << mUnackedPackets.size() << LL_ENDL;
+ //LL_INFOS() << mHost << " - final count " << mFinalRetryPackets.size() << LL_ENDL;
if (wrapped != wrapped_final)
{
// One of the "unacked" or "final" lists hasn't wrapped. Whichever one
@@ -900,12 +901,12 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
// Hasn't wrapped, so the one on the
// unacked packet list is older
packet_id = iter->first;
- //llinfos << mHost << ": nowrapped unacked" << llendl;
+ //LL_INFOS() << mHost << ": nowrapped unacked" << LL_ENDL;
}
else
{
packet_id = iter_final->first;
- //llinfos << mHost << ": nowrapped final" << llendl;
+ //LL_INFOS() << mHost << ": nowrapped final" << LL_ENDL;
}
}
else
@@ -917,7 +918,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
// Send the ID of the last packet we sent out.
// This will flush all of the destination's
// unacked packets, theoretically.
- //llinfos << mHost << ": No unacked!" << llendl;
+ //LL_INFOS() << mHost << ": No unacked!" << LL_ENDL;
packet_id = getPacketOutID();
}
else
@@ -928,7 +929,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
// Unacked list has the lowest so far
packet_id = iter->first;
had_unacked = TRUE;
- //llinfos << mHost << ": Unacked" << llendl;
+ //LL_INFOS() << mHost << ": Unacked" << LL_ENDL;
}
if (iter_final != mFinalRetryPackets.end())
@@ -938,13 +939,13 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
{
// Both had a packet, use the lowest.
packet_id = llmin(packet_id, iter_final->first);
- //llinfos << mHost << ": Min of unacked/final" << llendl;
+ //LL_INFOS() << mHost << ": Min of unacked/final" << LL_ENDL;
}
else
{
// Only the final had a packet, use it.
packet_id = iter_final->first;
- //llinfos << mHost << ": Final!" << llendl;
+ //LL_INFOS() << mHost << ": Final!" << LL_ENDL;
}
}
}
@@ -963,12 +964,12 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
// be considered lost
LLCircuitData::packet_time_map::iterator it;
- U64 timeout = (U64)(1000000.0*llmin(LL_MAX_LOST_TIMEOUT, getPingDelayAveraged() * LL_LOST_TIMEOUT_FACTOR));
+ U64Microseconds timeout = llmin(LL_MAX_LOST_TIMEOUT, F32Seconds(getPingDelayAveraged()) * LL_LOST_TIMEOUT_FACTOR);
- U64 mt_usec = LLMessageSystem::getMessageTimeUsecs();
+ U64Microseconds mt_usec = LLMessageSystem::getMessageTimeUsecs();
for (it = mPotentialLostPackets.begin(); it != mPotentialLostPackets.end(); )
{
- U64 delta_t_usec = mt_usec - (*it).second;
+ U64Microseconds delta_t_usec = mt_usec - (*it).second;
if (delta_t_usec > timeout)
{
// let's call this one a loss!
@@ -979,7 +980,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
std::ostringstream str;
str << "MSG: <- " << mHost << "\tLOST PACKET:\t"
<< (*it).first;
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
mPotentialLostPackets.erase(it++);
}
@@ -999,8 +1000,8 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id)
// we want to KEEP all x where oldest_id <= x <= last incoming packet, and delete everything else.
- //llinfos << mHost << ": clearing before oldest " << oldest_id << llendl;
- //llinfos << "Recent list before: " << mRecentlyReceivedReliablePackets.size() << llendl;
+ //LL_INFOS() << mHost << ": clearing before oldest " << oldest_id << LL_ENDL;
+ //LL_INFOS() << "Recent list before: " << mRecentlyReceivedReliablePackets.size() << LL_ENDL;
if (oldest_id < mHighestPacketID)
{
// Clean up everything with a packet ID less than oldest_id.
@@ -1014,7 +1015,7 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id)
// Do timeout checks on everything with an ID > mHighestPacketID.
// This should be empty except for wrapping IDs. Thus, this should be
// highly rare.
- U64 mt_usec = LLMessageSystem::getMessageTimeUsecs();
+ U64Microseconds mt_usec = LLMessageSystem::getMessageTimeUsecs();
packet_time_map::iterator pit;
for(pit = mRecentlyReceivedReliablePackets.upper_bound(mHighestPacketID);
@@ -1023,14 +1024,14 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id)
// Validate that the packet ID seems far enough away
if ((pit->first - mHighestPacketID) < 100)
{
- llwarns << "Probably incorrectly timing out non-wrapped packets!" << llendl;
+ LL_WARNS() << "Probably incorrectly timing out non-wrapped packets!" << LL_ENDL;
}
- U64 delta_t_usec = mt_usec - (*pit).second;
- F64 delta_t_sec = delta_t_usec * SEC_PER_USEC;
+ U64Microseconds delta_t_usec = mt_usec - (*pit).second;
+ F64Seconds delta_t_sec = delta_t_usec;
if (delta_t_sec > LL_DUPLICATE_SUPPRESSION_TIMEOUT)
{
// enough time has elapsed we're not likely to get a duplicate on this one
- llinfos << "Clearing " << pit->first << " from recent list" << llendl;
+ LL_INFOS() << "Clearing " << pit->first << " from recent list" << LL_ENDL;
mRecentlyReceivedReliablePackets.erase(pit++);
}
else
@@ -1038,27 +1039,27 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id)
++pit;
}
}
- //llinfos << "Recent list after: " << mRecentlyReceivedReliablePackets.size() << llendl;
+ //LL_INFOS() << "Recent list after: " << mRecentlyReceivedReliablePackets.size() << LL_ENDL;
}
BOOL LLCircuitData::checkCircuitTimeout()
{
- F64 time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime;
+ F64Seconds time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime;
// Nota Bene: This needs to be turned off if you are debugging multiple simulators
if (time_since_last_ping > mHeartbeatTimeout)
{
- llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<llendl;
+ LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<LL_ENDL;
setAlive(FALSE);
if (mTimeoutCallback)
{
- llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " calling callback." << llendl;
+ LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " calling callback." << LL_ENDL;
mTimeoutCallback(mHost, mTimeoutUserData);
}
if (!isAlive())
{
// The callback didn't try and resurrect the circuit. We should kill it.
- llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " still dead, dropping." << llendl;
+ LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " still dead, dropping." << LL_ENDL;
return FALSE;
}
}
@@ -1121,7 +1122,7 @@ void LLCircuit::sendAcks()
str << "MSG: -> " << cd->mHost << "\tPACKET ACKS:\t";
std::ostream_iterator<TPACKETID> append(str, " ");
std::copy(cd->mAcks.begin(), cd->mAcks.end(), append);
- llinfos << str.str() << llendl;
+ LL_INFOS() << str.str() << LL_ENDL;
}
// empty out the acks list
@@ -1139,40 +1140,40 @@ std::ostream& operator<<(std::ostream& s, LLCircuitData& circuit)
F32 age = circuit.mExistenceTimer.getElapsedTimeF32();
using namespace std;
- s << "Circuit " << circuit.mHost << " ";
- s << circuit.mRemoteID << " ";
- s << (circuit.mbAlive ? "Alive" : "Not Alive") << " ";
- s << (circuit.mbAllowTimeout ? "Timeout Allowed" : "Timeout Not Allowed");
- s << endl;
-
- s << " Packets Lost: " << circuit.mPacketsLost;
- s << " Measured Ping: " << circuit.mPingDelay;
- s << " Averaged Ping: " << circuit.mPingDelayAveraged;
- s << endl;
-
- s << "Global In/Out " << S32(age) << " sec";
- s << " KBytes: " << circuit.mBytesIn / 1024 << "/" << circuit.mBytesOut / 1024;
- s << " Kbps: ";
- s << S32(circuit.mBytesIn * 8.f / circuit.mExistenceTimer.getElapsedTimeF32() / 1024.f);
- s << "/";
- s << S32(circuit.mBytesOut * 8.f / circuit.mExistenceTimer.getElapsedTimeF32() / 1024.f);
- s << " Packets: " << circuit.mPacketsIn << "/" << circuit.mPacketsOut;
- s << endl;
-
- s << "Recent In/Out " << S32(circuit.mLastPeriodLength) << " sec";
- s << " KBytes: ";
- s << circuit.mBytesInLastPeriod / 1024;
- s << "/";
- s << circuit.mBytesOutLastPeriod / 1024;
- s << " Kbps: ";
- s << S32(circuit.mBytesInLastPeriod * 8.f / circuit.mLastPeriodLength / 1024.f);
- s << "/";
- s << S32(circuit.mBytesOutLastPeriod * 8.f / circuit.mLastPeriodLength / 1024.f);
- s << " Peak kbps: ";
- s << S32(circuit.mPeakBPSIn / 1024.f);
- s << "/";
- s << S32(circuit.mPeakBPSOut / 1024.f);
- s << endl;
+ s << "Circuit " << circuit.mHost << " "
+ << circuit.mRemoteID << " "
+ << (circuit.mbAlive ? "Alive" : "Not Alive") << " "
+ << (circuit.mbAllowTimeout ? "Timeout Allowed" : "Timeout Not Allowed")
+ << endl;
+
+ s << " Packets Lost: " << circuit.mPacketsLost
+ << " Measured Ping: " << circuit.mPingDelay
+ << " Averaged Ping: " << circuit.mPingDelayAveraged
+ << endl;
+
+ s << "Global In/Out " << S32(age) << " sec"
+ << " KBytes: " << circuit.mBytesIn.valueInUnits<LLUnits::Kilobytes>() << "/" << circuit.mBytesOut.valueInUnits<LLUnits::Kilobytes>()
+ << " Kbps: "
+ << S32(circuit.mBytesIn.valueInUnits<LLUnits::Kilobits>() / circuit.mExistenceTimer.getElapsedTimeF32().value())
+ << "/"
+ << S32(circuit.mBytesOut.valueInUnits<LLUnits::Kilobits>() / circuit.mExistenceTimer.getElapsedTimeF32().value())
+ << " Packets: " << circuit.mPacketsIn << "/" << circuit.mPacketsOut
+ << endl;
+
+ s << "Recent In/Out " << circuit.mLastPeriodLength
+ << " KBytes: "
+ << circuit.mBytesInLastPeriod.valueInUnits<LLUnits::Kilobytes>()
+ << "/"
+ << circuit.mBytesOutLastPeriod.valueInUnits<LLUnits::Kilobytes>()
+ << " Kbps: "
+ << (S32)(circuit.mBytesInLastPeriod.valueInUnits<LLUnits::Kilobits>() / circuit.mLastPeriodLength.value())
+ << "/"
+ << (S32)(circuit.mBytesOutLastPeriod.valueInUnits<LLUnits::Kilobits>() / circuit.mLastPeriodLength.value())
+ << " Peak kbps: "
+ << S32(circuit.mPeakBPSIn / 1024.f)
+ << "/"
+ << S32(circuit.mPeakBPSOut / 1024.f)
+ << endl;
return s;
}
@@ -1188,7 +1189,7 @@ void LLCircuitData::dumpResendCountAndReset()
{
if (mCurrentResendCount)
{
- llinfos << "Circuit: " << mHost << " resent " << mCurrentResendCount << " packets" << llendl;
+ LL_INFOS() << "Circuit: " << mHost << " resent " << mCurrentResendCount << " packets" << LL_ENDL;
mCurrentResendCount = 0;
}
}
@@ -1256,11 +1257,11 @@ void LLCircuitData::setPacketInID(TPACKETID id)
void LLCircuitData::pingTimerStop(const U8 ping_id)
{
- F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds();
// Nota Bene: no averaging of ping times until we get a feel for how this works
- F64 time = mt_secs - mPingTime;
- if (time == 0.0)
+ F64Seconds time = mt_secs - mPingTime;
+ if (time == F32Seconds(0.0))
{
// Ack, we got our ping response on the same frame! Sigh, let's get a real time otherwise
// all of our ping calculations will be skewed.
@@ -1276,7 +1277,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id)
delta_ping += 256;
}
- U32 msec = (U32) ((delta_ping*mHeartbeatInterval + time) * 1000.f);
+ U32Milliseconds msec = delta_ping*mHeartbeatInterval + time;
setPingDelay(msec);
mPingsInTransit = delta_ping;
@@ -1305,13 +1306,13 @@ U32 LLCircuitData::getPacketsIn() const
}
-S32 LLCircuitData::getBytesIn() const
+S32Bytes LLCircuitData::getBytesIn() const
{
return mBytesIn;
}
-S32 LLCircuitData::getBytesOut() const
+S32Bytes LLCircuitData::getBytesOut() const
{
return mBytesOut;
}
@@ -1353,41 +1354,41 @@ BOOL LLCircuitData::getAllowTimeout() const
}
-U32 LLCircuitData::getPingDelay() const
+U32Milliseconds LLCircuitData::getPingDelay() const
{
return mPingDelay;
}
-F32 LLCircuitData::getPingInTransitTime()
+F32Milliseconds LLCircuitData::getPingInTransitTime()
{
// This may be inaccurate in the case of a circuit that was "dead" and then revived,
// but only until the first round trip ping is sent - djs
- F32 time_since_ping_was_sent = 0;
+ F32Milliseconds time_since_ping_was_sent(0);
if (mPingsInTransit)
{
- time_since_ping_was_sent = (F32)((mPingsInTransit*mHeartbeatInterval - 1)
- + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f;
+ time_since_ping_was_sent = ((mPingsInTransit*mHeartbeatInterval - F32Seconds(1))
+ + (LLMessageSystem::getMessageTimeSeconds() - mPingTime));
}
return time_since_ping_was_sent;
}
-void LLCircuitData::setPingDelay(U32 ping)
+void LLCircuitData::setPingDelay(U32Milliseconds ping)
{
mPingDelay = ping;
- mPingDelayAveraged = llmax((F32)ping, getPingDelayAveraged());
+ mPingDelayAveraged = llmax((F32Milliseconds)ping, getPingDelayAveraged());
mPingDelayAveraged = ((1.f - LL_AVERAGED_PING_ALPHA) * mPingDelayAveraged)
- + (LL_AVERAGED_PING_ALPHA * (F32) ping);
+ + (LL_AVERAGED_PING_ALPHA * (F32Milliseconds) ping);
mPingDelayAveraged = llclamp(mPingDelayAveraged,
LL_AVERAGED_PING_MIN,
LL_AVERAGED_PING_MAX);
}
-F32 LLCircuitData::getPingDelayAveraged()
+F32Milliseconds LLCircuitData::getPingDelayAveraged()
{
return llmin(llmax(getPingInTransitTime(), mPingDelayAveraged), LL_AVERAGED_PING_MAX);
}
diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h
index 430d6358f7..5b109fc218 100755
--- a/indra/llmessage/llcircuit.h
+++ b/indra/llmessage/llcircuit.h
@@ -34,7 +34,6 @@
#include "llerror.h"
#include "lltimer.h"
-#include "timing.h"
#include "net.h"
#include "llhost.h"
#include "llpacketack.h"
@@ -45,12 +44,14 @@
// Constants
//
const F32 LL_AVERAGED_PING_ALPHA = 0.2f; // relaxation constant on ping running average
-const F32 LL_AVERAGED_PING_MAX = 2000; // msec
-const F32 LL_AVERAGED_PING_MIN = 100; // msec // IW: increased to avoid retransmits when a process is slow
+const F32Milliseconds LL_AVERAGED_PING_MAX(2000);
+const F32Milliseconds LL_AVERAGED_PING_MIN(100); // increased to avoid retransmits when a process is slow
-const U32 INITIAL_PING_VALUE_MSEC = 1000; // initial value for the ping delay, or for ping delay for an unknown circuit
+const U32Milliseconds INITIAL_PING_VALUE_MSEC(1000); // initial value for the ping delay, or for ping delay for an unknown circuit
const TPACKETID LL_MAX_OUT_PACKET_ID = 0x01000000;
+const int LL_ERR_CIRCUIT_GONE = -23017;
+const int LL_ERR_TCP_TIMEOUT = -23016;
// 0 - flags
// [1,4] - packetid
@@ -76,10 +77,10 @@ class LLCircuitData
{
public:
LLCircuitData(const LLHost &host, TPACKETID in_id,
- const F32 circuit_heartbeat_interval, const F32 circuit_timeout);
+ const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout);
~LLCircuitData();
- S32 resendUnackedPackets(const F64 now);
+ S32 resendUnackedPackets(const F64Seconds now);
void clearDuplicateList(TPACKETID oldest_id);
@@ -105,18 +106,18 @@ public:
// mLocalEndPointID should only ever be setup in the LLCircuitData constructor
const LLUUID& getLocalEndPointID() const { return mLocalEndPointID; }
- U32 getPingDelay() const;
+ U32Milliseconds getPingDelay() const;
S32 getPingsInTransit() const { return mPingsInTransit; }
// ACCESSORS
BOOL isAlive() const;
BOOL isBlocked() const;
BOOL getAllowTimeout() const;
- F32 getPingDelayAveraged();
- F32 getPingInTransitTime();
+ F32Milliseconds getPingDelayAveraged();
+ F32Milliseconds getPingInTransitTime();
U32 getPacketsIn() const;
- S32 getBytesIn() const;
- S32 getBytesOut() const;
+ S32Bytes getBytesIn() const;
+ S32Bytes getBytesOut() const;
U32 getPacketsOut() const;
U32 getPacketsLost() const;
TPACKETID getPacketOutID() const;
@@ -124,10 +125,10 @@ public:
F32 getAgeInSeconds() const;
S32 getUnackedPacketCount() const { return mUnackedPacketCount; }
S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; }
- F64 getNextPingSendTime() const { return mNextPingSendTime; }
+ F64Seconds getNextPingSendTime() const { return mNextPingSendTime; }
U32 getLastPacketGap() const { return mLastPacketGap; }
LLHost getHost() const { return mHost; }
- F64 getLastPacketInTime() const { return mLastPacketInTime; }
+ F64Seconds getLastPacketInTime() const { return mLastPacketInTime; }
LLThrottleGroup &getThrottleGroup() { return mThrottles; }
@@ -163,11 +164,11 @@ protected:
TPACKETID nextPacketOutID();
void setPacketInID(TPACKETID id);
void checkPacketInID(TPACKETID id, BOOL receive_resent);
- void setPingDelay(U32 ping);
+ void setPingDelay(U32Milliseconds ping);
BOOL checkCircuitTimeout(); // Return FALSE if the circuit is dead and should be cleaned up
- void addBytesIn(S32 bytes);
- void addBytesOut(S32 bytes);
+ void addBytesIn(S32Bytes bytes);
+ void addBytesOut(S32Bytes bytes);
U8 nextPingID() { mLastPingID++; return mLastPingID; }
@@ -218,20 +219,20 @@ protected:
BOOL mBlocked; // Blocked is true if the circuit is hosed, i.e. far behind on pings
// Not sure what the difference between this and mLastPingSendTime is
- F64 mPingTime; // Time at which a ping was sent.
+ F64Seconds mPingTime; // Time at which a ping was sent.
- F64 mLastPingSendTime; // Time we last sent a ping
- F64 mLastPingReceivedTime; // Time we last received a ping
- F64 mNextPingSendTime; // Time to try and send the next ping
- S32 mPingsInTransit; // Number of pings in transit
- U8 mLastPingID; // ID of the last ping that we sent out
+ F64Seconds mLastPingSendTime; // Time we last sent a ping
+ F64Seconds mLastPingReceivedTime; // Time we last received a ping
+ F64Seconds mNextPingSendTime; // Time to try and send the next ping
+ S32 mPingsInTransit; // Number of pings in transit
+ U8 mLastPingID; // ID of the last ping that we sent out
// Used for determining the resend time for reliable resends.
- U32 mPingDelay; // raw ping delay
- F32 mPingDelayAveraged; // averaged ping delay (fast attack/slow decay)
+ U32Milliseconds mPingDelay; // raw ping delay
+ F32Milliseconds mPingDelayAveraged; // averaged ping delay (fast attack/slow decay)
- typedef std::map<TPACKETID, U64> packet_time_map;
+ typedef std::map<TPACKETID, U64Microseconds> packet_time_map;
packet_time_map mPotentialLostPackets;
packet_time_map mRecentlyReceivedReliablePackets;
@@ -246,7 +247,7 @@ protected:
S32 mUnackedPacketCount;
S32 mUnackedPacketBytes;
- F64 mLastPacketInTime; // Time of last packet arrival
+ F64Seconds mLastPacketInTime; // Time of last packet arrival
LLUUID mLocalEndPointID;
@@ -258,24 +259,24 @@ protected:
U32 mPacketsOut;
U32 mPacketsIn;
S32 mPacketsLost;
- S32 mBytesIn;
- S32 mBytesOut;
-
- F32 mLastPeriodLength; // seconds
- S32 mBytesInLastPeriod;
- S32 mBytesOutLastPeriod;
- S32 mBytesInThisPeriod;
- S32 mBytesOutThisPeriod;
+ S32Bytes mBytesIn,
+ mBytesOut;
+
+ F32Seconds mLastPeriodLength;
+ S32Bytes mBytesInLastPeriod;
+ S32Bytes mBytesOutLastPeriod;
+ S32Bytes mBytesInThisPeriod;
+ S32Bytes mBytesOutThisPeriod;
F32 mPeakBPSIn; // bits per second, max of all period bps
F32 mPeakBPSOut; // bits per second, max of all period bps
- F64 mPeriodTime;
+ F64Seconds mPeriodTime;
LLTimer mExistenceTimer; // initialized when circuit created, used to track bandwidth numbers
S32 mCurrentResendCount; // Number of resent packets since last spam
U32 mLastPacketGap; // Gap in sequence number of last packet.
- const F32 mHeartbeatInterval;
- const F32 mHeartbeatTimeout;
+ const F32Seconds mHeartbeatInterval;
+ const F32Seconds mHeartbeatTimeout;
};
@@ -285,7 +286,7 @@ class LLCircuit
{
public:
// CREATORS
- LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout);
+ LLCircuit(const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout);
~LLCircuit();
// ACCESSORS
@@ -340,7 +341,7 @@ protected:
mutable LLCircuitData* mLastCircuit;
private:
- const F32 mHeartbeatInterval;
- const F32 mHeartbeatTimeout;
+ const F32Seconds mHeartbeatInterval;
+ const F32Seconds mHeartbeatTimeout;
};
#endif
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 9e68c68858..73df47b933 100755
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -49,6 +49,7 @@
#include "llproxy.h"
#include "llsdserialize.h"
#include "llstl.h"
+#include "llstring.h"
#include "llthread.h"
#include "lltimer.h"
@@ -100,7 +101,7 @@ void check_curl_code(CURLcode code)
{
// linux appears to throw a curl error once per session for a bad initialization
// at a pretty random time (when enabling cookies).
- llinfos << "curl error detected: " << curl_easy_strerror(code) << llendl;
+ LL_WARNS("curl") << "curl error detected: " << curl_easy_strerror(code) << LL_ENDL;
}
}
@@ -110,7 +111,7 @@ void check_curl_multi_code(CURLMcode code)
{
// linux appears to throw a curl error once per session for a bad initialization
// at a pretty random time (when enabling cookies).
- llinfos << "curl multi error detected: " << curl_multi_strerror(code) << llendl;
+ LL_WARNS("curl") << "curl multi error detected: " << curl_multi_strerror(code) << LL_ENDL;
}
}
@@ -135,6 +136,7 @@ std::string LLCurl::getVersionString()
//////////////////////////////////////////////////////////////////////////////
LLCurl::Responder::Responder()
+ : mHTTPMethod(HTTP_INVALID), mStatus(HTTP_INTERNAL_ERROR)
{
}
@@ -144,22 +146,30 @@ LLCurl::Responder::~Responder()
}
// virtual
-void LLCurl::Responder::errorWithContent(
- U32 status,
- const std::string& reason,
- const LLSD&)
+void LLCurl::Responder::httpFailure()
{
- error(status, reason);
+ LL_WARNS("curl") << dumpResponse() << LL_ENDL;
}
-// virtual
-void LLCurl::Responder::error(U32 status, const std::string& reason)
+std::string LLCurl::Responder::dumpResponse() const
{
- llinfos << mURL << " [" << status << "]: " << reason << llendl;
+ std::ostringstream s;
+ s << "[" << httpMethodAsVerb(mHTTPMethod) << ":" << mURL << "] "
+ << "[status:" << mStatus << "] "
+ << "[reason:" << mReason << "] ";
+
+ if (mResponseHeaders.has(HTTP_IN_HEADER_CONTENT_TYPE))
+ {
+ s << "[content-type:" << mResponseHeaders[HTTP_IN_HEADER_CONTENT_TYPE] << "] ";
+ }
+
+ s << "[content:" << mContent << "]";
+
+ return s.str();
}
// virtual
-void LLCurl::Responder::result(const LLSD& content)
+void LLCurl::Responder::httpSuccess()
{
}
@@ -168,44 +178,109 @@ void LLCurl::Responder::setURL(const std::string& url)
mURL = url;
}
+void LLCurl::Responder::successResult(const LLSD& content)
+{
+ setResult(HTTP_OK, "", content);
+ httpSuccess();
+}
+
+void LLCurl::Responder::failureResult(S32 status, const std::string& reason, const LLSD& content /* = LLSD() */)
+{
+ setResult(status, reason, content);
+ httpFailure();
+}
+
+void LLCurl::Responder::completeResult(S32 status, const std::string& reason, const LLSD& content /* = LLSD() */)
+{
+ setResult(status, reason, content);
+ httpCompleted();
+}
+
+void LLCurl::Responder::setResult(S32 status, const std::string& reason, const LLSD& content /* = LLSD() */)
+{
+ mStatus = status;
+ mReason = reason;
+ mContent = content;
+}
+
+void LLCurl::Responder::setHTTPMethod(EHTTPMethod method)
+{
+ mHTTPMethod = method;
+}
+
+void LLCurl::Responder::setResponseHeader(const std::string& header, const std::string& value)
+{
+ mResponseHeaders[header] = value;
+}
+
+const std::string& LLCurl::Responder::getResponseHeader(const std::string& header) const
+{
+ if (mResponseHeaders.has(header))
+ {
+ return mResponseHeaders[header].asStringRef();
+ }
+ static const std::string empty;
+ return empty;
+}
+
+bool LLCurl::Responder::hasResponseHeader(const std::string& header) const
+{
+ if (mResponseHeaders.has(header)) return true;
+ return false;
+}
+
// virtual
void LLCurl::Responder::completedRaw(
- U32 status,
- const std::string& reason,
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer)
{
- LLSD content;
LLBufferStream istr(channels, buffer.get());
- const bool emit_errors = false;
- if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(content, istr, emit_errors))
+ const bool emit_parse_errors = false;
+
+ std::string debug_body("(empty)");
+ bool parsed=true;
+ if (EOF == istr.peek())
+ {
+ parsed=false;
+ }
+ // Try to parse body as llsd, no matter what 'content-type' says.
+ else if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(mContent, istr, emit_parse_errors))
+ {
+ parsed=false;
+ char body[1025];
+ body[1024] = '\0';
+ istr.seekg(0, std::ios::beg);
+ istr.get(body,1024);
+ if (strlen(body) > 0)
+ {
+ mContent = body;
+ debug_body = body;
+ }
+ }
+
+ // Only emit a warning if we failed to parse when 'content-type' == 'application/llsd+xml'
+ if (!parsed && (HTTP_CONTENT_LLSD_XML == getResponseHeader(HTTP_IN_HEADER_CONTENT_TYPE)))
{
- llinfos << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << llendl;
- content["reason"] = reason;
+ LL_WARNS() << "Failed to deserialize . " << mURL << " [status:" << mStatus << "] "
+ << "(" << mReason << ") body: " << debug_body << LL_ENDL;
}
- completed(status, reason, content);
+ httpCompleted();
}
// virtual
-void LLCurl::Responder::completed(U32 status, const std::string& reason, const LLSD& content)
+void LLCurl::Responder::httpCompleted()
{
- if (isGoodStatus(status))
+ if (isGoodStatus())
{
- result(content);
+ httpSuccess();
}
else
{
- errorWithContent(status, reason, content);
+ httpFailure();
}
}
-//virtual
-void LLCurl::Responder::completedHeader(U32 status, const std::string& reason, const LLSD& content)
-{
-
-}
-
//////////////////////////////////////////////////////////////////////////////
std::set<CURL*> LLCurl::Easy::sFreeHandles;
@@ -248,7 +323,7 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle)
if (!handle)
{
return ; //handle allocation failed.
- //llerrs << "handle cannot be NULL!" << llendl;
+ //LL_ERRS() << "handle cannot be NULL!" << LL_ENDL;
}
LLMutexLock lock(sHandleMutexp) ;
@@ -270,8 +345,38 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle)
}
else
{
- llerrs << "Invalid handle." << llendl;
+ LL_ERRS() << "Invalid handle." << LL_ENDL;
+ }
+}
+
+//static
+void LLCurl::Easy::deleteAllActiveHandles()
+{
+ LLMutexLock lock(sHandleMutexp) ;
+ LL_CHECK_MEMORY
+ for (std::set<CURL*>::iterator activeHandle = sActiveHandles.begin(); activeHandle != sActiveHandles.end(); ++activeHandle)
+ {
+ CURL* curlHandle = *activeHandle;
+ LLCurl::deleteEasyHandle(curlHandle);
+ LL_CHECK_MEMORY
}
+
+ sFreeHandles.clear();
+}
+
+//static
+void LLCurl::Easy::deleteAllFreeHandles()
+{
+ LLMutexLock lock(sHandleMutexp) ;
+ LL_CHECK_MEMORY
+ for (std::set<CURL*>::iterator freeHandle = sFreeHandles.begin(); freeHandle != sFreeHandles.end(); ++freeHandle)
+ {
+ CURL* curlHandle = *freeHandle;
+ LLCurl::deleteEasyHandle(curlHandle);
+ LL_CHECK_MEMORY
+ }
+
+ sFreeHandles.clear();
}
LLCurl::Easy::Easy()
@@ -289,7 +394,8 @@ LLCurl::Easy* LLCurl::Easy::getEasy()
if (!easy->mCurlEasyHandle)
{
// this can happen if we have too many open files (fails in c-ares/ares_init.c)
- llwarns << "allocEasyHandle() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << llendl;
+ LL_WARNS("curl") << "allocEasyHandle() returned NULL! Easy handles: "
+ << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << LL_ENDL;
delete easy;
return NULL;
}
@@ -317,10 +423,14 @@ LLCurl::Easy::~Easy()
for_each(mStrings.begin(), mStrings.end(), DeletePointerArray());
LL_CHECK_MEMORY
if (mResponder && LLCurl::sNotQuitting) //aborted
- {
- std::string reason("Request timeout, aborted.") ;
- mResponder->completedRaw(408, //HTTP_REQUEST_TIME_OUT, timeout, abort
- reason, mChannels, mOutput);
+ {
+ // HTTP_REQUEST_TIME_OUT, timeout, abort
+ // *TODO: This looks like improper use of the 408 status code.
+ // See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.9
+ // This status code should be returned by the *server* when:
+ // "The client did not produce a request within the time that the server was prepared to wait."
+ mResponder->setResult(HTTP_REQUEST_TIME_OUT, "Request timeout, aborted.");
+ mResponder->completedRaw(mChannels, mOutput);
LL_CHECK_MEMORY
}
mResponder = NULL;
@@ -384,9 +494,9 @@ void LLCurl::Easy::getTransferInfo(LLCurl::TransferInfo* info)
check_curl_code(curl_easy_getinfo(mCurlEasyHandle, CURLINFO_SPEED_DOWNLOAD, &info->mSpeedDownload));
}
-U32 LLCurl::Easy::report(CURLcode code)
+S32 LLCurl::Easy::report(CURLcode code)
{
- U32 responseCode = 0;
+ S32 responseCode = 0;
std::string responseReason;
if (code == CURLE_OK)
@@ -396,14 +506,15 @@ U32 LLCurl::Easy::report(CURLcode code)
}
else
{
- responseCode = 499;
+ responseCode = HTTP_INTERNAL_ERROR;
responseReason = strerror(code) + " : " + mErrorBuffer;
setopt(CURLOPT_FRESH_CONNECT, TRUE);
}
if (mResponder)
{
- mResponder->completedRaw(responseCode, responseReason, mChannels, mOutput);
+ mResponder->setResult(responseCode, responseReason);
+ mResponder->completedRaw(mChannels, mOutput);
mResponder = NULL;
}
@@ -440,9 +551,31 @@ void LLCurl::Easy::setoptString(CURLoption option, const std::string& value)
check_curl_code(result);
}
+void LLCurl::Easy::slist_append(const std::string& header, const std::string& value)
+{
+ std::string pair(header);
+ if (value.empty())
+ {
+ pair += ":";
+ }
+ else
+ {
+ pair += ": ";
+ pair += value;
+ }
+ slist_append(pair.c_str());
+}
+
void LLCurl::Easy::slist_append(const char* str)
{
- mHeaders = curl_slist_append(mHeaders, str);
+ if (str)
+ {
+ mHeaders = curl_slist_append(mHeaders, str);
+ if (!mHeaders)
+ {
+ LL_WARNS() << "curl_slist_append() call returned NULL appending " << str << LL_ENDL;
+ }
+ }
}
size_t curlReadCallback(char* data, size_t size, size_t nmemb, void* user_data)
@@ -530,8 +663,9 @@ void LLCurl::Easy::prepRequest(const std::string& url,
if (!post)
{
- slist_append("Connection: keep-alive");
- slist_append("Keep-alive: 300");
+ // *TODO: Should this be set to 'Keep-Alive' ?
+ slist_append(HTTP_OUT_HEADER_CONNECTION, "keep-alive");
+ slist_append(HTTP_OUT_HEADER_KEEP_ALIVE, "300");
// Accept and other headers
for (std::vector<std::string>::const_iterator iter = headers.begin();
iter != headers.end(); ++iter)
@@ -555,7 +689,7 @@ LLCurl::Multi::Multi(F32 idle_time_out)
mCurlMultiHandle = LLCurl::newMultiHandle();
if (!mCurlMultiHandle)
{
- llwarns << "curl_multi_init() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << llendl;
+ LL_WARNS() << "curl_multi_init() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << LL_ENDL;
mCurlMultiHandle = LLCurl::newMultiHandle();
}
@@ -810,7 +944,7 @@ S32 LLCurl::Multi::process()
++processed;
if (msg->msg == CURLMSG_DONE)
{
- U32 response = 0;
+ S32 response = 0;
Easy* easy = NULL ;
{
@@ -829,9 +963,9 @@ S32 LLCurl::Multi::process()
}
else
{
- response = 499;
- //*TODO: change to llwarns
- llerrs << "cleaned up curl request completed!" << llendl;
+ response = HTTP_INTERNAL_ERROR;
+ //*TODO: change to LL_WARNS()
+ LL_ERRS() << "cleaned up curl request completed!" << LL_ENDL;
}
if (response >= 400)
{
@@ -876,7 +1010,7 @@ bool LLCurl::Multi::addEasy(Easy* easy)
check_curl_multi_code(mcode);
//if (mcode != CURLM_OK)
//{
- // llwarns << "Curl Error: " << curl_multi_strerror(mcode) << llendl;
+ // LL_WARNS() << "Curl Error: " << curl_multi_strerror(mcode) << LL_ENDL;
// return false;
//}
return true;
@@ -993,7 +1127,7 @@ void LLCurlThread::addMulti(LLCurl::Multi* multi)
if (!addRequest(req))
{
- llwarns << "curl request added when the thread is quitted" << llendl;
+ LL_WARNS() << "curl request added when the thread is quitted" << LL_ENDL;
}
}
@@ -1100,7 +1234,7 @@ bool LLCurlRequest::addEasy(LLCurl::Easy* easy)
if (mProcessing)
{
- llerrs << "Posting to a LLCurlRequest instance from within a responder is not allowed (causes DNS timeouts)." << llendl;
+ LL_ERRS() << "Posting to a LLCurlRequest instance from within a responder is not allowed (causes DNS timeouts)." << LL_ENDL;
}
bool res = mActiveMulti->addEasy(easy);
return res;
@@ -1128,13 +1262,13 @@ bool LLCurlRequest::getByteRange(const std::string& url,
easy->setopt(CURLOPT_HTTPGET, 1);
if (length > 0)
{
- std::string range = llformat("Range: bytes=%d-%d", offset,offset+length-1);
- easy->slist_append(range.c_str());
+ std::string range = llformat("bytes=%d-%d", offset,offset+length-1);
+ easy->slist_append(HTTP_OUT_HEADER_RANGE, range);
}
else if (offset > 0)
{
- std::string range = llformat("Range: bytes=%d-", offset);
- easy->slist_append(range.c_str());
+ std::string range = llformat("bytes=%d-", offset);
+ easy->slist_append(HTTP_OUT_HEADER_RANGE, range);
}
easy->setHeaders();
bool res = addEasy(easy);
@@ -1161,10 +1295,10 @@ bool LLCurlRequest::post(const std::string& url,
easy->setopt(CURLOPT_POSTFIELDS, (void*)NULL);
easy->setopt(CURLOPT_POSTFIELDSIZE, bytes);
- easy->slist_append("Content-Type: application/llsd+xml");
+ easy->slist_append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML);
easy->setHeaders();
- lldebugs << "POSTING: " << bytes << " bytes." << llendl;
+ LL_DEBUGS() << "POSTING: " << bytes << " bytes." << LL_ENDL;
bool res = addEasy(easy);
return res;
}
@@ -1189,10 +1323,10 @@ bool LLCurlRequest::post(const std::string& url,
easy->setopt(CURLOPT_POSTFIELDS, (void*)NULL);
easy->setopt(CURLOPT_POSTFIELDSIZE, bytes);
- easy->slist_append("Content-Type: application/octet-stream");
+ easy->slist_append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_OCTET_STREAM);
easy->setHeaders();
- lldebugs << "POSTING: " << bytes << " bytes." << llendl;
+ LL_DEBUGS() << "POSTING: " << bytes << " bytes." << LL_ENDL;
bool res = addEasy(easy);
return res;
}
@@ -1561,6 +1695,14 @@ void LLCurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void*
}
}
+void LLCurlEasyRequest::slist_append(const std::string& header, const std::string& value)
+{
+ if (isValid() && mEasy)
+ {
+ mEasy->slist_append(header, value);
+ }
+}
+
void LLCurlEasyRequest::slist_append(const char* str)
{
if (isValid() && mEasy)
@@ -1573,7 +1715,7 @@ void LLCurlEasyRequest::sendRequest(const std::string& url)
{
llassert_always(!mRequestSent);
mRequestSent = true;
- lldebugs << url << llendl;
+ LL_DEBUGS() << url << LL_ENDL;
if (isValid() && mEasy)
{
mEasy->setHeaders();
@@ -1745,17 +1887,14 @@ void LLCurl::cleanupClass()
#endif
LL_CHECK_MEMORY
-
- for (std::set<CURL*>::iterator iter = Easy::sFreeHandles.begin(); iter != Easy::sFreeHandles.end(); ++iter)
- {
- CURL* curl = *iter;
- LLCurl::deleteEasyHandle(curl);
- }
-
+ Easy::deleteAllFreeHandles();
+ LL_CHECK_MEMORY
+ Easy::deleteAllActiveHandles();
LL_CHECK_MEMORY
- Easy::sFreeHandles.clear();
-
+ // Free the template easy handle
+ curl_easy_cleanup(sCurlTemplateStandardHandle);
+ sCurlTemplateStandardHandle = NULL;
LL_CHECK_MEMORY
delete Easy::sHandleMutexp ;
@@ -1781,7 +1920,7 @@ CURLM* LLCurl::newMultiHandle()
if(sTotalHandles + 1 > sMaxHandles)
{
- llwarns << "no more handles available." << llendl ;
+ LL_WARNS() << "no more handles available." << LL_ENDL ;
return NULL ; //failed
}
sTotalHandles++;
@@ -1789,7 +1928,7 @@ CURLM* LLCurl::newMultiHandle()
CURLM* ret = curl_multi_init() ;
if(!ret)
{
- llwarns << "curl_multi_init failed." << llendl ;
+ LL_WARNS() << "curl_multi_init failed." << LL_ENDL ;
}
return ret ;
@@ -1815,7 +1954,7 @@ CURL* LLCurl::newEasyHandle()
if(sTotalHandles + 1 > sMaxHandles)
{
- llwarns << "no more handles available." << llendl ;
+ LL_WARNS() << "no more handles available." << LL_ENDL ;
return NULL ; //failed
}
sTotalHandles++;
@@ -1823,7 +1962,7 @@ CURL* LLCurl::newEasyHandle()
CURL* ret = createStandardCurlHandle();
if(!ret)
{
- llwarns << "failed to create curl handle." << llendl ;
+ LL_WARNS() << "failed to create curl handle." << LL_ENDL ;
}
return ret ;
@@ -1863,7 +2002,7 @@ CURL* LLCurl::createStandardCurlHandle()
sCurlTemplateStandardHandle = curl_easy_init();
if (sCurlTemplateStandardHandle == NULL)
{
- llwarns << "curl error calling curl_easy_init()" << llendl;
+ LL_WARNS() << "curl error calling curl_easy_init()" << LL_ENDL;
}
else
{
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index 90b3f2815d..385d9fffa8 100755
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -39,9 +39,9 @@
#include <curl/curl.h> // TODO: remove dependency
#include "llbuffer.h"
+#include "llhttpconstants.h"
#include "lliopipe.h"
#include "llsd.h"
-#include "llthread.h"
#include "llqueuedthread.h"
#include "llframetimer.h"
#include "llpointer.h"
@@ -77,59 +77,92 @@ public:
Responder();
virtual ~Responder();
- /**
- * @brief return true if the status code indicates success.
- */
- static bool isGoodStatus(U32 status)
+ virtual bool followRedir()
{
- return((200 <= status) && (status < 300));
+ return false;
}
-
- virtual void errorWithContent(
- U32 status,
- const std::string& reason,
- const LLSD& content);
- //< called by completed() on bad status
-
- virtual void error(U32 status, const std::string& reason);
- //< called by default error(status, reason, content)
-
- virtual void result(const LLSD& content);
- //< called by completed for good status codes.
+ /**
+ * @brief return true if the status code indicates success.
+ */
+ bool isGoodStatus() const { return isHttpGoodStatus(mStatus); }
+
+ S32 getStatus() const { return mStatus; }
+ const std::string& getReason() const { return mReason; }
+ const LLSD& getContent() const { return mContent; }
+ bool hasResponseHeader(const std::string& header) const;
+ const std::string& getResponseHeader(const std::string& header) const;
+ const LLSD& getResponseHeaders() const { return mResponseHeaders; }
+ const std::string& getURL() const { return mURL; }
+ EHTTPMethod getHTTPMethod() const { return mHTTPMethod; }
+
+ // This formats response information for use in log spam. Includes content spam.
+ std::string dumpResponse() const;
+
+ // Allows direct triggering of success/error with different results.
+ void completeResult(S32 status, const std::string& reason, const LLSD& content = LLSD());
+ void successResult(const LLSD& content);
+ void failureResult(S32 status, const std::string& reason, const LLSD& content = LLSD());
+
+ // The default implementation will try to parse body content as an LLSD, however
+ // it should not spam about parsing failures unless the server sent a
+ // Content-Type: application/llsd+xml header.
virtual void completedRaw(
- U32 status,
- const std::string& reason,
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer);
/**< Override point for clients that may want to use this
class when the response is some other format besides LLSD
*/
+
+
+ // The http* methods are not public since these should be triggered internally
+ // after status, reason, content, etc have been set.
+ // If you need to trigger a completion method, use the *Result methods, above.
+ protected:
+ // These methods are the preferred way to process final results.
+ // By default, when one of these is called the following information will be resolved:
+ // * HTTP status code - getStatus()
+ // * Reason string - getReason()
+ // * Content - getContent()
+ // * Response Headers - getResponseHeaders()
+
+ // By default, httpSuccess is triggered whenever httpCompleted is called with a 2xx status code.
+ virtual void httpSuccess();
+ //< called by completed for good status codes.
+
+ // By default, httpFailure is triggered whenever httpCompleted is called with a non-2xx status code.
+ virtual void httpFailure();
+ //< called by httpCompleted() on bad status
- virtual void completed(
- U32 status,
- const std::string& reason,
- const LLSD& content);
- /**< The default implemetnation calls
+ // httpCompleted does not generally need to be overridden, unless
+ // you don't care about the status code (which determine httpFailure or httpSuccess)
+ // or if you want to re-interpret what a 'good' vs' bad' status code is.
+ virtual void httpCompleted();
+ /**< The default implementation calls
either:
- * result(), or
- * error()
+ * httpSuccess(), or
+ * httpFailure()
*/
-
- // Override to handle parsing of the header only. Note: this is the only place where the contents
- // of the header can be parsed. In the ::completed call above only the body is contained in the LLSD.
- virtual void completedHeader(U32 status, const std::string& reason, const LLSD& content);
-
- // Used internally to set the url for debugging later.
- void setURL(const std::string& url);
- virtual bool followRedir()
- {
- return false;
- }
+ public:
+ void setHTTPMethod(EHTTPMethod method);
+ void setURL(const std::string& url);
+ void setResult(S32 status, const std::string& reason, const LLSD& content = LLSD());
+ void setResponseHeader(const std::string& header, const std::string& value);
private:
+ // These can be accessed by the get* methods. Treated as 'read-only' during completion handlers.
+ EHTTPMethod mHTTPMethod;
std::string mURL;
+ LLSD mResponseHeaders;
+
+ protected:
+ // These should also generally be treated as 'read-only' during completion handlers
+ // and should be accessed by the get* methods. The exception to this rule would
+ // be when overriding the completedRaw method in preparation for calling httpCompleted().
+ S32 mStatus;
+ std::string mReason;
+ LLSD mContent;
};
typedef LLPointer<Responder> ResponderPtr;
@@ -228,10 +261,11 @@ public:
// Copies the string so that it is guaranteed to stick around
void setoptString(CURLoption option, const std::string& value);
+ void slist_append(const std::string& header, const std::string& value);
void slist_append(const char* str);
void setHeaders();
- U32 report(CURLcode);
+ S32 report(CURLcode);
void getTransferInfo(LLCurl::TransferInfo* info);
void prepRequest(const std::string& url, const std::vector<std::string>& headers, LLCurl::ResponderPtr, S32 time_out = 0, bool post = false);
@@ -270,6 +304,9 @@ private:
static std::set<CURL*> sFreeHandles;
static std::set<CURL*> sActiveHandles;
static LLMutex* sHandleMutexp ;
+
+ static void deleteAllActiveHandles();
+ static void deleteAllFreeHandles();
};
class LLCurl::Multi
@@ -487,6 +524,7 @@ public:
void setWriteCallback(curl_write_callback callback, void* userdata);
void setReadCallback(curl_read_callback callback, void* userdata);
void setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata);
+ void slist_append(const std::string& header, const std::string& value);
void slist_append(const char* str);
void sendRequest(const std::string& url);
void requestComplete();
diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp
index 3385d7c2e2..3510f93805 100755
--- a/indra/llmessage/lldatapacker.cpp
+++ b/indra/llmessage/lldatapacker.cpp
@@ -52,13 +52,13 @@ LLDataPacker::LLDataPacker() : mPassFlags(0), mWriteEnabled(FALSE)
//virtual
void LLDataPacker::reset()
{
- llerrs << "Using unimplemented datapacker reset!" << llendl;
+ LL_ERRS() << "Using unimplemented datapacker reset!" << LL_ENDL;
}
//virtual
void LLDataPacker::dumpBufferToLog()
{
- llerrs << "dumpBufferToLog not implemented for this type!" << llendl;
+ LL_ERRS() << "dumpBufferToLog not implemented for this type!" << LL_ENDL;
}
BOOL LLDataPacker::packFixed(const F32 value, const char *name,
@@ -108,7 +108,7 @@ BOOL LLDataPacker::packFixed(const F32 value, const char *name,
}
else
{
- llerrs << "Using fixed-point packing of " << total_bits << " bits, why?!" << llendl;
+ LL_ERRS() << "Using fixed-point packing of " << total_bits << " bits, why?!" << LL_ENDL;
}
return success;
}
@@ -117,7 +117,7 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,
const BOOL is_signed, const U32 int_bits, const U32 frac_bits)
{
//BOOL success = TRUE;
- //llinfos << "unpackFixed:" << name << " int:" << int_bits << " frac:" << frac_bits << llendl;
+ //LL_INFOS() << "unpackFixed:" << name << " int:" << int_bits << " frac:" << frac_bits << LL_ENDL;
BOOL ok = FALSE;
S32 unsigned_bits = int_bits + frac_bits;
S32 total_bits = unsigned_bits;
@@ -158,10 +158,10 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,
else
{
fixed_val = 0;
- llerrs << "Bad bit count: " << total_bits << llendl;
+ LL_ERRS() << "Bad bit count: " << total_bits << LL_ENDL;
}
- //llinfos << "Fixed_val:" << fixed_val << llendl;
+ //LL_INFOS() << "Fixed_val:" << fixed_val << LL_ENDL;
fixed_val /= (F32)(1 << frac_bits);
if (is_signed)
@@ -169,7 +169,7 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,
fixed_val -= max_val;
}
value = fixed_val;
- //llinfos << "Value: " << value << llendl;
+ //LL_INFOS() << "Value: " << value << LL_ENDL;
return ok;
}
@@ -239,7 +239,7 @@ BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char
}
else
{
- llwarns << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << llendl;
+ LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL;
success = FALSE;
}
return success;
@@ -550,7 +550,7 @@ const LLDataPackerBinaryBuffer& LLDataPackerBinaryBuffer::operator=(const LLData
if (a.getBufferSize() > getBufferSize())
{
// We've got problems, ack!
- llerrs << "Trying to do an assignment with not enough room in the target." << llendl;
+ LL_ERRS() << "Trying to do an assignment with not enough room in the target." << LL_ENDL;
}
memcpy(mBufferp, a.mBufferp, a.getBufferSize()); /*Flawfinder: ignore*/
return *this;
@@ -558,7 +558,7 @@ const LLDataPackerBinaryBuffer& LLDataPackerBinaryBuffer::operator=(const LLData
void LLDataPackerBinaryBuffer::dumpBufferToLog()
{
- llwarns << "Binary Buffer Dump, size: " << mBufferSize << llendl;
+ LL_WARNS() << "Binary Buffer Dump, size: " << mBufferSize << LL_ENDL;
char line_buffer[256]; /*Flawfinder: ignore*/
S32 i;
S32 cur_line_pos = 0;
@@ -571,13 +571,13 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog()
if (cur_line_pos >= 16)
{
cur_line_pos = 0;
- llwarns << "Offset:" << std::hex << cur_line*16 << std::dec << " Data:" << line_buffer << llendl;
+ LL_WARNS() << "Offset:" << std::hex << cur_line*16 << std::dec << " Data:" << line_buffer << LL_ENDL;
cur_line++;
}
}
if (cur_line_pos)
{
- llwarns << "Offset:" << std::hex << cur_line*16 << std::dec << " Data:" << line_buffer << llendl;
+ LL_WARNS() << "Offset:" << std::hex << cur_line*16 << std::dec << " Data:" << line_buffer << LL_ENDL;
}
}
@@ -608,7 +608,7 @@ BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n
{
// *NOTE: I believe we need to mark a failure bit at this point.
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packString: string truncated: " << value << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packString: string truncated: " << value << LL_ENDL;
}
mCurBufferp += numCopied;
return success;
@@ -647,7 +647,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packBinaryData: number truncated: " << size << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryData: number truncated: " << size << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -660,7 +660,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packBinaryData: data truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryData: data truncated: " << LL_ENDL;
bBufferFull = TRUE;
}
mCurBufferp += numCopied;
@@ -672,7 +672,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packBinaryData: newline truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryData: newline truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
}
@@ -734,7 +734,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packBinaryDataFixed: data truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryDataFixed: data truncated: " << LL_ENDL;
bBufferFull = TRUE;
}
mCurBufferp += numCopied;
@@ -746,7 +746,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packBinaryDataFixed: newline truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryDataFixed: newline truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -813,7 +813,7 @@ BOOL LLDataPackerAsciiBuffer::packU8(const U8 value, const char *name)
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packU8: val truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packU8: val truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -860,7 +860,7 @@ BOOL LLDataPackerAsciiBuffer::packU16(const U16 value, const char *name)
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packU16: val truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packU16: val truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -907,7 +907,7 @@ BOOL LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name)
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packU32: val truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packU32: val truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -951,7 +951,7 @@ BOOL LLDataPackerAsciiBuffer::packS32(const S32 value, const char *name)
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packS32: val truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packS32: val truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -995,7 +995,7 @@ BOOL LLDataPackerAsciiBuffer::packF32(const F32 value, const char *name)
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packF32: val truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packF32: val truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -1039,7 +1039,7 @@ BOOL LLDataPackerAsciiBuffer::packColor4(const LLColor4 &value, const char *name
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packColor4: truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packColor4: truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -1082,7 +1082,7 @@ BOOL LLDataPackerAsciiBuffer::packColor4U(const LLColor4U &value, const char *na
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packColor4U: truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packColor4U: truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -1132,7 +1132,7 @@ BOOL LLDataPackerAsciiBuffer::packVector2(const LLVector2 &value, const char *na
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packVector2: truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packVector2: truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -1176,7 +1176,7 @@ BOOL LLDataPackerAsciiBuffer::packVector3(const LLVector3 &value, const char *na
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packVector3: truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packVector3: truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -1219,7 +1219,7 @@ BOOL LLDataPackerAsciiBuffer::packVector4(const LLVector4 &value, const char *na
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packVector4: truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packVector4: truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -1266,7 +1266,7 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name)
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::packUUID: truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::packUUID: truncated: " << LL_ENDL;
success = FALSE;
}
mCurBufferp += numCopied;
@@ -1292,7 +1292,7 @@ BOOL LLDataPackerAsciiBuffer::unpackUUID(LLUUID &value, const char *name)
void LLDataPackerAsciiBuffer::dump()
{
- llinfos << "Buffer: " << mBufferp << llendl;
+ LL_INFOS() << "Buffer: " << mBufferp << LL_ENDL;
}
void LLDataPackerAsciiBuffer::writeIndentedName(const char *name)
@@ -1318,7 +1318,7 @@ void LLDataPackerAsciiBuffer::writeIndentedName(const char *name)
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
- llwarns << "LLDataPackerAsciiBuffer::writeIndentedName: truncated: " << llendl;
+ LL_WARNS() << "LLDataPackerAsciiBuffer::writeIndentedName: truncated: " << LL_ENDL;
}
mCurBufferp += numCopied;
@@ -1347,7 +1347,7 @@ BOOL LLDataPackerAsciiBuffer::getValueStr(const char *name, char *out_value, S32
if (strcmp(keyword, name))
{
- llwarns << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << llendl;
+ LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL;
return FALSE;
}
}
@@ -1904,7 +1904,7 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v
fpos_t last_pos;
if (0 != fgetpos(mFP, &last_pos)) // 0==success for fgetpos
{
- llwarns << "Data packer failed to fgetpos" << llendl;
+ LL_WARNS() << "Data packer failed to fgetpos" << LL_ENDL;
return FALSE;
}
@@ -1917,13 +1917,13 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v
if (!keyword[0])
{
- llwarns << "Data packer could not get the keyword!" << llendl;
+ LL_WARNS() << "Data packer could not get the keyword!" << LL_ENDL;
fsetpos(mFP, &last_pos);
return FALSE;
}
if (strcmp(keyword, name))
{
- llwarns << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << llendl;
+ LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL;
fsetpos(mFP, &last_pos);
return FALSE;
}
@@ -1941,12 +1941,12 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v
sscanf(buffer, "%511s %511[^\n]", keyword, value); /* Flawfinder: ignore */
if (!keyword[0])
{
- llwarns << "Data packer could not get the keyword!" << llendl;
+ LL_WARNS() << "Data packer could not get the keyword!" << LL_ENDL;
return FALSE;
}
if (strcmp(keyword, name))
{
- llwarns << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << llendl;
+ LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL;
return FALSE;
}
diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h
index b0a638c16e..5140f56c01 100755
--- a/indra/llmessage/lldatapacker.h
+++ b/indra/llmessage/lldatapacker.h
@@ -170,6 +170,7 @@ public:
S32 getBufferSize() const { return mBufferSize; }
const U8* getBuffer() const { return mBufferp; }
void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); }
+ void shift(S32 offset) { reset(); mCurBufferp += offset;}
void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = FALSE; }
void assignBuffer(U8 *bufferp, S32 size)
{
@@ -199,8 +200,8 @@ inline BOOL LLDataPackerBinaryBuffer::verifyLength(const S32 data_size, const ch
{
if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size)
{
- llwarns << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << llendl;
- llwarns << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << llendl;
+ LL_WARNS() << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << LL_ENDL;
+ LL_WARNS() << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << LL_ENDL;
return FALSE;
}
@@ -320,8 +321,8 @@ inline BOOL LLDataPackerAsciiBuffer::verifyLength(const S32 data_size, const cha
{
if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size)
{
- llwarns << "Buffer overflow in AsciiBuffer length verify, field name " << name << "!" << llendl;
- llwarns << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << llendl;
+ LL_WARNS() << "Buffer overflow in AsciiBuffer length verify, field name " << name << "!" << LL_ENDL;
+ LL_WARNS() << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << LL_ENDL;
return FALSE;
}
diff --git a/indra/llmessage/lldispatcher.cpp b/indra/llmessage/lldispatcher.cpp
index b2dc414a68..c40fe0d389 100755
--- a/indra/llmessage/lldispatcher.cpp
+++ b/indra/llmessage/lldispatcher.cpp
@@ -29,6 +29,7 @@
#include "lldispatcher.h"
#include <algorithm>
+#include <iterator>
#include "llstl.h"
#include "message.h"
@@ -75,7 +76,7 @@ bool LLDispatcher::dispatch(
LLDispatchHandler* func = (*it).second;
return (*func)(this, name, invoice, strings);
}
- llwarns << "Unable to find handler for Generic message: " << name << llendl;
+ LL_WARNS() << "Unable to find handler for Generic message: " << name << LL_ENDL;
return false;
}
diff --git a/indra/llmessage/llextendedstatus.h b/indra/llmessage/llextendedstatus.h
new file mode 100755
index 0000000000..8ce173d1ff
--- /dev/null
+++ b/indra/llmessage/llextendedstatus.h
@@ -0,0 +1,67 @@
+/**
+ * @file llextendedstatus.h
+ * @date August 2007
+ * @brief extended status codes for curl/vfs/resident asset storage and delivery
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLEXTENDEDSTATUS_H
+#define LL_LLEXTENDEDSTATUS_H
+
+
+typedef S32 LLExtStat;
+
+
+// Status provider groups - Top bits indicate which status type it is
+// Zero is common status code (next section)
+const LLExtStat LL_EXSTAT_CURL_RESULT = 1L<<30; // serviced by curl - use 1L if we really implement the below
+const LLExtStat LL_EXSTAT_RES_RESULT = 2L<<30; // serviced by resident copy
+const LLExtStat LL_EXSTAT_VFS_RESULT = 3L<<30; // serviced by vfs
+
+
+// Common Status Codes
+//
+const LLExtStat LL_EXSTAT_NONE = 0x00000; // No extra info here - sorry!
+const LLExtStat LL_EXSTAT_NULL_UUID = 0x10001; // null asset ID
+const LLExtStat LL_EXSTAT_NO_UPSTREAM = 0x10002; // attempt to upload without a valid upstream method/provider
+const LLExtStat LL_EXSTAT_REQUEST_DROPPED = 0x10003; // request was dropped unserviced
+const LLExtStat LL_EXSTAT_NONEXISTENT_FILE = 0x10004; // trying to upload a file that doesn't exist
+const LLExtStat LL_EXSTAT_BLOCKED_FILE = 0x10005; // trying to upload a file that we can't open
+
+
+// curl status codes:
+//
+// Mask off LL_EXSTAT_CURL_RESULT for original result and
+// see: libraries/include/curl/curl.h
+
+
+// Memory-Resident status codes:
+// None at present
+
+
+// VFS status codes:
+const LLExtStat LL_EXSTAT_VFS_CACHED = LL_EXSTAT_VFS_RESULT | 0x0001;
+const LLExtStat LL_EXSTAT_VFS_CORRUPT = LL_EXSTAT_VFS_RESULT | 0x0002;
+
+
+#endif // LL_LLEXTENDEDSTATUS_H
diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp
index e0ca056a5f..d3e195789b 100755
--- a/indra/llmessage/llfiltersd2xmlrpc.cpp
+++ b/indra/llmessage/llfiltersd2xmlrpc.cpp
@@ -80,6 +80,7 @@
#include "llbuffer.h"
#include "llbufferstream.h"
+#include "llfasttimer.h"
#include "llmemorystream.h"
#include "llsd.h"
#include "llsdserialize.h"
@@ -163,12 +164,12 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
case LLSD::TypeMap:
{
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(map) BEGIN" << llendl;
+ LL_INFOS() << "streamOut(map) BEGIN" << LL_ENDL;
#endif
ostr << "<struct>";
if(ostr.fail())
{
- llinfos << "STREAM FAILURE writing struct" << llendl;
+ LL_INFOS() << "STREAM FAILURE writing struct" << LL_ENDL;
}
LLSD::map_const_iterator it = sd.beginMap();
LLSD::map_const_iterator end = sd.endMap();
@@ -179,21 +180,21 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
streamOut(ostr, (*it).second);
if(ostr.fail())
{
- llinfos << "STREAM FAILURE writing '" << (*it).first
- << "' with sd type " << (*it).second.type() << llendl;
+ LL_INFOS() << "STREAM FAILURE writing '" << (*it).first
+ << "' with sd type " << (*it).second.type() << LL_ENDL;
}
ostr << "</member>";
}
ostr << "</struct>";
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(map) END" << llendl;
+ LL_INFOS() << "streamOut(map) END" << LL_ENDL;
#endif
break;
}
case LLSD::TypeArray:
{
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(array) BEGIN" << llendl;
+ LL_INFOS() << "streamOut(array) BEGIN" << LL_ENDL;
#endif
ostr << "<array><data>";
LLSD::array_const_iterator it = sd.beginArray();
@@ -203,12 +204,12 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
streamOut(ostr, *it);
if(ostr.fail())
{
- llinfos << "STREAM FAILURE writing array element sd type "
- << (*it).type() << llendl;
+ LL_INFOS() << "STREAM FAILURE writing array element sd type "
+ << (*it).type() << LL_ENDL;
}
}
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(array) END" << llendl;
+ LL_INFOS() << "streamOut(array) END" << LL_ENDL;
#endif
ostr << "</data></array>";
break;
@@ -217,31 +218,31 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
// treat undefined as a bool with a false value.
case LLSD::TypeBoolean:
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(bool)" << llendl;
+ LL_INFOS() << "streamOut(bool)" << LL_ENDL;
#endif
ostr << "<boolean>" << (sd.asBoolean() ? "1" : "0") << "</boolean>";
break;
case LLSD::TypeInteger:
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(int)" << llendl;
+ LL_INFOS() << "streamOut(int)" << LL_ENDL;
#endif
ostr << "<i4>" << sd.asInteger() << "</i4>";
break;
case LLSD::TypeReal:
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(real)" << llendl;
+ LL_INFOS() << "streamOut(real)" << LL_ENDL;
#endif
ostr << "<double>" << sd.asReal() << "</double>";
break;
case LLSD::TypeString:
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(string)" << llendl;
+ LL_INFOS() << "streamOut(string)" << LL_ENDL;
#endif
ostr << "<string>" << xml_escape_string(sd.asString()) << "</string>";
break;
case LLSD::TypeUUID:
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(uuid)" << llendl;
+ LL_INFOS() << "streamOut(uuid)" << LL_ENDL;
#endif
// serialize it as a string
ostr << "<string>" << sd.asString() << "</string>";
@@ -249,7 +250,7 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
case LLSD::TypeURI:
{
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(uri)" << llendl;
+ LL_INFOS() << "streamOut(uri)" << LL_ENDL;
#endif
// serialize it as a string
ostr << "<string>" << xml_escape_string(sd.asString()) << "</string>";
@@ -258,7 +259,7 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
case LLSD::TypeBinary:
{
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(binary)" << llendl;
+ LL_INFOS() << "streamOut(binary)" << LL_ENDL;
#endif
// this is pretty inefficient, but we'll deal with that
// problem when it becomes one.
@@ -281,15 +282,15 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
}
case LLSD::TypeDate:
#if LL_SPEW_STREAM_OUT_DEBUGGING
- llinfos << "streamOut(date)" << llendl;
+ LL_INFOS() << "streamOut(date)" << LL_ENDL;
#endif
// no need to escape this since it will be alpha-numeric.
ostr << "<dateTime.iso8601>" << sd.asString() << "</dateTime.iso8601>";
break;
default:
// unhandled type
- llwarns << "Unhandled structured data type: " << sd.type()
- << llendl;
+ LL_WARNS() << "Unhandled structured data type: " << sd.type()
+ << LL_ENDL;
break;
}
ostr << "</value>";
@@ -308,7 +309,7 @@ LLFilterSD2XMLRPCResponse::~LLFilterSD2XMLRPCResponse()
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_SD2XMLRPC_RESPONSE("SD2XMLRPC Response");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_SD2XMLRPC_RESPONSE("SD2XMLRPC Response");
// virtual
LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl(
const LLChannelDescriptors& channels,
@@ -317,7 +318,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_SD2XMLRPC_RESPONSE);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_SD2XMLRPC_RESPONSE);
PUMP_DEBUG;
// This pipe does not work if it does not have everyting. This
@@ -360,7 +361,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl(
}
else
{
- llwarns << "Unable to determine the type of LLSD response." << llendl;
+ LL_WARNS() << "Unable to determine the type of LLSD response." << LL_ENDL;
}
PUMP_DEBUG;
return rv;
@@ -385,7 +386,7 @@ LLFilterSD2XMLRPCRequest::~LLFilterSD2XMLRPCRequest()
{
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_SD2XMLRPC_REQUEST("S22XMLRPC Request");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_SD2XMLRPC_REQUEST("S22XMLRPC Request");
// virtual
LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(
@@ -395,14 +396,14 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_SD2XMLRPC_REQUEST);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_SD2XMLRPC_REQUEST);
// This pipe does not work if it does not have everyting. This
// could be addressed by making a stream parser for llsd which
// handled partial information.
PUMP_DEBUG;
if(!eos)
{
- llinfos << "!eos" << llendl;
+ LL_INFOS() << "!eos" << LL_ENDL;
return STATUS_BREAK;
}
@@ -412,7 +413,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(
LLSDSerialize::fromNotation(sd, stream, buffer->count(channels.in()));
if(stream.fail())
{
- llinfos << "STREAM FAILURE reading structure data." << llendl;
+ LL_INFOS() << "STREAM FAILURE reading structure data." << LL_ENDL;
}
PUMP_DEBUG;
@@ -434,7 +435,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(
}
if(method.empty())
{
- llwarns << "SD -> XML Request no method found." << llendl;
+ LL_WARNS() << "SD -> XML Request no method found." << LL_ENDL;
return STATUS_ERROR;
}
@@ -445,13 +446,13 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(
ostream.precision(DEFAULT_PRECISION);
if(ostream.fail())
{
- llinfos << "STREAM FAILURE setting precision" << llendl;
+ LL_INFOS() << "STREAM FAILURE setting precision" << LL_ENDL;
}
ostream << XML_HEADER << XMLRPC_REQUEST_HEADER_1
<< xml_escape_string(method) << XMLRPC_REQUEST_HEADER_2;
if(ostream.fail())
{
- llinfos << "STREAM FAILURE writing method headers" << llendl;
+ LL_INFOS() << "STREAM FAILURE writing method headers" << LL_ENDL;
}
switch(param_sd.type())
{
@@ -518,7 +519,7 @@ LLIOPipe::EStatus stream_out(std::ostream& ostr, XMLRPC_VALUE value)
break;
}
case xmlrpc_type_boolean:
- //lldebugs << "stream_out() bool" << llendl;
+ //LL_DEBUGS() << "stream_out() bool" << LL_ENDL;
ostr << " " << (XMLRPC_GetValueBoolean(value) ? "true" : "false");
break;
case xmlrpc_type_datetime:
@@ -526,23 +527,23 @@ LLIOPipe::EStatus stream_out(std::ostream& ostr, XMLRPC_VALUE value)
break;
case xmlrpc_type_double:
ostr << " r" << XMLRPC_GetValueDouble(value);
- //lldebugs << "stream_out() double" << XMLRPC_GetValueDouble(value)
- // << llendl;
+ //LL_DEBUGS() << "stream_out() double" << XMLRPC_GetValueDouble(value)
+ // << LL_ENDL;
break;
case xmlrpc_type_int:
ostr << " i" << XMLRPC_GetValueInt(value);
- //lldebugs << "stream_out() integer:" << XMLRPC_GetValueInt(value)
- // << llendl;
+ //LL_DEBUGS() << "stream_out() integer:" << XMLRPC_GetValueInt(value)
+ // << LL_ENDL;
break;
case xmlrpc_type_string:
- //lldebugs << "stream_out() string: " << str << llendl;
+ //LL_DEBUGS() << "stream_out() string: " << str << LL_ENDL;
ostr << " s(" << XMLRPC_GetValueStringLen(value) << ")'"
<< XMLRPC_GetValueString(value) << "'";
break;
case xmlrpc_type_array: // vector
case xmlrpc_type_mixed: // vector
{
- //lldebugs << "stream_out() array" << llendl;
+ //LL_DEBUGS() << "stream_out() array" << LL_ENDL;
ostr << " [";
U32 needs_comma = 0;
XMLRPC_VALUE current = XMLRPC_VectorRewind(value);
@@ -557,7 +558,7 @@ LLIOPipe::EStatus stream_out(std::ostream& ostr, XMLRPC_VALUE value)
}
case xmlrpc_type_struct: // still vector
{
- //lldebugs << "stream_out() struct" << llendl;
+ //LL_DEBUGS() << "stream_out() struct" << LL_ENDL;
ostr << " {";
std::string name;
U32 needs_comma = 0;
@@ -577,7 +578,7 @@ LLIOPipe::EStatus stream_out(std::ostream& ostr, XMLRPC_VALUE value)
case xmlrpc_type_none:
default:
status = LLIOPipe::STATUS_ERROR;
- llwarns << "Found an empty xmlrpc type.." << llendl;
+ LL_WARNS() << "Found an empty xmlrpc type.." << LL_ENDL;
// not much we can do here...
break;
};
@@ -592,7 +593,7 @@ LLFilterXMLRPCResponse2LLSD::~LLFilterXMLRPCResponse2LLSD()
{
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_XMLRPC2LLSD_RESPONSE("XMLRPC2LLSD Response");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_XMLRPC2LLSD_RESPONSE("XMLRPC2LLSD Response");
LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl(
const LLChannelDescriptors& channels,
@@ -601,7 +602,7 @@ LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_XMLRPC2LLSD_RESPONSE);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_XMLRPC2LLSD_RESPONSE);
PUMP_DEBUG;
if(!eos) return STATUS_BREAK;
@@ -617,7 +618,7 @@ LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl(
buf[bytes] = '\0';
buffer->readAfter(channels.in(), NULL, (U8*)buf, bytes);
- //lldebugs << "xmlrpc response: " << buf << llendl;
+ //LL_DEBUGS() << "xmlrpc response: " << buf << LL_ENDL;
PUMP_DEBUG;
XMLRPC_REQUEST response = XMLRPC_REQUEST_FromXML(
@@ -626,7 +627,7 @@ LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl(
NULL);
if(!response)
{
- llwarns << "XML -> SD Response unable to parse xml." << llendl;
+ LL_WARNS() << "XML -> SD Response unable to parse xml." << LL_ENDL;
delete[] buf;
return STATUS_ERROR;
}
@@ -678,7 +679,7 @@ LLFilterXMLRPCRequest2LLSD::~LLFilterXMLRPCRequest2LLSD()
{
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_XMLRPC2LLSD_REQUEST("XMLRPC2LLSD Request");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_XMLRPC2LLSD_REQUEST("XMLRPC2LLSD Request");
LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl(
const LLChannelDescriptors& channels,
buffer_ptr_t& buffer,
@@ -686,7 +687,7 @@ LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_XMLRPC2LLSD_REQUEST);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_XMLRPC2LLSD_REQUEST);
PUMP_DEBUG;
if(!eos) return STATUS_BREAK;
if(!buffer) return STATUS_ERROR;
@@ -701,7 +702,7 @@ LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl(
buf[bytes] = '\0';
buffer->readAfter(channels.in(), NULL, (U8*)buf, bytes);
- //lldebugs << "xmlrpc request: " << buf << llendl;
+ //LL_DEBUGS() << "xmlrpc request: " << buf << LL_ENDL;
// Check the value in the buffer. XMLRPC_REQUEST_FromXML will report a error code 4 if
// values that are less than 0x20 are passed to it, except
@@ -728,7 +729,7 @@ LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl(
NULL);
if(!request)
{
- llwarns << "XML -> SD Request process parse error." << llendl;
+ LL_WARNS() << "XML -> SD Request process parse error." << LL_ENDL;
delete[] buf;
return STATUS_ERROR;
}
diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp
index 61a84de8e3..63c15f0d5e 100755
--- a/indra/llmessage/llhost.cpp
+++ b/indra/llmessage/llhost.cpp
@@ -84,18 +84,18 @@ std::string LLHost::getHostName() const
hostent* he;
if (INVALID_HOST_IP_ADDRESS == mIP)
{
- llwarns << "LLHost::getHostName() : Invalid IP address" << llendl;
+ LL_WARNS() << "LLHost::getHostName() : Invalid IP address" << LL_ENDL;
return std::string();
}
he = gethostbyaddr((char *)&mIP, sizeof(mIP), AF_INET);
if (!he)
{
#if LL_WINDOWS
- llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: "
- << WSAGetLastError() << llendl;
+ LL_WARNS() << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: "
+ << WSAGetLastError() << LL_ENDL;
#else
- llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: "
- << h_errno << llendl;
+ LL_WARNS() << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: "
+ << h_errno << LL_ENDL;
#endif
return std::string();
}
@@ -136,17 +136,17 @@ BOOL LLHost::setHostByName(const std::string& hostname)
switch(error_number)
{
case TRY_AGAIN: // XXX how to handle this case?
- llwarns << "LLHost::setAddress(): try again" << llendl;
+ LL_WARNS() << "LLHost::setAddress(): try again" << LL_ENDL;
break;
case HOST_NOT_FOUND:
case NO_ADDRESS: // NO_DATA
- llwarns << "LLHost::setAddress(): host not found" << llendl;
+ LL_WARNS() << "LLHost::setAddress(): host not found" << LL_ENDL;
break;
case NO_RECOVERY:
- llwarns << "LLHost::setAddress(): unrecoverable error" << llendl;
+ LL_WARNS() << "LLHost::setAddress(): unrecoverable error" << LL_ENDL;
break;
default:
- llwarns << "LLHost::setAddress(): unknown error - " << error_number << llendl;
+ LL_WARNS() << "LLHost::setAddress(): unknown error - " << error_number << LL_ENDL;
break;
}
return FALSE;
diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp
index 7dcf160c9b..f168ac4ec6 100755
--- a/indra/llmessage/llhttpassetstorage.cpp
+++ b/indra/llmessage/llhttpassetstorage.cpp
@@ -36,6 +36,7 @@
#include "llproxy.h"
#include "llvfile.h"
#include "llvfs.h"
+#include "llxfer.h"
#ifdef LL_STANDALONE
# include <zlib.h>
@@ -43,6 +44,8 @@
# include "zlib/zlib.h"
#endif
+const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset";
+
const U32 MAX_RUNNING_REQUESTS = 1;
const F32 MAX_PROCESSING_TIME = 0.005f;
const S32 CURL_XFER_BUFFER_SIZE = 65536;
@@ -51,13 +54,6 @@ const F32 GET_URL_TO_FILE_TIMEOUT = 1800.0f;
const S32 COMPRESSED_INPUT_BUFFER_SIZE = 4096;
-const S32 HTTP_OK = 200;
-const S32 HTTP_PUT_OK = 201;
-const S32 HTTP_NO_CONTENT = 204;
-const S32 HTTP_MISSING = 404;
-const S32 HTTP_SERVER_BAD_GATEWAY = 502;
-const S32 HTTP_SERVER_TEMP_UNAVAILABLE = 503;
-
/////////////////////////////////////////////////////////////////////////////////
// LLTempAssetData
// An asset not stored on central asset store, but on a simulator node somewhere.
@@ -273,7 +269,7 @@ void LLHTTPAssetRequest::setupCurlHandle()
}
else
{
- llerrs << "LLHTTPAssetRequest::setupCurlHandle - No asset storage associated with this request!" << llendl;
+ LL_ERRS() << "LLHTTPAssetRequest::setupCurlHandle - No asset storage associated with this request!" << LL_ENDL;
}
}
@@ -287,7 +283,7 @@ void LLHTTPAssetRequest::cleanupCurlHandle()
}
else
{
- llerrs << "LLHTTPAssetRequest::~LLHTTPAssetRequest - No asset storage associated with this request!" << llendl;
+ LL_ERRS() << "LLHTTPAssetRequest::~LLHTTPAssetRequest - No asset storage associated with this request!" << LL_ENDL;
}
mCurlHandle = NULL;
}
@@ -309,7 +305,7 @@ void LLHTTPAssetRequest::prepareCompressedUpload()
if (r != Z_OK)
{
- llerrs << "LLHTTPAssetRequest::prepareCompressedUpload defalateInit2() failed" << llendl;
+ LL_ERRS() << "LLHTTPAssetRequest::prepareCompressedUpload defalateInit2() failed" << LL_ENDL;
}
mZInitialized = true;
@@ -324,10 +320,10 @@ void LLHTTPAssetRequest::finishCompressedUpload()
{
if (mZInitialized)
{
- llinfos << "LLHTTPAssetRequest::finishCompressedUpload: "
+ LL_INFOS() << "LLHTTPAssetRequest::finishCompressedUpload: "
<< "read " << mZStream.total_in << " byte asset file, "
<< "uploaded " << mZStream.total_out << " byte compressed asset"
- << llendl;
+ << LL_ENDL;
deflateEnd(&mZStream);
delete[] mZInputBuffer;
@@ -365,8 +361,8 @@ size_t LLHTTPAssetRequest::readCompressedData(void* data, size_t size)
{
if (r < 0)
{
- llwarns << "LLHTTPAssetRequest::readCompressedData: deflate returned error code "
- << (S32) r << llendl;
+ LL_WARNS() << "LLHTTPAssetRequest::readCompressedData: deflate returned error code "
+ << (S32) r << LL_ENDL;
}
break;
}
@@ -453,7 +449,7 @@ void LLHTTPAssetStorage::storeAssetData(
bool store_local,
const LLUUID& requesting_agent_id,
bool user_waiting,
- F64 timeout)
+ F64Seconds timeout)
{
if (mVFS->getExists(uuid, type)) // VFS treats nonexistant and zero-length identically
{
@@ -493,7 +489,7 @@ void LLHTTPAssetStorage::storeAssetData(
}
else
{
- llwarns << "AssetStorage: attempt to upload non-existent vfile " << uuid << ":" << LLAssetType::lookup(type) << llendl;
+ LL_WARNS() << "AssetStorage: attempt to upload non-existent vfile " << uuid << ":" << LLAssetType::lookup(type) << LL_ENDL;
if (callback)
{
// LLAssetStorage metric: Zero size VFS
@@ -513,9 +509,9 @@ void LLHTTPAssetStorage::storeAssetData(
bool temp_file,
bool is_priority,
bool user_waiting,
- F64 timeout)
+ F64Seconds timeout)
{
- llinfos << "LLAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl;
+ LL_INFOS() << "LLAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL;
LLLegacyAssetRequest *legacy = new LLLegacyAssetRequest;
@@ -685,15 +681,15 @@ bool LLHTTPAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt,
}
- llinfos << "Asset " << getRequestName(rt) << " request for "
+ LL_INFOS() << "Asset " << getRequestName(rt) << " request for "
<< asset_id << "." << LLAssetType::lookup(asset_type)
<< " removed from curl and placed at the end of the pending queue."
- << llendl;
+ << LL_ENDL;
}
else
{
- llwarns << "Unable to find pending " << getRequestName(rt) << " request for "
- << asset_id << "." << LLAssetType::lookup(asset_type) << llendl;
+ LL_WARNS() << "Unable to find pending " << getRequestName(rt) << " request for "
+ << asset_id << "." << LLAssetType::lookup(asset_type) << LL_ENDL;
}
}
delete req;
@@ -800,7 +796,7 @@ void LLHTTPAssetStorage::checkForTimeouts()
}
else
{
- llinfos << "Requesting " << new_req->mURLBuffer << llendl;
+ LL_INFOS() << "Requesting " << new_req->mURLBuffer << LL_ENDL;
}
}
@@ -864,10 +860,10 @@ void LLHTTPAssetStorage::checkForTimeouts()
// Get the uncompressed file size.
LLVFile file(mVFS,new_req->getUUID(),new_req->getType());
S32 size = file.getSize();
- llinfos << "Requesting PUT " << new_req->mURLBuffer << ", asset size: " << size << " bytes" << llendl;
+ LL_INFOS() << "Requesting PUT " << new_req->mURLBuffer << ", asset size: " << size << " bytes" << LL_ENDL;
if (size == 0)
{
- llwarns << "Rejecting zero size PUT request!" << llendl;
+ LL_WARNS() << "Rejecting zero size PUT request!" << LL_ENDL;
new_req->cleanupCurlHandle();
deletePendingRequest(RT_UPLOAD, new_req->getType(), new_req->getUUID());
}
@@ -913,12 +909,12 @@ void LLHTTPAssetStorage::checkForTimeouts()
// Get the uncompressed file size.
S32 size = file.getSize();
- llinfos << "TAT: LLHTTPAssetStorage::checkForTimeouts() : pending local!"
- << " Requesting PUT " << new_req->mURLBuffer << ", asset size: " << size << " bytes" << llendl;
+ LL_INFOS() << "TAT: LLHTTPAssetStorage::checkForTimeouts() : pending local!"
+ << " Requesting PUT " << new_req->mURLBuffer << ", asset size: " << size << " bytes" << LL_ENDL;
if (size == 0)
{
- llwarns << "Rejecting zero size PUT request!" << llendl;
+ LL_WARNS() << "Rejecting zero size PUT request!" << LL_ENDL;
new_req->cleanupCurlHandle();
deletePendingRequest(RT_UPLOAD, new_req->getType(), new_req->getUUID());
}
@@ -952,10 +948,10 @@ void LLHTTPAssetStorage::checkForTimeouts()
{
if (curl_msg->data.result == CURLE_OK &&
( curl_result == HTTP_OK
- || curl_result == HTTP_PUT_OK
+ || curl_result == HTTP_CREATED
|| curl_result == HTTP_NO_CONTENT))
{
- llinfos << "Success uploading " << req->getUUID() << " to " << req->mURLBuffer << llendl;
+ LL_INFOS() << "Success uploading " << req->getUUID() << " to " << req->mURLBuffer << LL_ENDL;
if (RT_LOCALUPLOAD == req->mRequestType)
{
addTempAssetData(req->getUUID(), req->mRequestingAgentID, mHostName);
@@ -963,11 +959,11 @@ void LLHTTPAssetStorage::checkForTimeouts()
}
else if (curl_msg->data.result == CURLE_COULDNT_CONNECT ||
curl_msg->data.result == CURLE_OPERATION_TIMEOUTED ||
- curl_result == HTTP_SERVER_BAD_GATEWAY ||
- curl_result == HTTP_SERVER_TEMP_UNAVAILABLE)
+ curl_result == HTTP_BAD_GATEWAY ||
+ curl_result == HTTP_SERVICE_UNAVAILABLE)
{
- llwarns << "Re-requesting upload for " << req->getUUID() << ". Received upload error to " << req->mURLBuffer <<
- " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl;
+ LL_WARNS() << "Re-requesting upload for " << req->getUUID() << ". Received upload error to " << req->mURLBuffer <<
+ " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << LL_ENDL;
////HACK (probably) I am sick of this getting requeued and driving me mad.
//if (req->mIsUserWaiting)
@@ -977,16 +973,16 @@ void LLHTTPAssetStorage::checkForTimeouts()
}
else
{
- llwarns << "Failure uploading " << req->getUUID() << " to " << req->mURLBuffer <<
- " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl;
+ LL_WARNS() << "Failure uploading " << req->getUUID() << " to " << req->mURLBuffer <<
+ " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << LL_ENDL;
xfer_result = LL_ERR_ASSET_REQUEST_FAILED;
}
if (!(curl_msg->data.result == CURLE_COULDNT_CONNECT ||
curl_msg->data.result == CURLE_OPERATION_TIMEOUTED ||
- curl_result == HTTP_SERVER_BAD_GATEWAY ||
- curl_result == HTTP_SERVER_TEMP_UNAVAILABLE))
+ curl_result == HTTP_BAD_GATEWAY ||
+ curl_result == HTTP_SERVICE_UNAVAILABLE))
{
// shared upload finished callback
// in the base class, this is called from processUploadComplete
@@ -1000,7 +996,7 @@ void LLHTTPAssetStorage::checkForTimeouts()
{
if (req->mVFile && req->mVFile->getSize() > 0)
{
- llinfos << "Success downloading " << req->mURLBuffer << ", size " << req->mVFile->getSize() << llendl;
+ LL_INFOS() << "Success downloading " << req->mURLBuffer << ", size " << req->mVFile->getSize() << LL_ENDL;
req->mVFile->rename(req->getUUID(), req->getType());
}
@@ -1008,17 +1004,17 @@ void LLHTTPAssetStorage::checkForTimeouts()
{
// *TODO: if this actually indicates a bad asset on the server
// (not certain at this point), then delete it
- llwarns << "Found " << req->mURLBuffer << " to be zero size" << llendl;
+ LL_WARNS() << "Found " << req->mURLBuffer << " to be zero size" << LL_ENDL;
xfer_result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
}
}
else
{
// KLW - TAT See if an avatar owns this texture, and if so request re-upload.
- llwarns << "Failure downloading " << req->mURLBuffer <<
- " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl;
+ LL_WARNS() << "Failure downloading " << req->mURLBuffer <<
+ " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << LL_ENDL;
- xfer_result = (curl_result == HTTP_MISSING) ? LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE : LL_ERR_ASSET_REQUEST_FAILED;
+ xfer_result = (curl_result == HTTP_NOT_FOUND) ? LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE : LL_ERR_ASSET_REQUEST_FAILED;
if (req->mVFile)
{
@@ -1061,7 +1057,7 @@ void LLHTTPAssetStorage::bumpTimedOutUploads()
{
bool user_waiting=FALSE;
- F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds();
if (mPendingUploads.size())
{
@@ -1088,10 +1084,10 @@ void LLHTTPAssetStorage::bumpTimedOutUploads()
if ( req->mTimeout < (mt_secs - req->mTime) )
{
- llwarns << "Asset upload request timed out for "
+ LL_WARNS() << "Asset upload request timed out for "
<< req->getUUID() << "."
<< LLAssetType::lookup(req->getType())
- << ", bumping to the back of the line!" << llendl;
+ << ", bumping to the back of the line!" << LL_ENDL;
deletePendingRequest(RT_UPLOAD, req->getType(), req->getUUID());
}
@@ -1103,7 +1099,7 @@ size_t LLHTTPAssetStorage::curlDownCallback(void *data, size_t size, size_t nmem
{
if (!gAssetStorage)
{
- llwarns << "Missing gAssetStorage, aborting curl download callback!" << llendl;
+ LL_WARNS() << "Missing gAssetStorage, aborting curl download callback!" << LL_ENDL;
return 0;
}
S32 bytes = (S32)(size * nmemb);
@@ -1133,7 +1129,7 @@ size_t LLHTTPAssetStorage::curlUpCallback(void *data, size_t size, size_t nmemb,
{
if (!gAssetStorage)
{
- llwarns << "Missing gAssetStorage, aborting curl download callback!" << llendl;
+ LL_WARNS() << "Missing gAssetStorage, aborting curl download callback!" << LL_ENDL;
return 0;
}
CURL *curl_handle = (CURL *)user_data;
@@ -1168,12 +1164,12 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse
{
// *NOTE: There is no guarantee that the uuid and the asset_type match
// - not that it matters. - Doug
- lldebugs << "LLHTTPAssetStorage::getURLToFile() - " << url << llendl;
+ LL_DEBUGS() << "LLHTTPAssetStorage::getURLToFile() - " << url << LL_ENDL;
FILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/
if (! fp)
{
- llwarns << "Failed to open " << filename << " for writing" << llendl;
+ LL_WARNS() << "Failed to open " << filename << " for writing" << LL_ENDL;
return LL_ERR_ASSET_REQUEST_FAILED;
}
@@ -1187,7 +1183,7 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse
curl_easy_setopt(req.mCurlHandle, CURLOPT_WRITEDATA, req.mCurlHandle);
curl_multi_add_handle(mCurlMultiHandle, req.mCurlHandle);
- llinfos << "Requesting as file " << req.mURLBuffer << llendl;
+ LL_INFOS() << "Requesting as file " << req.mURLBuffer << LL_ENDL;
// braindead curl loop
int queue_length;
@@ -1212,7 +1208,7 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse
}
else if (timeout.hasExpired())
{
- llwarns << "Request for " << url << " has timed out." << llendl;
+ LL_WARNS() << "Request for " << url << " has timed out." << LL_ENDL;
success = false;
xfer_result = LL_ERR_ASSET_REQUEST_FAILED;
break;
@@ -1230,19 +1226,19 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse
if (size > 0)
{
// everything seems to be in order
- llinfos << "Success downloading " << req.mURLBuffer << " to file, size " << size << llendl;
+ LL_INFOS() << "Success downloading " << req.mURLBuffer << " to file, size " << size << LL_ENDL;
}
else
{
- llwarns << "Found " << req.mURLBuffer << " to be zero size" << llendl;
+ LL_WARNS() << "Found " << req.mURLBuffer << " to be zero size" << LL_ENDL;
xfer_result = LL_ERR_ASSET_REQUEST_FAILED;
}
}
else
{
- xfer_result = curl_result == HTTP_MISSING ? LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE : LL_ERR_ASSET_REQUEST_FAILED;
- llinfos << "Failure downloading " << req.mURLBuffer <<
- " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl;
+ xfer_result = curl_result == HTTP_NOT_FOUND ? LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE : LL_ERR_ASSET_REQUEST_FAILED;
+ LL_INFOS() << "Failure downloading " << req.mURLBuffer <<
+ " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << LL_ENDL;
}
}
@@ -1264,7 +1260,7 @@ size_t LLHTTPAssetStorage::curlFileDownCallback(void *data, size_t size, size_t
if (! req->mFP)
{
- llwarns << "Missing mFP, aborting curl file download callback!" << llendl;
+ LL_WARNS() << "Missing mFP, aborting curl file download callback!" << LL_ENDL;
return 0;
}
@@ -1311,7 +1307,7 @@ void LLHTTPAssetStorage::addRunningRequest(ERequestType rt, LLHTTPAssetRequest*
}
else
{
- llerrs << "LLHTTPAssetStorage::addRunningRequest - Request is not an upload OR download, this is bad!" << llendl;
+ LL_ERRS() << "LLHTTPAssetStorage::addRunningRequest - Request is not an upload OR download, this is bad!" << LL_ENDL;
}
}
@@ -1324,7 +1320,7 @@ void LLHTTPAssetStorage::removeRunningRequest(ERequestType rt, LLHTTPAssetReques
}
else
{
- llerrs << "LLHTTPAssetStorage::removeRunningRequest - Destroyed request is not an upload OR download, this is bad!" << llendl;
+ LL_ERRS() << "LLHTTPAssetStorage::removeRunningRequest - Destroyed request is not an upload OR download, this is bad!" << LL_ENDL;
}
}
@@ -1333,7 +1329,7 @@ void LLHTTPAssetStorage::addTempAssetData(const LLUUID& asset_id, const LLUUID&
{
if (agent_id.isNull() || asset_id.isNull())
{
- llwarns << "TAT: addTempAssetData bad id's asset_id: " << asset_id << " agent_id: " << agent_id << llendl;
+ LL_WARNS() << "TAT: addTempAssetData bad id's asset_id: " << asset_id << " agent_id: " << agent_id << LL_ENDL;
return;
}
@@ -1434,26 +1430,26 @@ void LLHTTPAssetStorage::dumpTempAssetData(const LLUUID& avatar_id) const
if (avatar_id.isNull()
|| avatar_id == temp_asset_data.mAgentID)
{
- llinfos << "TAT: dump agent " << temp_asset_data.mAgentID
+ LL_INFOS() << "TAT: dump agent " << temp_asset_data.mAgentID
<< " texture " << temp_asset_data.mAssetID
<< " host " << temp_asset_data.mHostName
- << llendl;
+ << LL_ENDL;
count++;
}
}
if (avatar_id.isNull())
{
- llinfos << "TAT: dumped " << count << " entries for all avatars" << llendl;
+ LL_INFOS() << "TAT: dumped " << count << " entries for all avatars" << LL_ENDL;
}
else
{
- llinfos << "TAT: dumped " << count << " entries for avatar " << avatar_id << llendl;
+ LL_INFOS() << "TAT: dumped " << count << " entries for avatar " << avatar_id << LL_ENDL;
}
}
void LLHTTPAssetStorage::clearTempAssetData()
{
- llinfos << "TAT: Clearing temp asset data map" << llendl;
+ LL_INFOS() << "TAT: Clearing temp asset data map" << LL_ENDL;
mTempAssets.clear();
}
diff --git a/indra/llmessage/llhttpassetstorage.h b/indra/llmessage/llhttpassetstorage.h
index f743ccf0ac..783e95cac6 100755
--- a/indra/llmessage/llhttpassetstorage.h
+++ b/indra/llmessage/llhttpassetstorage.h
@@ -69,7 +69,7 @@ public:
bool store_local = false,
const LLUUID& requesting_agent_id = LLUUID::null,
bool user_waiting=FALSE,
- F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
+ F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
virtual void storeAssetData(
const std::string& filename,
@@ -80,7 +80,7 @@ public:
bool temp_file,
bool is_priority,
bool user_waiting=FALSE,
- F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
+ F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
virtual LLSD getPendingDetails(ERequestType rt,
LLAssetType::EType asset_type,
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 11648717ad..200116337d 100755
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -54,7 +54,7 @@ namespace
{
public:
LLHTTPClientURLAdaptor(LLCurl::ResponderPtr responder)
- : LLURLRequestComplete(), mResponder(responder), mStatus(499),
+ : LLURLRequestComplete(), mResponder(responder), mStatus(HTTP_INTERNAL_ERROR),
mReason("LLURLRequest complete w/no status")
{
}
@@ -63,7 +63,7 @@ namespace
{
}
- virtual void httpStatus(U32 status, const std::string& reason)
+ virtual void httpStatus(S32 status, const std::string& reason)
{
LLURLRequestComplete::httpStatus(status,reason);
@@ -74,30 +74,33 @@ namespace
virtual void complete(const LLChannelDescriptors& channels,
const buffer_ptr_t& buffer)
{
+ // *TODO: Re-interpret mRequestStatus codes?
+ // Would like to detect curl errors, such as
+ // connection errors, write erros, etc.
if (mResponder.get())
{
- // Allow clients to parse headers before we attempt to parse
- // the body and provide completed/result/error calls.
- mResponder->completedHeader(mStatus, mReason, mHeaderOutput);
- mResponder->completedRaw(mStatus, mReason, channels, buffer);
+ mResponder->setResult(mStatus, mReason);
+ mResponder->completedRaw(channels, buffer);
}
}
virtual void header(const std::string& header, const std::string& value)
{
- mHeaderOutput[header] = value;
+ if (mResponder.get())
+ {
+ mResponder->setResponseHeader(header, value);
+ }
}
private:
LLCurl::ResponderPtr mResponder;
- U32 mStatus;
+ S32 mStatus;
std::string mReason;
- LLSD mHeaderOutput;
};
class Injector : public LLIOPipe
{
public:
- virtual const char* contentType() = 0;
+ virtual const std::string& contentType() = 0;
};
class LLSDInjector : public Injector
@@ -106,7 +109,7 @@ namespace
LLSDInjector(const LLSD& sd) : mSD(sd) {}
virtual ~LLSDInjector() {}
- const char* contentType() { return "application/llsd+xml"; }
+ const std::string& contentType() { return HTTP_CONTENT_LLSD_XML; }
virtual EStatus process_impl(const LLChannelDescriptors& channels,
buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump)
@@ -124,9 +127,9 @@ namespace
{
public:
RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {}
- virtual ~RawInjector() {delete mData;}
+ virtual ~RawInjector() {delete [] mData;}
- const char* contentType() { return "application/octet-stream"; }
+ const std::string& contentType() { return HTTP_CONTENT_OCTET_STREAM; }
virtual EStatus process_impl(const LLChannelDescriptors& channels,
buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump)
@@ -147,7 +150,7 @@ namespace
FileInjector(const std::string& filename) : mFilename(filename) {}
virtual ~FileInjector() {}
- const char* contentType() { return "application/octet-stream"; }
+ const std::string& contentType() { return HTTP_CONTENT_OCTET_STREAM; }
virtual EStatus process_impl(const LLChannelDescriptors& channels,
buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump)
@@ -180,7 +183,7 @@ namespace
VFileInjector(const LLUUID& uuid, LLAssetType::EType asset_type) : mUUID(uuid), mAssetType(asset_type) {}
virtual ~VFileInjector() {}
- const char* contentType() { return "application/octet-stream"; }
+ const std::string& contentType() { return HTTP_CONTENT_OCTET_STREAM; }
virtual EStatus process_impl(const LLChannelDescriptors& channels,
buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump)
@@ -213,7 +216,7 @@ void LLHTTPClient::setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback cal
static void request(
const std::string& url,
- LLURLRequest::ERequestAction method,
+ EHTTPMethod method,
Injector* body_injector,
LLCurl::ResponderPtr responder,
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
@@ -225,7 +228,7 @@ static void request(
{
if (responder)
{
- responder->completed(U32_MAX, "No pump", LLSD());
+ responder->completeResult(HTTP_INTERNAL_ERROR, "No pump");
}
delete body_injector;
return;
@@ -237,90 +240,82 @@ static void request(
{
if (responder)
{
- responder->completed(498, "Internal Error - curl failure", LLSD());
+ responder->completeResult(HTTP_INTERNAL_CURL_ERROR, "Internal Error - curl failure");
}
- delete req ;
+ delete req;
delete body_injector;
- return ;
+ return;
}
req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
-
- lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " "
- << headers << llendl;
+ LL_DEBUGS("LLHTTPClient") << httpMethodAsVerb(method) << " " << url << " " << headers << LL_ENDL;
// Insert custom headers if the caller sent any
if (headers.isMap())
{
- if (headers.has("Cookie"))
+ if (headers.has(HTTP_OUT_HEADER_COOKIE))
{
req->allowCookies();
}
- LLSD::map_const_iterator iter = headers.beginMap();
- LLSD::map_const_iterator end = headers.endMap();
-
- for (; iter != end; ++iter)
- {
- std::ostringstream header;
- //if the header is "Pragma" with no value
- //the caller intends to force libcurl to drop
- //the Pragma header it so gratuitously inserts
- //Before inserting the header, force libcurl
- //to not use the proxy (read: llurlrequest.cpp)
- static const std::string PRAGMA("Pragma");
- if ((iter->first == PRAGMA) && (iter->second.asString().empty()))
- {
- req->useProxy(false);
- }
- header << iter->first << ": " << iter->second.asString() ;
- lldebugs << "header = " << header.str() << llendl;
- req->addHeader(header.str().c_str());
- }
- }
+ LLSD::map_const_iterator iter = headers.beginMap();
+ LLSD::map_const_iterator end = headers.endMap();
+
+ for (; iter != end; ++iter)
+ {
+ //if the header is "Pragma" with no value
+ //the caller intends to force libcurl to drop
+ //the Pragma header it so gratuitously inserts
+ //Before inserting the header, force libcurl
+ //to not use the proxy (read: llurlrequest.cpp)
+ if ((iter->first == HTTP_OUT_HEADER_PRAGMA) && (iter->second.asString().empty()))
+ {
+ req->useProxy(false);
+ }
+ LL_DEBUGS("LLHTTPClient") << "header = " << iter->first
+ << ": " << iter->second.asString() << LL_ENDL;
+ req->addHeader(iter->first, iter->second.asString());
+ }
+ }
// Check to see if we have already set Accept or not. If no one
// set it, set it to application/llsd+xml since that's what we
// almost always want.
- if( method != LLURLRequest::HTTP_PUT && method != LLURLRequest::HTTP_POST )
+ if( method != HTTP_PUT && method != HTTP_POST )
{
- static const std::string ACCEPT("Accept");
- if(!headers.has(ACCEPT))
+ if(!headers.has(HTTP_OUT_HEADER_ACCEPT))
{
- req->addHeader("Accept: application/llsd+xml");
+ req->addHeader(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML);
}
}
if (responder)
{
responder->setURL(url);
+ responder->setHTTPMethod(method);
}
req->setCallback(new LLHTTPClientURLAdaptor(responder));
- if (method == LLURLRequest::HTTP_POST && gMessageSystem)
+ if (method == HTTP_POST && gMessageSystem)
{
- req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d",
- gMessageSystem->mPort).c_str());
- }
+ req->addHeader("X-SecondLife-UDP-Listen-Port", llformat("%d",
+ gMessageSystem->mPort));
+ }
- if (method == LLURLRequest::HTTP_PUT || method == LLURLRequest::HTTP_POST)
+ if (method == HTTP_PUT || method == HTTP_POST || method == HTTP_PATCH)
{
- static const std::string CONTENT_TYPE("Content-Type");
- if(!headers.has(CONTENT_TYPE))
+ if(!headers.has(HTTP_OUT_HEADER_CONTENT_TYPE))
{
// If the Content-Type header was passed in, it has
// already been added as a header through req->addHeader
// in the loop above. We defer to the caller's wisdom, but
// if they did not specify a Content-Type, then ask the
// injector.
- req->addHeader(
- llformat(
- "Content-Type: %s",
- body_injector->contentType()).c_str());
+ req->addHeader(HTTP_OUT_HEADER_CONTENT_TYPE, body_injector->contentType());
}
- chain.push_back(LLIOPipe::ptr_t(body_injector));
+ chain.push_back(LLIOPipe::ptr_t(body_injector));
}
chain.push_back(LLIOPipe::ptr_t(req));
@@ -342,9 +337,9 @@ void LLHTTPClient::getByteRange(
if(offset > 0 || bytes > 0)
{
std::string range = llformat("bytes=%d-%d", offset, offset+bytes-1);
- headers["Range"] = range;
+ headers[HTTP_OUT_HEADER_RANGE] = range;
}
- request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers, follow_redirects);
+ request(url,HTTP_GET, NULL, responder, timeout, headers, follow_redirects);
}
void LLHTTPClient::head(
@@ -354,18 +349,18 @@ void LLHTTPClient::head(
const F32 timeout,
bool follow_redirects /* = true */)
{
- request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers, follow_redirects);
+ request(url, HTTP_HEAD, NULL, responder, timeout, headers, follow_redirects);
}
void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout,
bool follow_redirects /* = true */)
{
- request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout, headers, follow_redirects);
+ request(url, HTTP_GET, NULL, responder, timeout, headers, follow_redirects);
}
void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers,
const F32 timeout, bool follow_redirects /* = true */)
{
- request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers, follow_redirects);
+ request(url, HTTP_HEAD, NULL, responder, timeout, headers, follow_redirects);
}
void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout,
bool follow_redirects /* = true */)
@@ -408,7 +403,7 @@ public:
return content;
}
- std::string asString()
+ const std::string& asString()
{
return mBuffer;
}
@@ -437,13 +432,13 @@ private:
*/
static LLSD blocking_request(
const std::string& url,
- LLURLRequest::ERequestAction method,
+ EHTTPMethod method,
const LLSD& body,
const LLSD& headers = LLSD(),
const F32 timeout = 5
)
{
- lldebugs << "blockingRequest of " << url << llendl;
+ LL_DEBUGS() << "blockingRequest of " << url << LL_ENDL;
char curl_error_buffer[CURL_ERROR_SIZE] = "\0";
CURL* curlp = LLCurl::newEasyHandle();
llassert_always(curlp != NULL) ;
@@ -474,17 +469,17 @@ static LLSD blocking_request(
{
std::ostringstream header;
header << iter->first << ": " << iter->second.asString() ;
- lldebugs << "header = " << header.str() << llendl;
+ LL_DEBUGS() << "header = " << header.str() << LL_ENDL;
headers_list = curl_slist_append(headers_list, header.str().c_str());
}
}
// * Setup specific method / "verb" for the URI (currently only GET and POST supported + poppy)
- if (method == LLURLRequest::HTTP_GET)
+ if (method == HTTP_GET)
{
curl_easy_setopt(curlp, CURLOPT_HTTPGET, 1);
}
- else if (method == LLURLRequest::HTTP_POST)
+ else if (method == HTTP_POST)
{
curl_easy_setopt(curlp, CURLOPT_POST, 1);
//serialize to ostr then copy to str - need to because ostr ptr is unstable :(
@@ -493,46 +488,48 @@ static LLSD blocking_request(
body_str = ostr.str();
curl_easy_setopt(curlp, CURLOPT_POSTFIELDS, body_str.c_str());
//copied from PHP libs, correct?
- headers_list = curl_slist_append(headers_list, "Content-Type: application/llsd+xml");
+ headers_list = curl_slist_append(headers_list,
+ llformat("%s: %s", HTTP_OUT_HEADER_CONTENT_TYPE.c_str(), HTTP_CONTENT_LLSD_XML.c_str()).c_str());
// copied from llurlrequest.cpp
// it appears that apache2.2.3 or django in etch is busted. If
// we do not clear the expect header, we get a 500. May be
// limited to django/mod_wsgi.
- headers_list = curl_slist_append(headers_list, "Expect:");
+ headers_list = curl_slist_append(headers_list, llformat("%s:", HTTP_OUT_HEADER_EXPECT.c_str()).c_str());
}
// * Do the action using curl, handle results
- lldebugs << "HTTP body: " << body_str << llendl;
- headers_list = curl_slist_append(headers_list, "Accept: application/llsd+xml");
+ LL_DEBUGS() << "HTTP body: " << body_str << LL_ENDL;
+ headers_list = curl_slist_append(headers_list,
+ llformat("%s: %s", HTTP_OUT_HEADER_ACCEPT.c_str(), HTTP_CONTENT_LLSD_XML.c_str()).c_str());
CURLcode curl_result = curl_easy_setopt(curlp, CURLOPT_HTTPHEADER, headers_list);
if ( curl_result != CURLE_OK )
{
- llinfos << "Curl is hosed - can't add headers" << llendl;
+ LL_INFOS() << "Curl is hosed - can't add headers" << LL_ENDL;
}
LLSD response = LLSD::emptyMap();
S32 curl_success = curl_easy_perform(curlp);
- S32 http_status = 499;
+ S32 http_status = HTTP_INTERNAL_ERROR;
curl_easy_getinfo(curlp, CURLINFO_RESPONSE_CODE, &http_status);
response["status"] = http_status;
// if we get a non-404 and it's not a 200 OR maybe it is but you have error bits,
- if ( http_status != 404 && (http_status != 200 || curl_success != 0) )
+ if ( http_status != HTTP_NOT_FOUND && (http_status != HTTP_OK || curl_success != 0) )
{
// We expect 404s, don't spam for them.
- llwarns << "CURL REQ URL: " << url << llendl;
- llwarns << "CURL REQ METHOD TYPE: " << method << llendl;
- llwarns << "CURL REQ HEADERS: " << headers.asString() << llendl;
- llwarns << "CURL REQ BODY: " << body_str << llendl;
- llwarns << "CURL HTTP_STATUS: " << http_status << llendl;
- llwarns << "CURL ERROR: " << curl_error_buffer << llendl;
- llwarns << "CURL ERROR BODY: " << http_buffer.asString() << llendl;
+ LL_WARNS() << "CURL REQ URL: " << url << LL_ENDL;
+ LL_WARNS() << "CURL REQ METHOD TYPE: " << method << LL_ENDL;
+ LL_WARNS() << "CURL REQ HEADERS: " << headers.asString() << LL_ENDL;
+ LL_WARNS() << "CURL REQ BODY: " << body_str << LL_ENDL;
+ LL_WARNS() << "CURL HTTP_STATUS: " << http_status << LL_ENDL;
+ LL_WARNS() << "CURL ERROR: " << curl_error_buffer << LL_ENDL;
+ LL_WARNS() << "CURL ERROR BODY: " << http_buffer.asString() << LL_ENDL;
response["body"] = http_buffer.asString();
}
else
{
response["body"] = http_buffer.asLLSD();
- lldebugs << "CURL response: " << http_buffer.asString() << llendl;
+ LL_DEBUGS() << "CURL response: " << http_buffer.asString() << LL_ENDL;
}
if(headers_list)
@@ -547,12 +544,12 @@ static LLSD blocking_request(
LLSD LLHTTPClient::blockingGet(const std::string& url)
{
- return blocking_request(url, LLURLRequest::HTTP_GET, LLSD());
+ return blocking_request(url, HTTP_GET, LLSD());
}
LLSD LLHTTPClient::blockingPost(const std::string& url, const LLSD& body)
{
- return blocking_request(url, LLURLRequest::HTTP_POST, body);
+ return blocking_request(url, HTTP_POST, body);
}
void LLHTTPClient::put(
@@ -562,7 +559,17 @@ void LLHTTPClient::put(
const LLSD& headers,
const F32 timeout)
{
- request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout, headers);
+ request(url, HTTP_PUT, new LLSDInjector(body), responder, timeout, headers);
+}
+
+void LLHTTPClient::patch(
+ const std::string& url,
+ const LLSD& body,
+ ResponderPtr responder,
+ const LLSD& headers,
+ const F32 timeout)
+{
+ request(url, HTTP_PATCH, new LLSDInjector(body), responder, timeout, headers);
}
void LLHTTPClient::post(
@@ -572,7 +579,7 @@ void LLHTTPClient::post(
const LLSD& headers,
const F32 timeout)
{
- request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout, headers);
+ request(url, HTTP_POST, new LLSDInjector(body), responder, timeout, headers);
}
void LLHTTPClient::postRaw(
@@ -583,7 +590,7 @@ void LLHTTPClient::postRaw(
const LLSD& headers,
const F32 timeout)
{
- request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout, headers);
+ request(url, HTTP_POST, new RawInjector(data, size), responder, timeout, headers);
}
void LLHTTPClient::postFile(
@@ -593,7 +600,7 @@ void LLHTTPClient::postFile(
const LLSD& headers,
const F32 timeout)
{
- request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout, headers);
+ request(url, HTTP_POST, new FileInjector(filename), responder, timeout, headers);
}
void LLHTTPClient::postFile(
@@ -604,7 +611,7 @@ void LLHTTPClient::postFile(
const LLSD& headers,
const F32 timeout)
{
- request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout, headers);
+ request(url, HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout, headers);
}
// static
@@ -614,7 +621,7 @@ void LLHTTPClient::del(
const LLSD& headers,
const F32 timeout)
{
- request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout, headers);
+ request(url, HTTP_DELETE, NULL, responder, timeout, headers);
}
// static
@@ -626,8 +633,21 @@ void LLHTTPClient::move(
const F32 timeout)
{
LLSD headers = hdrs;
- headers["Destination"] = destination;
- request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers);
+ headers[HTTP_OUT_HEADER_DESTINATION] = destination;
+ request(url, HTTP_MOVE, NULL, responder, timeout, headers);
+}
+
+// static
+void LLHTTPClient::copy(
+ const std::string& url,
+ const std::string& destination,
+ ResponderPtr responder,
+ const LLSD& hdrs,
+ const F32 timeout)
+{
+ LLSD headers = hdrs;
+ headers[HTTP_OUT_HEADER_DESTINATION] = destination;
+ request(url, HTTP_COPY, NULL, responder, timeout, headers);
}
diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h
index 5de257a4f6..b18258fd7b 100755
--- a/indra/llmessage/llhttpclient.h
+++ b/indra/llmessage/llhttpclient.h
@@ -79,6 +79,14 @@ public:
ResponderPtr,
const LLSD& headers = LLSD(),
const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
+
+ static void patch(
+ const std::string& url,
+ const LLSD& body,
+ ResponderPtr,
+ const LLSD& headers = LLSD(),
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
+
static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS,
bool follow_redirects = true);
static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers,
@@ -118,7 +126,7 @@ public:
const LLSD& headers = LLSD(),
const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
///< sends a DELETE method, but we can't call it delete in c++
-
+
/**
* @brief Send a MOVE webdav method
*
@@ -135,6 +143,22 @@ public:
const LLSD& headers = LLSD(),
const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
+ /**
+ * @brief Send a COPY webdav method
+ *
+ * @param url The complete serialized (and escaped) url to get.
+ * @param destination The complete serialized destination url.
+ * @param responder The responder that will handle the result.
+ * @param headers A map of key:value headers to pass to the request
+ * @param timeout The number of seconds to give the server to respond.
+ */
+ static void copy(
+ const std::string& url,
+ const std::string& destination,
+ ResponderPtr responder,
+ const LLSD& headers = LLSD(),
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
+
//@}
/**
diff --git a/indra/llmessage/llhttpclientadapter.cpp b/indra/llmessage/llhttpclientadapter.cpp
index dcd2d79d67..b56a804f94 100755
--- a/indra/llmessage/llhttpclientadapter.cpp
+++ b/indra/llmessage/llhttpclientadapter.cpp
@@ -35,18 +35,18 @@ void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr respo
{
LLSD empty_pragma_header;
// Pragma is required to stop curl adding "no-cache"
- // Space is required to stop llurlrequest from turnning off proxying
- empty_pragma_header["Pragma"] = " ";
+ // Space is required to stop llurlrequest from turning off proxying
+ empty_pragma_header[HTTP_OUT_HEADER_PRAGMA] = " ";
LLHTTPClient::get(url, responder, empty_pragma_header);
}
void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers)
{
LLSD empty_pragma_header = headers;
- if (!empty_pragma_header.has("Pragma"))
+ if (!empty_pragma_header.has(HTTP_OUT_HEADER_PRAGMA))
{
- // as above
- empty_pragma_header["Pragma"] = " ";
+ // as above
+ empty_pragma_header[HTTP_OUT_HEADER_PRAGMA] = " ";
}
LLHTTPClient::get(url, responder, empty_pragma_header);
}
@@ -56,3 +56,18 @@ void LLHTTPClientAdapter::put(const std::string& url, const LLSD& body, LLCurl::
LLHTTPClient::put(url, body, responder);
}
+void LLHTTPClientAdapter::put(
+ const std::string& url,
+ const LLSD& body,
+ LLCurl::ResponderPtr responder,
+ const LLSD& headers)
+{
+ LLHTTPClient::put(url, body, responder, headers);
+}
+
+void LLHTTPClientAdapter::del(
+ const std::string& url,
+ LLCurl::ResponderPtr responder)
+{
+ LLHTTPClient::del(url, responder);
+}
diff --git a/indra/llmessage/llhttpclientadapter.h b/indra/llmessage/llhttpclientadapter.h
index aae6426a59..270282c66f 100755
--- a/indra/llmessage/llhttpclientadapter.h
+++ b/indra/llmessage/llhttpclientadapter.h
@@ -37,6 +37,14 @@ public:
virtual void get(const std::string& url, LLCurl::ResponderPtr responder);
virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers);
virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder);
+ virtual void put(
+ const std::string& url,
+ const LLSD& body,
+ LLCurl::ResponderPtr responder,
+ const LLSD& headers);
+ virtual void del(
+ const std::string& url,
+ LLCurl::ResponderPtr responder);
};
#endif
diff --git a/indra/llmessage/llhttpconstants.cpp b/indra/llmessage/llhttpconstants.cpp
new file mode 100755
index 0000000000..01f4a080b0
--- /dev/null
+++ b/indra/llmessage/llhttpconstants.cpp
@@ -0,0 +1,228 @@
+/**
+ * @file llhttpconstants.cpp
+ * @brief Implementation of the HTTP request / response constant lookups
+ *
+ * $LicenseInfo:firstyear=2013&license=viewerlgpl$
+ *
+ * Copyright (c) 2013, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * Copyright (C) 2013, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+#include "llhttpconstants.h"
+#include "lltimer.h"
+
+// for curl_getdate() (apparently parsing RFC 1123 dates is hard)
+#include <curl/curl.h>
+
+// Outgoing headers. Do *not* use these to check incoming headers.
+// For incoming headers, use the lower-case headers, below.
+const std::string HTTP_OUT_HEADER_ACCEPT("Accept");
+const std::string HTTP_OUT_HEADER_ACCEPT_CHARSET("Accept-Charset");
+const std::string HTTP_OUT_HEADER_ACCEPT_ENCODING("Accept-Encoding");
+const std::string HTTP_OUT_HEADER_ACCEPT_LANGUAGE("Accept-Language");
+const std::string HTTP_OUT_HEADER_ACCEPT_RANGES("Accept-Ranges");
+const std::string HTTP_OUT_HEADER_AGE("Age");
+const std::string HTTP_OUT_HEADER_ALLOW("Allow");
+const std::string HTTP_OUT_HEADER_AUTHORIZATION("Authorization");
+const std::string HTTP_OUT_HEADER_CACHE_CONTROL("Cache-Control");
+const std::string HTTP_OUT_HEADER_CONNECTION("Connection");
+const std::string HTTP_OUT_HEADER_CONTENT_DESCRIPTION("Content-Description");
+const std::string HTTP_OUT_HEADER_CONTENT_ENCODING("Content-Encoding");
+const std::string HTTP_OUT_HEADER_CONTENT_ID("Content-ID");
+const std::string HTTP_OUT_HEADER_CONTENT_LANGUAGE("Content-Language");
+const std::string HTTP_OUT_HEADER_CONTENT_LENGTH("Content-Length");
+const std::string HTTP_OUT_HEADER_CONTENT_LOCATION("Content-Location");
+const std::string HTTP_OUT_HEADER_CONTENT_MD5("Content-MD5");
+const std::string HTTP_OUT_HEADER_CONTENT_RANGE("Content-Range");
+const std::string HTTP_OUT_HEADER_CONTENT_TRANSFER_ENCODING("Content-Transfer-Encoding");
+const std::string HTTP_OUT_HEADER_CONTENT_TYPE("Content-Type");
+const std::string HTTP_OUT_HEADER_COOKIE("Cookie");
+const std::string HTTP_OUT_HEADER_DATE("Date");
+const std::string HTTP_OUT_HEADER_DESTINATION("Destination");
+const std::string HTTP_OUT_HEADER_ETAG("ETag");
+const std::string HTTP_OUT_HEADER_EXPECT("Expect");
+const std::string HTTP_OUT_HEADER_EXPIRES("Expires");
+const std::string HTTP_OUT_HEADER_FROM("From");
+const std::string HTTP_OUT_HEADER_HOST("Host");
+const std::string HTTP_OUT_HEADER_IF_MATCH("If-Match");
+const std::string HTTP_OUT_HEADER_IF_MODIFIED_SINCE("If-Modified-Since");
+const std::string HTTP_OUT_HEADER_IF_NONE_MATCH("If-None-Match");
+const std::string HTTP_OUT_HEADER_IF_RANGE("If-Range");
+const std::string HTTP_OUT_HEADER_IF_UNMODIFIED_SINCE("If-Unmodified-Since");
+const std::string HTTP_OUT_HEADER_KEEP_ALIVE("Keep-Alive");
+const std::string HTTP_OUT_HEADER_LAST_MODIFIED("Last-Modified");
+const std::string HTTP_OUT_HEADER_LOCATION("Location");
+const std::string HTTP_OUT_HEADER_MAX_FORWARDS("Max-Forwards");
+const std::string HTTP_OUT_HEADER_MIME_VERSION("MIME-Version");
+const std::string HTTP_OUT_HEADER_PRAGMA("Pragma");
+const std::string HTTP_OUT_HEADER_PROXY_AUTHENTICATE("Proxy-Authenticate");
+const std::string HTTP_OUT_HEADER_PROXY_AUTHORIZATION("Proxy-Authorization");
+const std::string HTTP_OUT_HEADER_RANGE("Range");
+const std::string HTTP_OUT_HEADER_REFERER("Referer");
+const std::string HTTP_OUT_HEADER_RETRY_AFTER("Retry-After");
+const std::string HTTP_OUT_HEADER_SERVER("Server");
+const std::string HTTP_OUT_HEADER_SET_COOKIE("Set-Cookie");
+const std::string HTTP_OUT_HEADER_TE("TE");
+const std::string HTTP_OUT_HEADER_TRAILER("Trailer");
+const std::string HTTP_OUT_HEADER_TRANSFER_ENCODING("Transfer-Encoding");
+const std::string HTTP_OUT_HEADER_UPGRADE("Upgrade");
+const std::string HTTP_OUT_HEADER_USER_AGENT("User-Agent");
+const std::string HTTP_OUT_HEADER_VARY("Vary");
+const std::string HTTP_OUT_HEADER_VIA("Via");
+const std::string HTTP_OUT_HEADER_WARNING("Warning");
+const std::string HTTP_OUT_HEADER_WWW_AUTHENTICATE("WWW-Authenticate");
+
+// Incoming headers are normalized to lower-case.
+const std::string HTTP_IN_HEADER_ACCEPT_LANGUAGE("accept-language");
+const std::string HTTP_IN_HEADER_CACHE_CONTROL("cache-control");
+const std::string HTTP_IN_HEADER_CONTENT_LENGTH("content-length");
+const std::string HTTP_IN_HEADER_CONTENT_LOCATION("content-location");
+const std::string HTTP_IN_HEADER_CONTENT_TYPE("content-type");
+const std::string HTTP_IN_HEADER_HOST("host");
+const std::string HTTP_IN_HEADER_LOCATION("location");
+const std::string HTTP_IN_HEADER_RETRY_AFTER("retry-after");
+const std::string HTTP_IN_HEADER_SET_COOKIE("set-cookie");
+const std::string HTTP_IN_HEADER_USER_AGENT("user-agent");
+const std::string HTTP_IN_HEADER_X_FORWARDED_FOR("x-forwarded-for");
+
+const std::string HTTP_CONTENT_LLSD_XML("application/llsd+xml");
+const std::string HTTP_CONTENT_OCTET_STREAM("application/octet-stream");
+const std::string HTTP_CONTENT_XML("application/xml");
+const std::string HTTP_CONTENT_JSON("application/json");
+const std::string HTTP_CONTENT_TEXT_HTML("text/html");
+const std::string HTTP_CONTENT_TEXT_HTML_UTF8("text/html; charset=utf-8");
+const std::string HTTP_CONTENT_TEXT_PLAIN_UTF8("text/plain; charset=utf-8");
+const std::string HTTP_CONTENT_TEXT_LLSD("text/llsd");
+const std::string HTTP_CONTENT_TEXT_XML("text/xml");
+const std::string HTTP_CONTENT_TEXT_LSL("text/lsl");
+const std::string HTTP_CONTENT_TEXT_PLAIN("text/plain");
+const std::string HTTP_CONTENT_IMAGE_X_J2C("image/x-j2c");
+const std::string HTTP_CONTENT_IMAGE_J2C("image/j2c");
+const std::string HTTP_CONTENT_IMAGE_JPEG("image/jpeg");
+const std::string HTTP_CONTENT_IMAGE_PNG("image/png");
+const std::string HTTP_CONTENT_IMAGE_BMP("image/bmp");
+
+const std::string HTTP_NO_CACHE("no-cache");
+const std::string HTTP_NO_CACHE_CONTROL("no-cache, max-age=0");
+
+const std::string HTTP_VERB_INVALID("(invalid)");
+const std::string HTTP_VERB_HEAD("HEAD");
+const std::string HTTP_VERB_GET("GET");
+const std::string HTTP_VERB_PUT("PUT");
+const std::string HTTP_VERB_POST("POST");
+const std::string HTTP_VERB_DELETE("DELETE");
+const std::string HTTP_VERB_MOVE("MOVE");
+const std::string HTTP_VERB_OPTIONS("OPTIONS");
+const std::string HTTP_VERB_PATCH("PATCH");
+const std::string HTTP_VERB_COPY("COPY");
+
+const std::string& httpMethodAsVerb(EHTTPMethod method)
+{
+ static const std::string VERBS[] =
+ {
+ HTTP_VERB_INVALID,
+ HTTP_VERB_HEAD,
+ HTTP_VERB_GET,
+ HTTP_VERB_PUT,
+ HTTP_VERB_POST,
+ HTTP_VERB_DELETE,
+ HTTP_VERB_MOVE,
+ HTTP_VERB_OPTIONS,
+ HTTP_VERB_PATCH,
+ HTTP_VERB_COPY
+ };
+ if(((S32)method <=0) || ((S32)method >= HTTP_METHOD_COUNT))
+ {
+ return VERBS[0];
+ }
+ return VERBS[method];
+}
+
+bool isHttpInformationalStatus(S32 status)
+{
+ // Check for status 1xx.
+ return((100 <= status) && (status < 200));
+}
+
+bool isHttpGoodStatus(S32 status)
+{
+ // Check for status 2xx.
+ return((200 <= status) && (status < 300));
+}
+
+bool isHttpRedirectStatus(S32 status)
+{
+ // Check for status 3xx.
+ return((300 <= status) && (status < 400));
+}
+
+bool isHttpClientErrorStatus(S32 status)
+{
+ // Status 499 is sometimes used for re-interpreted status 2xx errors
+ // based on body content. Treat these as potentially retryable 'server' status errors,
+ // since we do not have enough context to know if this will always fail.
+ if (HTTP_INTERNAL_ERROR == status) return false;
+
+ // Check for status 5xx.
+ return((400 <= status) && (status < 500));
+}
+
+bool isHttpServerErrorStatus(S32 status)
+{
+ // Status 499 is sometimes used for re-interpreted status 2xx errors.
+ // Allow retry of these, since we don't have enough information in this
+ // context to know if this will always fail.
+ if (HTTP_INTERNAL_ERROR == status) return true;
+
+ // Check for status 5xx.
+ return((500 <= status) && (status < 600));
+}
+
+// Parses 'Retry-After' header contents and returns seconds until retry should occur.
+bool getSecondsUntilRetryAfter(const std::string& retry_after, F32& seconds_to_wait)
+{
+ // *TODO: This needs testing! Not in use yet.
+ // Examples of Retry-After headers:
+ // Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
+ // Retry-After: 120
+
+ // Check for number of seconds version, first:
+ char* end = 0;
+ // Parse as double
+ double seconds = std::strtod(retry_after.c_str(), &end);
+ if ( end != 0 && *end == 0 )
+ {
+ // Successful parse
+ seconds_to_wait = (F32) seconds;
+ return true;
+ }
+
+ // Parse rfc1123 date.
+ time_t date = curl_getdate(retry_after.c_str(), NULL );
+ if (-1 == date) return false;
+
+ seconds_to_wait = (F64)date - LLTimer::getTotalSeconds();
+
+ return true;
+}
+
diff --git a/indra/llmessage/llhttpconstants.h b/indra/llmessage/llhttpconstants.h
new file mode 100755
index 0000000000..4aa3cc6394
--- /dev/null
+++ b/indra/llmessage/llhttpconstants.h
@@ -0,0 +1,225 @@
+/**
+ * @file llhttpconstants.h
+ * @brief Constants for HTTP requests and responses
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2001-2013, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_HTTP_CONSTANTS_H
+#define LL_HTTP_CONSTANTS_H
+
+#include "stdtypes.h"
+
+/////// HTTP STATUS CODES ///////
+
+// Standard errors from HTTP spec:
+// http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1
+const S32 HTTP_CONTINUE = 100;
+const S32 HTTP_SWITCHING_PROTOCOLS = 101;
+
+// Success
+const S32 HTTP_OK = 200;
+const S32 HTTP_CREATED = 201;
+const S32 HTTP_ACCEPTED = 202;
+const S32 HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
+const S32 HTTP_NO_CONTENT = 204;
+const S32 HTTP_RESET_CONTENT = 205;
+const S32 HTTP_PARTIAL_CONTENT = 206;
+
+// Redirection
+const S32 HTTP_MULTIPLE_CHOICES = 300;
+const S32 HTTP_MOVED_PERMANENTLY = 301;
+const S32 HTTP_FOUND = 302;
+const S32 HTTP_SEE_OTHER = 303;
+const S32 HTTP_NOT_MODIFIED = 304;
+const S32 HTTP_USE_PROXY = 305;
+const S32 HTTP_TEMPORARY_REDIRECT = 307;
+
+// Client Error
+const S32 HTTP_BAD_REQUEST = 400;
+const S32 HTTP_UNAUTHORIZED = 401;
+const S32 HTTP_PAYMENT_REQUIRED = 402;
+const S32 HTTP_FORBIDDEN = 403;
+const S32 HTTP_NOT_FOUND = 404;
+const S32 HTTP_METHOD_NOT_ALLOWED = 405;
+const S32 HTTP_NOT_ACCEPTABLE = 406;
+const S32 HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
+const S32 HTTP_REQUEST_TIME_OUT = 408;
+const S32 HTTP_CONFLICT = 409;
+const S32 HTTP_GONE = 410;
+const S32 HTTP_LENGTH_REQUIRED = 411;
+const S32 HTTP_PRECONDITION_FAILED = 412;
+const S32 HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
+const S32 HTTP_REQUEST_URI_TOO_LARGE = 414;
+const S32 HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
+const S32 HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+const S32 HTTP_EXPECTATION_FAILED = 417;
+
+// Server Error
+const S32 HTTP_INTERNAL_SERVER_ERROR = 500;
+const S32 HTTP_NOT_IMPLEMENTED = 501;
+const S32 HTTP_BAD_GATEWAY = 502;
+const S32 HTTP_SERVICE_UNAVAILABLE = 503;
+const S32 HTTP_GATEWAY_TIME_OUT = 504;
+const S32 HTTP_VERSION_NOT_SUPPORTED = 505;
+
+// We combine internal process errors with status codes
+// These status codes should not be sent over the wire
+// and indicate something went wrong internally.
+// If you get these they are not normal.
+const S32 HTTP_INTERNAL_CURL_ERROR = 498;
+const S32 HTTP_INTERNAL_ERROR = 499;
+
+
+////// HTTP Methods //////
+
+extern const std::string HTTP_VERB_INVALID;
+extern const std::string HTTP_VERB_HEAD;
+extern const std::string HTTP_VERB_GET;
+extern const std::string HTTP_VERB_PUT;
+extern const std::string HTTP_VERB_POST;
+extern const std::string HTTP_VERB_DELETE;
+extern const std::string HTTP_VERB_MOVE;
+extern const std::string HTTP_VERB_OPTIONS;
+
+enum EHTTPMethod
+{
+ HTTP_INVALID = 0,
+ HTTP_HEAD,
+ HTTP_GET,
+ HTTP_PUT,
+ HTTP_POST,
+ HTTP_DELETE,
+ HTTP_MOVE, // Caller will need to set 'Destination' header
+ HTTP_OPTIONS,
+ HTTP_PATCH,
+ HTTP_COPY,
+ HTTP_METHOD_COUNT
+};
+
+const std::string& httpMethodAsVerb(EHTTPMethod method);
+bool isHttpInformationalStatus(S32 status);
+bool isHttpGoodStatus(S32 status);
+bool isHttpRedirectStatus(S32 status);
+bool isHttpClientErrorStatus(S32 status);
+bool isHttpServerErrorStatus(S32 status);
+
+// Parses 'Retry-After' header contents and returns seconds until retry should occur.
+bool getSecondsUntilRetryAfter(const std::string& retry_after, F32& seconds_to_wait);
+
+//// HTTP Headers /////
+
+// Outgoing headers. Do *not* use these to check incoming headers.
+// For incoming headers, use the lower-case headers, below.
+extern const std::string HTTP_OUT_HEADER_ACCEPT;
+extern const std::string HTTP_OUT_HEADER_ACCEPT_CHARSET;
+extern const std::string HTTP_OUT_HEADER_ACCEPT_ENCODING;
+extern const std::string HTTP_OUT_HEADER_ACCEPT_LANGUAGE;
+extern const std::string HTTP_OUT_HEADER_ACCEPT_RANGES;
+extern const std::string HTTP_OUT_HEADER_AGE;
+extern const std::string HTTP_OUT_HEADER_ALLOW;
+extern const std::string HTTP_OUT_HEADER_AUTHORIZATION;
+extern const std::string HTTP_OUT_HEADER_CACHE_CONTROL;
+extern const std::string HTTP_OUT_HEADER_CONNECTION;
+extern const std::string HTTP_OUT_HEADER_CONTENT_DESCRIPTION;
+extern const std::string HTTP_OUT_HEADER_CONTENT_ENCODING;
+extern const std::string HTTP_OUT_HEADER_CONTENT_ID;
+extern const std::string HTTP_OUT_HEADER_CONTENT_LANGUAGE;
+extern const std::string HTTP_OUT_HEADER_CONTENT_LENGTH;
+extern const std::string HTTP_OUT_HEADER_CONTENT_LOCATION;
+extern const std::string HTTP_OUT_HEADER_CONTENT_MD5;
+extern const std::string HTTP_OUT_HEADER_CONTENT_RANGE;
+extern const std::string HTTP_OUT_HEADER_CONTENT_TRANSFER_ENCODING;
+extern const std::string HTTP_OUT_HEADER_CONTENT_TYPE;
+extern const std::string HTTP_OUT_HEADER_COOKIE;
+extern const std::string HTTP_OUT_HEADER_DATE;
+extern const std::string HTTP_OUT_HEADER_DESTINATION;
+extern const std::string HTTP_OUT_HEADER_ETAG;
+extern const std::string HTTP_OUT_HEADER_EXPECT;
+extern const std::string HTTP_OUT_HEADER_EXPIRES;
+extern const std::string HTTP_OUT_HEADER_FROM;
+extern const std::string HTTP_OUT_HEADER_HOST;
+extern const std::string HTTP_OUT_HEADER_IF_MATCH;
+extern const std::string HTTP_OUT_HEADER_IF_MODIFIED_SINCE;
+extern const std::string HTTP_OUT_HEADER_IF_NONE_MATCH;
+extern const std::string HTTP_OUT_HEADER_IF_RANGE;
+extern const std::string HTTP_OUT_HEADER_IF_UNMODIFIED_SINCE;
+extern const std::string HTTP_OUT_HEADER_KEEP_ALIVE;
+extern const std::string HTTP_OUT_HEADER_LAST_MODIFIED;
+extern const std::string HTTP_OUT_HEADER_LOCATION;
+extern const std::string HTTP_OUT_HEADER_MAX_FORWARDS;
+extern const std::string HTTP_OUT_HEADER_MIME_VERSION;
+extern const std::string HTTP_OUT_HEADER_PRAGMA;
+extern const std::string HTTP_OUT_HEADER_PROXY_AUTHENTICATE;
+extern const std::string HTTP_OUT_HEADER_PROXY_AUTHORIZATION;
+extern const std::string HTTP_OUT_HEADER_RANGE;
+extern const std::string HTTP_OUT_HEADER_REFERER;
+extern const std::string HTTP_OUT_HEADER_RETRY_AFTER;
+extern const std::string HTTP_OUT_HEADER_SERVER;
+extern const std::string HTTP_OUT_HEADER_SET_COOKIE;
+extern const std::string HTTP_OUT_HEADER_TE;
+extern const std::string HTTP_OUT_HEADER_TRAILER;
+extern const std::string HTTP_OUT_HEADER_TRANSFER_ENCODING;
+extern const std::string HTTP_OUT_HEADER_UPGRADE;
+extern const std::string HTTP_OUT_HEADER_USER_AGENT;
+extern const std::string HTTP_OUT_HEADER_VARY;
+extern const std::string HTTP_OUT_HEADER_VIA;
+extern const std::string HTTP_OUT_HEADER_WARNING;
+extern const std::string HTTP_OUT_HEADER_WWW_AUTHENTICATE;
+
+// Incoming headers are normalized to lower-case.
+extern const std::string HTTP_IN_HEADER_ACCEPT_LANGUAGE;
+extern const std::string HTTP_IN_HEADER_CACHE_CONTROL;
+extern const std::string HTTP_IN_HEADER_CONTENT_LENGTH;
+extern const std::string HTTP_IN_HEADER_CONTENT_LOCATION;
+extern const std::string HTTP_IN_HEADER_CONTENT_TYPE;
+extern const std::string HTTP_IN_HEADER_HOST;
+extern const std::string HTTP_IN_HEADER_LOCATION;
+extern const std::string HTTP_IN_HEADER_RETRY_AFTER;
+extern const std::string HTTP_IN_HEADER_SET_COOKIE;
+extern const std::string HTTP_IN_HEADER_USER_AGENT;
+extern const std::string HTTP_IN_HEADER_X_FORWARDED_FOR;
+
+//// HTTP Content Types ////
+
+extern const std::string HTTP_CONTENT_LLSD_XML;
+extern const std::string HTTP_CONTENT_OCTET_STREAM;
+extern const std::string HTTP_CONTENT_XML;
+extern const std::string HTTP_CONTENT_JSON;
+extern const std::string HTTP_CONTENT_TEXT_HTML;
+extern const std::string HTTP_CONTENT_TEXT_HTML_UTF8;
+extern const std::string HTTP_CONTENT_TEXT_PLAIN_UTF8;
+extern const std::string HTTP_CONTENT_TEXT_LLSD;
+extern const std::string HTTP_CONTENT_TEXT_XML;
+extern const std::string HTTP_CONTENT_TEXT_LSL;
+extern const std::string HTTP_CONTENT_TEXT_PLAIN;
+extern const std::string HTTP_CONTENT_IMAGE_X_J2C;
+extern const std::string HTTP_CONTENT_IMAGE_J2C;
+extern const std::string HTTP_CONTENT_IMAGE_JPEG;
+extern const std::string HTTP_CONTENT_IMAGE_PNG;
+extern const std::string HTTP_CONTENT_IMAGE_BMP;
+
+//// HTTP Cache Settings ////
+extern const std::string HTTP_NO_CACHE;
+extern const std::string HTTP_NO_CACHE_CONTROL;
+
+#endif
diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp
index f6ccb5bdda..f235965879 100755
--- a/indra/llmessage/llhttpnode.cpp
+++ b/indra/llmessage/llhttpnode.cpp
@@ -30,9 +30,15 @@
#include <boost/tokenizer.hpp>
#include "llstl.h"
-#include "lliohttpserver.h" // for string constants
+#include "llhttpconstants.h"
-static const std::string CONTEXT_WILDCARD("wildcard");
+const std::string CONTEXT_HEADERS("headers");
+const std::string CONTEXT_PATH("path");
+const std::string CONTEXT_QUERY_STRING("query-string");
+const std::string CONTEXT_REQUEST("request");
+const std::string CONTEXT_RESPONSE("response");
+const std::string CONTEXT_VERB("verb");
+const std::string CONTEXT_WILDCARD("wildcard");
/**
* LLHTTPNode
@@ -172,22 +178,24 @@ LLSD LLHTTPNode::simpleDel(const LLSD&) const
// virtual
void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const
{
- //llinfos << "options context: " << context << llendl;
+ //LL_INFOS() << "options context: " << context << LL_ENDL;
+ LL_DEBUGS("LLHTTPNode") << "context: " << context << LL_ENDL;
// default implementation constructs an url to the documentation.
+ // *TODO: Check for 'Host' header instead of 'host' header?
std::string host(
- context[CONTEXT_REQUEST][CONTEXT_HEADERS]["host"].asString());
+ context[CONTEXT_REQUEST][CONTEXT_HEADERS][HTTP_IN_HEADER_HOST].asString());
if(host.empty())
{
- response->status(400, "Bad Request -- need Host header");
+ response->status(HTTP_BAD_REQUEST, "Bad Request -- need Host header");
return;
}
std::ostringstream ostr;
ostr << "http://" << host << "/web/server/api";
- ostr << context[CONTEXT_REQUEST]["path"].asString();
+ ostr << context[CONTEXT_REQUEST][CONTEXT_PATH].asString();
static const std::string DOC_HEADER("X-Documentation-URL");
response->addHeader(DOC_HEADER, ostr.str());
- response->status(200, "OK");
+ response->status(HTTP_OK, "OK");
}
@@ -238,10 +246,10 @@ const LLHTTPNode* LLHTTPNode::traverse(
LLHTTPNode* child = node->getChild(*iter, context);
if(!child)
{
- lldebugs << "LLHTTPNode::traverse: Couldn't find '" << *iter << "'" << llendl;
+ LL_DEBUGS() << "LLHTTPNode::traverse: Couldn't find '" << *iter << "'" << LL_ENDL;
break;
}
- lldebugs << "LLHTTPNode::traverse: Found '" << *iter << "'" << llendl;
+ LL_DEBUGS() << "LLHTTPNode::traverse: Found '" << *iter << "'" << LL_ENDL;
node = child;
}
@@ -275,8 +283,8 @@ void LLHTTPNode::addNode(const std::string& path, LLHTTPNode* nodeToAdd)
if (iter == end)
{
- llwarns << "LLHTTPNode::addNode: already a node that handles "
- << path << llendl;
+ LL_WARNS() << "LLHTTPNode::addNode: already a node that handles "
+ << path << LL_ENDL;
return;
}
@@ -389,17 +397,17 @@ void LLHTTPNode::Response::statusUnknownError(S32 code)
void LLHTTPNode::Response::notFound(const std::string& message)
{
- status(404, message);
+ status(HTTP_NOT_FOUND, message);
}
void LLHTTPNode::Response::notFound()
{
- status(404, "Not Found");
+ status(HTTP_NOT_FOUND, "Not Found");
}
void LLHTTPNode::Response::methodNotAllowed()
{
- status(405, "Method Not Allowed");
+ status(HTTP_METHOD_NOT_ALLOWED, "Method Not Allowed");
}
void LLHTTPNode::Response::addHeader(
@@ -467,7 +475,7 @@ LLSimpleResponse::~LLSimpleResponse()
void LLSimpleResponse::result(const LLSD& result)
{
- status(200, "OK");
+ status(HTTP_OK, "OK");
}
void LLSimpleResponse::extendedResult(S32 code, const std::string& body, const LLSD& headers)
@@ -475,6 +483,11 @@ void LLSimpleResponse::extendedResult(S32 code, const std::string& body, const L
status(code,body);
}
+void LLSimpleResponse::extendedResult(S32 code, const LLSD& r, const LLSD& headers)
+{
+ status(code,"(LLSD)");
+}
+
void LLSimpleResponse::status(S32 code, const std::string& message)
{
mCode = code;
diff --git a/indra/llmessage/llhttpnode.h b/indra/llmessage/llhttpnode.h
index 148647ddde..1144d88be1 100755
--- a/indra/llmessage/llhttpnode.h
+++ b/indra/llmessage/llhttpnode.h
@@ -31,6 +31,17 @@
#include "llrefcount.h"
#include "llsd.h"
+// common strings use for populating the context. basically 'request',
+// 'wildcard', and 'headers'.
+extern const std::string CONTEXT_HEADERS;
+extern const std::string CONTEXT_PATH;
+extern const std::string CONTEXT_QUERY_STRING;
+extern const std::string CONTEXT_REQUEST;
+extern const std::string CONTEXT_RESPONSE;
+extern const std::string CONTEXT_VERB;
+extern const std::string CONTEXT_WILDCARD;
+
+
class LLChainIOFactory;
/**
@@ -60,6 +71,8 @@ class LLChainIOFactory;
*/
class LLHTTPNode
{
+protected:
+ LOG_CLASS(LLHTTPNode);
public:
LLHTTPNode();
virtual ~LLHTTPNode();
@@ -100,7 +113,12 @@ public:
/**
* @brief return status code and message with headers.
*/
- virtual void extendedResult(S32 code, const std::string& message, const LLSD& headers) = 0;
+ virtual void extendedResult(S32 code, const std::string& message, const LLSD& headers = LLSD()) = 0;
+
+ /**
+ * @brief return status code and LLSD result with headers.
+ */
+ virtual void extendedResult(S32 code, const LLSD& result, const LLSD& headers = LLSD()) = 0;
/**
* @brief return status code and reason string on http header,
@@ -118,7 +136,7 @@ public:
virtual void methodNotAllowed();
/**
- * @breif Add a name: value http header.
+ * @brief Add a name: value http header.
*
* No effort is made to ensure the response is a valid http
* header.
@@ -187,15 +205,15 @@ public:
name, and return true if the name will construct to a valid url.
For convenience, the <code>getChild()</code> method above will
automatically insert the name in
- context["request"]["wildcard"][key] if this method returns true.
+ context[CONTEXT_REQUEST][CONTEXT_WILDCARD][key] if this method returns true.
For example, the node "agent/<agent_id>/detail" will set
- context["request"]["wildcard"]["agent_id"] eqaul to the value
+ context[CONTEXT_REQUEST][CONTEXT_WILDCARD]["agent_id"] eqaul to the value
found during traversal.
*/
const LLHTTPNode* traverse(const std::string& path, LLSD& context) const;
/**< find a node, if any, that can service this path
- set up context["request"] information
+ set up context[CONTEXT_REQUEST] information
*/
//@}
@@ -287,7 +305,7 @@ public:
void result(const LLSD& result);
void extendedResult(S32 code, const std::string& body, const LLSD& headers);
-
+ void extendedResult(S32 code, const LLSD& result, const LLSD& headers);
void status(S32 code, const std::string& message);
void print(std::ostream& out) const;
diff --git a/indra/llmessage/llhttpsender.cpp b/indra/llmessage/llhttpsender.cpp
index d0bd343db6..5363088d79 100755
--- a/indra/llmessage/llhttpsender.cpp
+++ b/indra/llmessage/llhttpsender.cpp
@@ -54,14 +54,14 @@ void LLHTTPSender::send(const LLHost& host, const std::string& name,
// Default implementation inserts sender, message and sends HTTP POST
std::ostringstream stream;
stream << "http://" << host << "/trusted-message/" << name;
- llinfos << "LLHTTPSender::send: POST to " << stream.str() << llendl;
+ LL_INFOS() << "LLHTTPSender::send: POST to " << stream.str() << LL_ENDL;
LLHTTPClient::post(stream.str(), body, response);
}
//static
void LLHTTPSender::setSender(const LLHost& host, LLHTTPSender* sender)
{
- llinfos << "LLHTTPSender::setSender " << host << llendl;
+ LL_INFOS() << "LLHTTPSender::setSender " << host << LL_ENDL;
senderMap[host] = sender;
}
diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp
index b0275c161b..b7f3e6e4f7 100755
--- a/indra/llmessage/llinstantmessage.cpp
+++ b/indra/llmessage/llinstantmessage.cpp
@@ -111,7 +111,7 @@ LLIMInfo::~LLIMInfo()
void LLIMInfo::packInstantMessage(LLMessageSystem* msg) const
{
- lldebugs << "LLIMInfo::packInstantMessage()" << llendl;
+ LL_DEBUGS() << "LLIMInfo::packInstantMessage()" << LL_ENDL;
msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
packMessageBlock(msg);
}
@@ -161,7 +161,7 @@ void pack_instant_message(
const U8* binary_bucket,
S32 binary_bucket_size)
{
- lldebugs << "pack_instant_message()" << llendl;
+ LL_DEBUGS() << "pack_instant_message()" << LL_ENDL;
msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
pack_instant_message_block(
msg,
@@ -228,7 +228,7 @@ void pack_instant_message_block(
if (num_written < 0 || num_written >= MTUBYTES)
{
num_written = MTUBYTES - 1;
- llwarns << "pack_instant_message_block: message truncated: " << message << llendl;
+ LL_WARNS() << "pack_instant_message_block: message truncated: " << message << LL_ENDL;
}
bytes_left -= num_written;
diff --git a/indra/llmessage/lliobuffer.cpp b/indra/llmessage/lliobuffer.cpp
index ed00e230ac..bbd7b8777d 100755
--- a/indra/llmessage/lliobuffer.cpp
+++ b/indra/llmessage/lliobuffer.cpp
@@ -109,6 +109,6 @@ LLIOPipe::EStatus LLIOBuffer::process_impl(
LLPumpIO* pump)
{
// no-op (I think)
- llwarns << "You are using an LLIOBuffer which is deprecated." << llendl;
+ LL_WARNS() << "You are using an LLIOBuffer which is deprecated." << LL_ENDL;
return STATUS_OK;
}
diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp
index 1236fc8b71..d9042fa8b0 100755
--- a/indra/llmessage/lliohttpserver.cpp
+++ b/indra/llmessage/lliohttpserver.cpp
@@ -33,6 +33,8 @@
#include "llapr.h"
#include "llbuffer.h"
#include "llbufferstream.h"
+#include "llhttpconstants.h"
+#include "llfasttimer.h"
#include "llhttpnode.h"
#include "lliopipe.h"
#include "lliosocket.h"
@@ -49,15 +51,6 @@
#include <boost/tokenizer.hpp>
static const char HTTP_VERSION_STR[] = "HTTP/1.0";
-const std::string CONTEXT_REQUEST("request");
-const std::string CONTEXT_RESPONSE("response");
-const std::string CONTEXT_VERB("verb");
-const std::string CONTEXT_HEADERS("headers");
-const std::string HTTP_VERB_GET("GET");
-const std::string HTTP_VERB_PUT("PUT");
-const std::string HTTP_VERB_POST("POST");
-const std::string HTTP_VERB_DELETE("DELETE");
-const std::string HTTP_VERB_OPTIONS("OPTIONS");
static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL;
static void* sTimingCallbackData = NULL;
@@ -102,7 +95,7 @@ private:
// from LLHTTPNode::Response
virtual void result(const LLSD&);
virtual void extendedResult(S32 code, const std::string& body, const LLSD& headers);
-
+ virtual void extendedResult(S32 code, const LLSD& body, const LLSD& headers);
virtual void status(S32 code, const std::string& message);
void nullPipe();
@@ -122,7 +115,8 @@ private:
STATE_LOCKED,
STATE_GOOD_RESULT,
STATE_STATUS_RESULT,
- STATE_EXTENDED_RESULT
+ STATE_EXTENDED_RESULT,
+ STATE_EXTENDED_LLSD_RESULT
};
State mState;
@@ -132,17 +126,17 @@ private:
void lockChain(LLPumpIO*);
void unlockChain();
- LLSD mGoodResult;
+ LLSD mResult;
S32 mStatusCode;
std::string mStatusMessage;
LLSD mHeaders;
};
-static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_PIPE("HTTP Pipe");
-static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_GET("HTTP Get");
-static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_PUT("HTTP Put");
-static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_POST("HTTP Post");
-static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_DELETE("HTTP Delete");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_PIPE("HTTP Pipe");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_GET("HTTP Get");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_PUT("HTTP Put");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_POST("HTTP Post");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_DELETE("HTTP Delete");
LLIOPipe::EStatus LLHTTPPipe::process_impl(
const LLChannelDescriptors& channels,
@@ -151,9 +145,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_HTTP_PIPE);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_PIPE);
PUMP_DEBUG;
- lldebugs << "LLSDHTTPServer::process_impl" << llendl;
+ LL_DEBUGS() << "LLSDHTTPServer::process_impl" << LL_ENDL;
// Once we have all the data, We need to read the sd on
// the the in channel, and respond on the out channel
@@ -180,12 +174,12 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB];
if(verb == HTTP_VERB_GET)
{
- LLFastTimer _(FTM_PROCESS_HTTP_GET);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_GET);
mNode.get(LLHTTPNode::ResponsePtr(mResponse), context);
}
else if(verb == HTTP_VERB_PUT)
{
- LLFastTimer _(FTM_PROCESS_HTTP_PUT);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_PUT);
LLSD input;
if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD)
{
@@ -193,7 +187,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
}
else if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_TEXT)
{
- std::stringstream strstrm;
+ std::ostringstream strstrm;
strstrm << istr.rdbuf();
input = strstrm.str();
}
@@ -201,7 +195,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
}
else if(verb == HTTP_VERB_POST)
{
- LLFastTimer _(FTM_PROCESS_HTTP_POST);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_POST);
LLSD input;
if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD)
{
@@ -209,7 +203,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
}
else if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_TEXT)
{
- std::stringstream strstrm;
+ std::ostringstream strstrm;
strstrm << istr.rdbuf();
input = strstrm.str();
}
@@ -217,7 +211,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
}
else if(verb == HTTP_VERB_DELETE)
{
- LLFastTimer _(FTM_PROCESS_HTTP_DELETE);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_DELETE);
mNode.del(LLHTTPNode::ResponsePtr(mResponse), context);
}
else if(verb == HTTP_VERB_OPTIONS)
@@ -244,15 +238,15 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
// Log all HTTP transactions.
// TODO: Add a way to log these to their own file instead of indra.log
// It is just too spammy to be in indra.log.
- lldebugs << verb << " " << context[CONTEXT_REQUEST]["path"].asString()
+ LL_DEBUGS() << verb << " " << context[CONTEXT_REQUEST][CONTEXT_PATH].asString()
<< " " << mStatusCode << " " << mStatusMessage << " " << delta
- << "s" << llendl;
+ << "s" << LL_ENDL;
// Log Internal Server Errors
- //if(mStatusCode == 500)
+ //if(mStatusCode == HTTP_INTERNAL_SERVER_ERROR)
//{
- // llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error"
- // << llendl;
+ // LL_WARNS() << "LLHTTPPipe::process_impl:500:Internal Server Error"
+ // << LL_ENDL;
//}
}
@@ -271,10 +265,10 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
case STATE_GOOD_RESULT:
{
LLSD headers = mHeaders;
- headers["Content-Type"] = "application/llsd+xml";
+ headers[HTTP_OUT_HEADER_CONTENT_TYPE] = HTTP_CONTENT_LLSD_XML;
context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers;
LLBufferStream ostr(channels, buffer.get());
- LLSDSerialize::toXML(mGoodResult, ostr);
+ LLSDSerialize::toXML(mResult, ostr);
return STATUS_DONE;
}
@@ -282,7 +276,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
case STATE_STATUS_RESULT:
{
LLSD headers = mHeaders;
- headers["Content-Type"] = "text/plain";
+ headers[HTTP_OUT_HEADER_CONTENT_TYPE] = HTTP_CONTENT_TEXT_PLAIN;
context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers;
context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode;
context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage;
@@ -300,9 +294,20 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
return STATUS_DONE;
}
+ case STATE_EXTENDED_LLSD_RESULT:
+ {
+ LLSD headers = mHeaders;
+ headers[HTTP_OUT_HEADER_CONTENT_TYPE] = HTTP_CONTENT_LLSD_XML;
+ context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers;
+ context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode;
+ LLBufferStream ostr(channels, buffer.get());
+ LLSDSerialize::toXML(mResult, ostr);
+
+ return STATUS_DONE;
+ }
default:
- llwarns << "LLHTTPPipe::process_impl: unexpected state "
- << mState << llendl;
+ LL_WARNS() << "LLHTTPPipe::process_impl: unexpected state "
+ << mState << LL_ENDL;
return STATUS_BREAK;
}
@@ -331,23 +336,39 @@ void LLHTTPPipe::Response::result(const LLSD& r)
{
if(! mPipe)
{
- llwarns << "LLHTTPPipe::Response::result: NULL pipe" << llendl;
+ LL_WARNS() << "LLHTTPPipe::Response::result: NULL pipe" << LL_ENDL;
return;
}
- mPipe->mStatusCode = 200;
+ mPipe->mStatusCode = HTTP_OK;
mPipe->mStatusMessage = "OK";
- mPipe->mGoodResult = r;
+ mPipe->mResult = r;
mPipe->mState = STATE_GOOD_RESULT;
mPipe->mHeaders = mHeaders;
- mPipe->unlockChain();
+ mPipe->unlockChain();
+}
+
+void LLHTTPPipe::Response::extendedResult(S32 code, const LLSD& r, const LLSD& headers)
+{
+ if(! mPipe)
+ {
+ LL_WARNS() << "LLHTTPPipe::Response::extendedResult: NULL pipe" << LL_ENDL;
+ return;
+ }
+
+ mPipe->mStatusCode = code;
+ mPipe->mStatusMessage = "(LLSD)";
+ mPipe->mResult = r;
+ mPipe->mHeaders = headers;
+ mPipe->mState = STATE_EXTENDED_LLSD_RESULT;
+ mPipe->unlockChain();
}
void LLHTTPPipe::Response::extendedResult(S32 code, const std::string& body, const LLSD& headers)
{
if(! mPipe)
{
- llwarns << "LLHTTPPipe::Response::status: NULL pipe" << llendl;
+ LL_WARNS() << "LLHTTPPipe::Response::status: NULL pipe" << LL_ENDL;
return;
}
@@ -363,7 +384,7 @@ void LLHTTPPipe::Response::status(S32 code, const std::string& message)
{
if(! mPipe)
{
- llwarns << "LLHTTPPipe::Response::status: NULL pipe" << llendl;
+ LL_WARNS() << "LLHTTPPipe::Response::status: NULL pipe" << LL_ENDL;
return;
}
@@ -434,7 +455,7 @@ protected:
* LLHTTPResponseHeader
*/
-static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_HEADER("HTTP Header");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_HEADER("HTTP Header");
// virtual
LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
@@ -444,7 +465,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_HTTP_HEADER);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_HEADER);
PUMP_DEBUG;
if(eos)
{
@@ -454,9 +475,9 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
std::string message = context[CONTEXT_RESPONSE]["statusMessage"];
int code = context[CONTEXT_RESPONSE]["statusCode"];
- if (code < 200)
+ if (code < HTTP_OK)
{
- code = 200;
+ code = HTTP_OK;
message = "OK";
}
@@ -465,7 +486,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
S32 content_length = buffer->countAfter(channels.in(), NULL);
if(0 < content_length)
{
- ostr << "Content-Length: " << content_length << "\r\n";
+ ostr << HTTP_OUT_HEADER_CONTENT_LENGTH << ": " << content_length << "\r\n";
}
// *NOTE: This guard can go away once the LLSD static map
// iterator is available. Phoenix. 2008-05-09
@@ -594,7 +615,7 @@ LLHTTPResponder::LLHTTPResponder(const LLHTTPNode& tree, const LLSD& ctx) :
// virtual
LLHTTPResponder::~LLHTTPResponder()
{
- //lldebugs << "destroying LLHTTPResponder" << llendl;
+ //LL_DEBUGS() << "destroying LLHTTPResponder" << LL_ENDL;
}
bool LLHTTPResponder::readHeaderLine(
@@ -611,7 +632,7 @@ bool LLHTTPResponder::readHeaderLine(
{
if(len)
{
- lldebugs << "readLine failed - too long maybe?" << llendl;
+ LL_DEBUGS() << "readLine failed - too long maybe?" << LL_ENDL;
markBad(channels, buffer);
}
return false;
@@ -634,7 +655,7 @@ void LLHTTPResponder::markBad(
<< "</body>\n</html>\n";
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_RESPONDER("HTTP Responder");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_RESPONDER("HTTP Responder");
// virtual
LLIOPipe::EStatus LLHTTPResponder::process_impl(
@@ -644,7 +665,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_HTTP_RESPONDER);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_RESPONDER);
PUMP_DEBUG;
LLIOPipe::EStatus status = STATUS_OK;
@@ -667,8 +688,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
{
memcpy(buf, (*seg_iter).data(), (*seg_iter).size()); /*Flawfinder: ignore*/
buf[(*seg_iter).size()] = '\0';
- llinfos << (*seg_iter).getChannel() << ": " << buf
- << llendl;
+ LL_INFOS() << (*seg_iter).getChannel() << ": " << buf
+ << LL_ENDL;
++seg_iter;
}
}
@@ -694,10 +715,10 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
header >> mAbsPathAndQuery;
header >> mVersion;
- lldebugs << "http request: "
+ LL_DEBUGS() << "http request: "
<< mVerb
<< " " << mAbsPathAndQuery
- << " " << mVersion << llendl;
+ << " " << mVersion << LL_ENDL;
std::string::size_type delimiter
= mAbsPathAndQuery.find('?');
@@ -727,7 +748,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
{
read_next_line = false;
parse_all = false;
- lldebugs << "unknown http verb: " << mVerb << llendl;
+ LL_DEBUGS() << "unknown http verb: " << mVerb << LL_ENDL;
markBad(channels, buffer);
}
}
@@ -762,7 +783,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
if(NULL == pos_colon)
{
keep_parsing = false;
- lldebugs << "bad header: " << buf << llendl;
+ LL_DEBUGS() << "bad header: " << buf << LL_ENDL;
markBad(channels, buffer);
break;
}
@@ -771,9 +792,9 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
std::string name(buf, pos_colon - buf);
std::string value(pos_colon + 2);
LLStringUtil::toLower(name);
- if("content-length" == name)
+ if(HTTP_IN_HEADER_CONTENT_LENGTH == name)
{
- lldebugs << "Content-Length: " << value << llendl;
+ LL_DEBUGS() << "Content-Length: " << value << LL_ENDL;
mContentLength = atoi(value.c_str());
}
else
@@ -810,8 +831,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
const LLHTTPNode* node = mRootNode.traverse(mPath, context);
if(node)
{
- //llinfos << "LLHTTPResponder::process_impl found node for "
- // << mAbsPathAndQuery << llendl;
+ //LL_INFOS() << "LLHTTPResponder::process_impl found node for "
+ // << mAbsPathAndQuery << LL_ENDL;
// Copy everything after mLast read to the out.
LLBufferArray::segment_iterator_t seg_iter;
@@ -831,8 +852,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
{
memcpy(buf, (*seg_iter).data(), (*seg_iter).size()); /*Flawfinder: ignore*/
buf[(*seg_iter).size()] = '\0';
- llinfos << (*seg_iter).getChannel() << ": " << buf
- << llendl;
+ LL_INFOS() << (*seg_iter).getChannel() << ": " << buf
+ << LL_ENDL;
++seg_iter;
}
#endif
@@ -846,19 +867,19 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
// HTTP headers.
LLPumpIO::chain_t chain;
chain.push_back(LLIOPipe::ptr_t(new LLIOFlush));
- context[CONTEXT_REQUEST]["path"] = mPath;
- context[CONTEXT_REQUEST]["query-string"] = mQuery;
- context[CONTEXT_REQUEST]["remote-host"]
- = mBuildContext["remote-host"];
- context[CONTEXT_REQUEST]["remote-port"]
- = mBuildContext["remote-port"];
+ context[CONTEXT_REQUEST][CONTEXT_PATH] = mPath;
+ context[CONTEXT_REQUEST][CONTEXT_QUERY_STRING] = mQuery;
+ context[CONTEXT_REQUEST][CONTEXT_REMOTE_HOST]
+ = mBuildContext[CONTEXT_REMOTE_HOST];
+ context[CONTEXT_REQUEST][CONTEXT_REMOTE_PORT]
+ = mBuildContext[CONTEXT_REMOTE_PORT];
context[CONTEXT_REQUEST][CONTEXT_HEADERS] = mHeaders;
const LLChainIOFactory* protocolHandler
= node->getProtocolHandler();
if (protocolHandler)
{
- lldebugs << "HTTP context: " << context << llendl;
+ LL_DEBUGS() << "HTTP context: " << context << LL_ENDL;
protocolHandler->build(chain, context);
}
else
@@ -917,8 +938,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
}
else
{
- llwarns << "LLHTTPResponder::process_impl didn't find a node for "
- << mAbsPathAndQuery << llendl;
+ LL_WARNS() << "LLHTTPResponder::process_impl didn't find a node for "
+ << mAbsPathAndQuery << LL_ENDL;
LLBufferStream str(channels, buffer.get());
mState = STATE_SHORT_CIRCUIT;
str << HTTP_VERSION_STR << " 404 Not Found\r\n\r\n<html>\n"
@@ -971,7 +992,7 @@ LLHTTPNode& LLIOHTTPServer::create(
port);
if(!socket)
{
- llerrs << "Unable to initialize socket" << llendl;
+ LL_ERRS() << "Unable to initialize socket" << LL_ENDL;
}
LLHTTPResponseFactory* factory = new LLHTTPResponseFactory;
diff --git a/indra/llmessage/lliohttpserver.h b/indra/llmessage/lliohttpserver.h
index 5c1b0531ff..a23eafe58a 100755
--- a/indra/llmessage/lliohttpserver.h
+++ b/indra/llmessage/lliohttpserver.h
@@ -33,18 +33,6 @@
class LLPumpIO;
-// common strings use for populating the context. bascally 'request',
-// 'wildcard', and 'headers'.
-extern const std::string CONTEXT_REQUEST;
-extern const std::string CONTEXT_RESPONSE;
-extern const std::string CONTEXT_VERB;
-extern const std::string CONTEXT_HEADERS;
-extern const std::string HTTP_VERB_GET;
-extern const std::string HTTP_VERB_PUT;
-extern const std::string HTTP_VERB_POST;
-extern const std::string HTTP_VERB_DELETE;
-extern const std::string HTTP_VERB_OPTIONS;
-
class LLIOHTTPServer
{
public:
diff --git a/indra/llmessage/lliopipe.cpp b/indra/llmessage/lliopipe.cpp
index 8f827f7a30..4676a9a8f0 100755
--- a/indra/llmessage/lliopipe.cpp
+++ b/indra/llmessage/lliopipe.cpp
@@ -72,7 +72,7 @@ LLIOPipe::LLIOPipe() :
LLIOPipe::~LLIOPipe()
{
- //lldebugs << "destroying LLIOPipe" << llendl;
+ //LL_DEBUGS() << "destroying LLIOPipe" << LL_ENDL;
}
//virtual
diff --git a/indra/llmessage/lliopipe.h b/indra/llmessage/lliopipe.h
index cbd17b5a3d..9a0a427efd 100755
--- a/indra/llmessage/lliopipe.h
+++ b/indra/llmessage/lliopipe.h
@@ -31,6 +31,7 @@
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
+#include "llwin32headerslean.h"
#include "apr_poll.h"
#include "llsd.h"
diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp
index 2043bae5e7..b7460df508 100755
--- a/indra/llmessage/lliosocket.cpp
+++ b/indra/llmessage/lliosocket.cpp
@@ -32,6 +32,7 @@
#include "llapr.h"
#include "llbuffer.h"
+#include "llfasttimer.h"
#include "llhost.h"
#include "llpumpio.h"
@@ -39,6 +40,9 @@
// constants
//
+const std::string CONTEXT_REMOTE_HOST("remote-host");
+const std::string CONTEXT_REMOTE_PORT("remote-port");
+
static const S32 LL_DEFAULT_LISTEN_BACKLOG = 10;
static const S32 LL_SEND_BUFFER_SIZE = 40000;
static const S32 LL_RECV_BUFFER_SIZE = 40000;
@@ -73,7 +77,7 @@ void ll_debug_socket(const char* msg, apr_socket_t* apr_sock)
#if LL_DEBUG_SOCKET_FILE_DESCRIPTORS
if(!apr_sock)
{
- lldebugs << "Socket -- " << (msg?msg:"") << ": no socket." << llendl;
+ LL_DEBUGS() << "Socket -- " << (msg?msg:"") << ": no socket." << LL_ENDL;
return;
}
// *TODO: Why doesn't this work?
@@ -81,13 +85,13 @@ void ll_debug_socket(const char* msg, apr_socket_t* apr_sock)
int os_sock;
if(APR_SUCCESS == apr_os_sock_get(&os_sock, apr_sock))
{
- lldebugs << "Socket -- " << (msg?msg:"") << " on fd " << os_sock
- << " at " << apr_sock << llendl;
+ LL_DEBUGS() << "Socket -- " << (msg?msg:"") << " on fd " << os_sock
+ << " at " << apr_sock << LL_ENDL;
}
else
{
- lldebugs << "Socket -- " << (msg?msg:"") << " no fd "
- << " at " << apr_sock << llendl;
+ LL_DEBUGS() << "Socket -- " << (msg?msg:"") << " no fd "
+ << " at " << apr_sock << LL_ENDL;
}
#endif
}
@@ -165,13 +169,13 @@ LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port)
rv.reset();
return rv;
}
- lldebugs << "Bound " << ((DATAGRAM_UDP == type) ? "udp" : "tcp")
- << " socket to port: " << sa->port << llendl;
+ LL_DEBUGS() << "Bound " << ((DATAGRAM_UDP == type) ? "udp" : "tcp")
+ << " socket to port: " << sa->port << LL_ENDL;
if(STREAM_TCP == type)
{
// If it's a stream based socket, we need to tell the OS
// to keep a queue of incoming connections for ACCEPT.
- lldebugs << "Setting listen state for socket." << llendl;
+ LL_DEBUGS() << "Setting listen state for socket." << LL_ENDL;
status = apr_socket_listen(
socket,
LL_DEFAULT_LISTEN_BACKLOG);
@@ -290,10 +294,10 @@ LLIOSocketReader::LLIOSocketReader(LLSocket::ptr_t socket) :
LLIOSocketReader::~LLIOSocketReader()
{
- //lldebugs << "Destroying LLIOSocketReader" << llendl;
+ //LL_DEBUGS() << "Destroying LLIOSocketReader" << LL_ENDL;
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_SOCKET_READER("Socket Reader");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_SOCKET_READER("Socket Reader");
// virtual
LLIOPipe::EStatus LLIOSocketReader::process_impl(
@@ -303,7 +307,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_SOCKET_READER);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_SOCKET_READER);
PUMP_DEBUG;
if(!mSource) return STATUS_PRECONDITION_NOT_MET;
if(!mInitialized)
@@ -315,8 +319,8 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl(
if(pump)
{
PUMP_DEBUG;
- lldebugs << "Initializing poll descriptor for LLIOSocketReader."
- << llendl;
+ LL_DEBUGS() << "Initializing poll descriptor for LLIOSocketReader."
+ << LL_ENDL;
apr_pollfd_t poll_fd;
poll_fd.p = NULL;
poll_fd.desc_type = APR_POLL_SOCKET;
@@ -343,7 +347,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl(
status = apr_socket_recv(mSource->getSocket(), read_buf, &len);
buffer->append(channels.out(), (U8*)read_buf, len);
} while((APR_SUCCESS == status) && (READ_BUFFER_SIZE == len));
- lldebugs << "socket read status: " << status << llendl;
+ LL_DEBUGS() << "socket read status: " << status << LL_ENDL;
LLIOPipe::EStatus rv = STATUS_OK;
PUMP_DEBUG;
@@ -390,10 +394,10 @@ LLIOSocketWriter::LLIOSocketWriter(LLSocket::ptr_t socket) :
LLIOSocketWriter::~LLIOSocketWriter()
{
- //lldebugs << "Destroying LLIOSocketWriter" << llendl;
+ //LL_DEBUGS() << "Destroying LLIOSocketWriter" << LL_ENDL;
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_SOCKET_WRITER("Socket Writer");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_SOCKET_WRITER("Socket Writer");
// virtual
LLIOPipe::EStatus LLIOSocketWriter::process_impl(
const LLChannelDescriptors& channels,
@@ -402,7 +406,7 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_SOCKET_WRITER);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_SOCKET_WRITER);
PUMP_DEBUG;
if(!mDestination) return STATUS_PRECONDITION_NOT_MET;
if(!mInitialized)
@@ -414,8 +418,8 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
if(pump)
{
PUMP_DEBUG;
- lldebugs << "Initializing poll descriptor for LLIOSocketWriter."
- << llendl;
+ LL_DEBUGS() << "Initializing poll descriptor for LLIOSocketWriter."
+ << LL_ENDL;
apr_pollfd_t poll_fd;
poll_fd.p = NULL;
poll_fd.desc_type = APR_POLL_SOCKET;
@@ -541,7 +545,7 @@ LLIOServerSocket::LLIOServerSocket(
LLIOServerSocket::~LLIOServerSocket()
{
- //lldebugs << "Destroying LLIOServerSocket" << llendl;
+ //LL_DEBUGS() << "Destroying LLIOServerSocket" << LL_ENDL;
}
void LLIOServerSocket::setResponseTimeout(F32 timeout_secs)
@@ -549,7 +553,7 @@ void LLIOServerSocket::setResponseTimeout(F32 timeout_secs)
mResponseTimeout = timeout_secs;
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_SERVER_SOCKET("Server Socket");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_SERVER_SOCKET("Server Socket");
// virtual
LLIOPipe::EStatus LLIOServerSocket::process_impl(
const LLChannelDescriptors& channels,
@@ -558,11 +562,11 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_SERVER_SOCKET);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_SERVER_SOCKET);
PUMP_DEBUG;
if(!pump)
{
- llwarns << "Need a pump for server socket." << llendl;
+ LL_WARNS() << "Need a pump for server socket." << LL_ENDL;
return STATUS_ERROR;
}
if(!mInitialized)
@@ -571,8 +575,8 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
// This segment sets up the pump so that we do not call
// process again until we have an incoming read, aka connect()
// from a remote host.
- lldebugs << "Initializing poll descriptor for LLIOServerSocket."
- << llendl;
+ LL_DEBUGS() << "Initializing poll descriptor for LLIOServerSocket."
+ << LL_ENDL;
apr_pollfd_t poll_fd;
poll_fd.p = NULL;
poll_fd.desc_type = APR_POLL_SOCKET;
@@ -587,7 +591,7 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
// we are initialized, and told to process, so we must have a
// socket waiting for a connection.
- lldebugs << "accepting socket" << llendl;
+ LL_DEBUGS() << "accepting socket" << LL_ENDL;
PUMP_DEBUG;
apr_pool_t* new_pool = NULL;
@@ -619,8 +623,8 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
apr_sockaddr_ip_get(&remote_host_string, remote_addr);
LLSD context;
- context["remote-host"] = remote_host_string;
- context["remote-port"] = remote_addr->port;
+ context[CONTEXT_REMOTE_HOST] = remote_host_string;
+ context[CONTEXT_REMOTE_PORT] = remote_addr->port;
LLPumpIO::chain_t chain;
chain.push_back(LLIOPipe::ptr_t(new LLIOSocketReader(llsocket)));
@@ -632,12 +636,12 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
}
else
{
- llwarns << "Unable to build reactor to socket." << llendl;
+ LL_WARNS() << "Unable to build reactor to socket." << LL_ENDL;
}
}
else
{
- llwarns << "Unable to create linden socket." << llendl;
+ LL_WARNS() << "Unable to create linden socket." << LL_ENDL;
}
PUMP_DEBUG;
@@ -677,7 +681,7 @@ LLIODataSocket::LLIODataSocket(
if(ll_apr_warn_status(status)) return;
if(sa->port)
{
- lldebugs << "Bound datagram socket to port: " << sa->port << llendl;
+ LL_DEBUGS() << "Bound datagram socket to port: " << sa->port << LL_ENDL;
mPort = sa->port;
}
else
diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h
index be0f7dfcc6..f840f0275c 100755
--- a/indra/llmessage/lliosocket.h
+++ b/indra/llmessage/lliosocket.h
@@ -38,10 +38,14 @@
*/
#include "lliopipe.h"
+#include "llwin32headerslean.h"
#include "apr_pools.h"
#include "apr_network_io.h"
#include "llchainio.h"
+extern const std::string CONTEXT_REMOTE_HOST;
+extern const std::string CONTEXT_REMOTE_PORT;
+
class LLHost;
/**
diff --git a/indra/llmessage/llioutil.cpp b/indra/llmessage/llioutil.cpp
index 8c50fd5069..b8443c0600 100755
--- a/indra/llmessage/llioutil.cpp
+++ b/indra/llmessage/llioutil.cpp
@@ -28,6 +28,7 @@
#include "linden_common.h"
#include "llioutil.h"
+#include "llfasttimer.h"
/**
* LLIOFlush
@@ -44,7 +45,7 @@ LLIOPipe::EStatus LLIOFlush::process_impl(
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_SLEEP("IO Sleep");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_SLEEP("IO Sleep");
/**
* @class LLIOSleep
*/
@@ -55,7 +56,7 @@ LLIOPipe::EStatus LLIOSleep::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_SLEEP);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_SLEEP);
if(mSeconds > 0.0)
{
if(pump) pump->sleepChain(mSeconds);
@@ -65,7 +66,7 @@ LLIOPipe::EStatus LLIOSleep::process_impl(
return STATUS_DONE;
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_ADD_CHAIN("Add Chain");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_ADD_CHAIN("Add Chain");
/**
* @class LLIOAddChain
*/
@@ -76,7 +77,7 @@ LLIOPipe::EStatus LLIOAddChain::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_ADD_CHAIN);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_ADD_CHAIN);
pump->addChain(mChain, mTimeout);
return STATUS_DONE;
}
diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp
index 08b31e9c7a..134154aa6c 100755
--- a/indra/llmessage/llmail.cpp
+++ b/indra/llmessage/llmail.cpp
@@ -29,12 +29,7 @@
#include "llmail.h"
// APR on Windows needs full windows headers
-#ifdef LL_WINDOWS
-# undef WIN32_LEAN_AND_MEAN
-# include <winsock2.h>
-# include <windows.h>
-#endif
-
+#include "llwin32headers.h"
#include <string>
#include <sstream>
@@ -199,16 +194,16 @@ std::string LLMail::buildSMTPTransaction(
{
if(!from_address || !to_address)
{
- llinfos << "send_mail build_smtp_transaction reject: missing to and/or"
- << " from address." << llendl;
+ LL_INFOS() << "send_mail build_smtp_transaction reject: missing to and/or"
+ << " from address." << LL_ENDL;
return std::string();
}
if(!valid_subject_chars(subject))
{
- llinfos << "send_mail build_smtp_transaction reject: bad subject header: "
+ LL_INFOS() << "send_mail build_smtp_transaction reject: bad subject header: "
<< "to=<" << to_address
<< ">, from=<" << from_address << ">"
- << llendl;
+ << LL_ENDL;
return std::string();
}
std::ostringstream from_fmt;
@@ -265,8 +260,8 @@ bool LLMail::send(
{
if(!from_address || !to_address)
{
- llinfos << "send_mail reject: missing to and/or from address."
- << llendl;
+ LL_INFOS() << "send_mail reject: missing to and/or from address."
+ << LL_ENDL;
return false;
}
@@ -303,26 +298,26 @@ bool LLMail::send(
if(!gMailEnabled)
{
- llinfos << "send_mail reject: mail system is disabled: to=<"
+ LL_INFOS() << "send_mail reject: mail system is disabled: to=<"
<< to_address << ">, from=<" << from_address
- << ">" << llendl;
+ << ">" << LL_ENDL;
// Any future interface to SMTP should return this as an
// error. --mark
return true;
}
if(!gSockAddr)
{
- llwarns << "send_mail reject: mail system not initialized: to=<"
+ LL_WARNS() << "send_mail reject: mail system not initialized: to=<"
<< to_address << ">, from=<" << from_address
- << ">" << llendl;
+ << ">" << LL_ENDL;
return false;
}
if(!connect_smtp())
{
- llwarns << "send_mail reject: SMTP connect failure: to=<"
+ LL_WARNS() << "send_mail reject: SMTP connect failure: to=<"
<< to_address << ">, from=<" << from_address
- << ">" << llendl;
+ << ">" << LL_ENDL;
return false;
}
@@ -338,27 +333,27 @@ bool LLMail::send(
disconnect_smtp();
if(ll_apr_warn_status(status))
{
- llwarns << "send_mail socket failure: unable to write "
+ LL_WARNS() << "send_mail socket failure: unable to write "
<< "to=<" << to_address
<< ">, from=<" << from_address << ">"
<< ", bytes=" << original_size
- << ", sent=" << send_size << llendl;
+ << ", sent=" << send_size << LL_ENDL;
return false;
}
if(send_size >= LL_MAX_KNOWN_GOOD_MAIL_SIZE)
{
- llwarns << "send_mail message has been shown to fail in testing "
+ LL_WARNS() << "send_mail message has been shown to fail in testing "
<< "when sending messages larger than " << LL_MAX_KNOWN_GOOD_MAIL_SIZE
- << " bytes. The next log about success is potentially a lie." << llendl;
+ << " bytes. The next log about success is potentially a lie." << LL_ENDL;
}
- lldebugs << "send_mail success: "
+ LL_DEBUGS() << "send_mail success: "
<< "to=<" << to_address
<< ">, from=<" << from_address << ">"
<< ", bytes=" << original_size
- << ", sent=" << send_size << llendl;
+ << ", sent=" << send_size << LL_ENDL;
#if LL_LOG_ENTIRE_MAIL_MESSAGE_ON_SEND
- llinfos << rfc2822_msg.str() << llendl;
+ LL_INFOS() << rfc2822_msg.str() << LL_ENDL;
#endif
return true;
}
diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp
index 539efc65f8..f8b2c8f5a6 100755
--- a/indra/llmessage/llmessageconfig.cpp
+++ b/indra/llmessage/llmessageconfig.cpp
@@ -145,9 +145,9 @@ void LLMessageConfigFile::loadMessages(const LLSD& data)
std::ostringstream out;
LLSDXMLFormatter *formatter = new LLSDXMLFormatter;
formatter->format(mMessages, out);
- llinfos << "loading ... " << out.str()
+ LL_INFOS() << "loading ... " << out.str()
<< " LLMessageConfigFile::loadMessages loaded "
- << mMessages.size() << " messages" << llendl;
+ << mMessages.size() << " messages" << LL_ENDL;
#endif
}
@@ -182,7 +182,7 @@ void LLMessageConfigFile::loadMessageBans(const LLSD& data)
bool LLMessageConfigFile::isCapBanned(const std::string& cap_name) const
{
- lldebugs << "mCapBans is " << LLSDNotationStreamer(mCapBans) << llendl;
+ LL_DEBUGS() << "mCapBans is " << LLSDNotationStreamer(mCapBans) << LL_ENDL;
return mCapBans[cap_name];
}
@@ -268,7 +268,7 @@ bool LLMessageConfig::isValidMessage(const std::string& msg_name)
{
if (sServerName.empty())
{
- llerrs << "LLMessageConfig::initClass() not called" << llendl;
+ LL_ERRS() << "LLMessageConfig::initClass() not called" << LL_ENDL;
}
LLMessageConfigFile& file = LLMessageConfigFile::instance();
return file.mMessages.has(msg_name);
@@ -294,8 +294,8 @@ LLSD LLMessageConfig::getConfigForMessage(const std::string& msg_name)
{
if (sServerName.empty())
{
- llerrs << "LLMessageConfig::isMessageTrusted(name) before"
- << " LLMessageConfig::initClass()" << llendl;
+ LL_ERRS() << "LLMessageConfig::isMessageTrusted(name) before"
+ << " LLMessageConfig::initClass()" << LL_ENDL;
}
LLMessageConfigFile& file = LLMessageConfigFile::instance();
// LLSD for the CamelCase message name
diff --git a/indra/llmessage/llmessagetemplate.cpp b/indra/llmessage/llmessagetemplate.cpp
index d64123ad62..c4c7e66703 100755
--- a/indra/llmessage/llmessagetemplate.cpp
+++ b/indra/llmessage/llmessagetemplate.cpp
@@ -39,8 +39,8 @@ void LLMsgVarData::addData(const void *data, S32 size, EMsgVariableType type, S3
{
if (mType != type)
{
- llwarns << "Type mismatch in LLMsgVarData::addData for " << mName
- << llendl;
+ LL_WARNS() << "Type mismatch in LLMsgVarData::addData for " << mName
+ << LL_ENDL;
}
}
if(size)
@@ -181,12 +181,12 @@ void LLMessageTemplate::banUdp()
};
if (mDeprecation != MD_DEPRECATED)
{
- llinfos << "Setting " << mName << " to UDPBlackListed was " << deprecation[mDeprecation] << llendl;
+ LL_INFOS() << "Setting " << mName << " to UDPBlackListed was " << deprecation[mDeprecation] << LL_ENDL;
mDeprecation = MD_UDPBLACKLISTED;
}
else
{
- llinfos << mName << " is already more deprecated than UDPBlackListed" << llendl;
+ LL_INFOS() << mName << " is already more deprecated than UDPBlackListed" << LL_ENDL;
}
}
diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h
index 005a49cedf..a44e16fc3a 100755
--- a/indra/llmessage/llmessagetemplate.h
+++ b/indra/llmessage/llmessagetemplate.h
@@ -27,9 +27,9 @@
#ifndef LL_LLMESSAGETEMPLATE_H
#define LL_LLMESSAGETEMPLATE_H
-#include "lldarray.h"
#include "message.h" // TODO: babbage: Remove...
#include "llstl.h"
+#include "llindexedvector.h"
class LLMsgVarData
{
@@ -102,7 +102,7 @@ public:
}
S32 mBlockNumber;
- typedef LLDynamicArrayIndexed<LLMsgVarData, const char *, 8> msg_var_data_map_t;
+ typedef LLIndexedVector<LLMsgVarData, const char *, 8> msg_var_data_map_t;
msg_var_data_map_t mMemberVarData;
char *mName;
S32 mTotalSize;
@@ -194,7 +194,7 @@ public:
LLMessageVariable** varp = &mMemberVariables[name];
if (*varp != NULL)
{
- llerrs << name << " has already been used as a variable name!" << llendl;
+ LL_ERRS() << name << " has already been used as a variable name!" << LL_ENDL;
}
*varp = new LLMessageVariable(name, type, size);
if (((*varp)->getType() != MVT_VARIABLE)
@@ -226,7 +226,7 @@ public:
friend std::ostream& operator<<(std::ostream& s, LLMessageBlock &msg);
- typedef LLDynamicArrayIndexed<LLMessageVariable*, const char *, 8> message_variable_map_t;
+ typedef LLIndexedVector<LLMessageVariable*, const char *, 8> message_variable_map_t;
message_variable_map_t mMemberVariables;
char *mName;
EMsgBlockType mType;
@@ -302,8 +302,8 @@ public:
LLMessageBlock** member_blockp = &mMemberBlocks[blockp->mName];
if (*member_blockp != NULL)
{
- llerrs << "Block " << blockp->mName
- << "has already been used as a block name!" << llendl;
+ LL_ERRS() << "Block " << blockp->mName
+ << "has already been used as a block name!" << LL_ENDL;
}
*member_blockp = blockp;
if ( (mTotalSize != -1)
@@ -392,7 +392,7 @@ public:
}
public:
- typedef LLDynamicArrayIndexed<LLMessageBlock*, char*, 8> message_block_map_t;
+ typedef LLIndexedVector<LLMessageBlock*, char*, 8> message_block_map_t;
message_block_map_t mMemberBlocks;
char *mName;
EMsgFrequency mFrequency;
diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp
index b0f19df47c..1f7c09dbe5 100755
--- a/indra/llmessage/llmessagetemplateparser.cpp
+++ b/indra/llmessage/llmessagetemplateparser.cpp
@@ -165,13 +165,13 @@ BOOL b_check_token(const char *token, const char *regexp)
if (current_checker == -1)
{
- llerrs << "Invalid regular expression value!" << llendl;
+ LL_ERRS() << "Invalid regular expression value!" << LL_ENDL;
return FALSE;
}
if (current_checker == 9999)
{
- llerrs << "Regular expression can't start with *!" << llendl;
+ LL_ERRS() << "Regular expression can't start with *!" << LL_ENDL;
return FALSE;
}
@@ -179,7 +179,7 @@ BOOL b_check_token(const char *token, const char *regexp)
{
if (current_checker == -1)
{
- llerrs << "Input exceeds regular expression!\nDid you forget a *?" << llendl;
+ LL_ERRS() << "Input exceeds regular expression!\nDid you forget a *?" << LL_ENDL;
return FALSE;
}
@@ -204,7 +204,7 @@ BOOL b_variable_ok(const char *token)
{
if (!b_check_token(token, "fv*"))
{
- llwarns << "Token '" << token << "' isn't a variable!" << llendl;
+ LL_WARNS() << "Token '" << token << "' isn't a variable!" << LL_ENDL;
return FALSE;
}
return TRUE;
@@ -215,7 +215,7 @@ BOOL b_integer_ok(const char *token)
{
if (!b_check_token(token, "sd*"))
{
- llwarns << "Token isn't an integer!" << llendl;
+ LL_WARNS() << "Token isn't an integer!" << LL_ENDL;
return FALSE;
}
return TRUE;
@@ -226,7 +226,7 @@ BOOL b_positive_integer_ok(const char *token)
{
if (!b_check_token(token, "d*"))
{
- llwarns << "Token isn't an integer!" << llendl;
+ LL_WARNS() << "Token isn't an integer!" << LL_ENDL;
return FALSE;
}
return TRUE;
@@ -359,13 +359,13 @@ void LLTemplateTokenizer::error(std::string message) const
{
if(atEOF())
{
- llerrs << "Unexpected end of file: " << message << llendl;
+ LL_ERRS() << "Unexpected end of file: " << message << LL_ENDL;
}
else
{
- llerrs << "Problem parsing message template at line "
+ LL_ERRS() << "Problem parsing message template at line "
<< line() << ", with token '" << get() << "' : "
- << message << llendl;
+ << message << LL_ENDL;
}
}
@@ -383,12 +383,12 @@ LLTemplateParser::LLTemplateParser(LLTemplateTokenizer & tokens):
std::string vers_string = tokens.next();
mVersion = (F32)atof(vers_string.c_str());
- llinfos << "### Message template version " << mVersion << " ###" << llendl;
+ LL_INFOS() << "### Message template version " << mVersion << " ###" << LL_ENDL;
}
else
{
- llerrs << "Version must be first in the message template, found "
- << tokens.next() << llendl;
+ LL_ERRS() << "Version must be first in the message template, found "
+ << tokens.next() << LL_ENDL;
}
while(LLMessageTemplate * templatep = parseMessage(tokens))
@@ -405,8 +405,8 @@ LLTemplateParser::LLTemplateParser(LLTemplateTokenizer & tokens):
if(!tokens.wantEOF())
{
- llerrs << "Expected end of template or a message, instead found: "
- << tokens.next() << " at " << tokens.line() << llendl;
+ LL_ERRS() << "Expected end of template or a message, instead found: "
+ << tokens.next() << " at " << tokens.line() << LL_ENDL;
}
}
@@ -441,7 +441,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens)
// is name a legit C variable name
if (!b_variable_ok(template_name.c_str()))
{
- llerrs << "Not legit variable name: " << template_name << " at " << tokens.line() << llendl;
+ LL_ERRS() << "Not legit variable name: " << template_name << " at " << tokens.line() << LL_ENDL;
}
// ok, now get Frequency ("High", "Medium", or "Low")
@@ -461,7 +461,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens)
}
else
{
- llerrs << "Expected frequency, got " << freq_string << " at " << tokens.line() << llendl;
+ LL_ERRS() << "Expected frequency, got " << freq_string << " at " << tokens.line() << LL_ENDL;
}
// TODO more explicit checking here pls
@@ -477,7 +477,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens)
message_number = (255 << 24) | (255 << 16) | message_number;
break;
default:
- llerrs << "Unknown frequency enum: " << frequency << llendl;
+ LL_ERRS() << "Unknown frequency enum: " << frequency << LL_ENDL;
}
templatep = new LLMessageTemplate(
@@ -497,7 +497,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens)
}
else
{
- llerrs << "Bad trust " << trust << " at " << tokens.line() << llendl;
+ LL_ERRS() << "Bad trust " << trust << " at " << tokens.line() << LL_ENDL;
}
// get encoding
@@ -512,7 +512,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens)
}
else
{
- llerrs << "Bad encoding " << encoding << " at " << tokens.line() << llendl;
+ LL_ERRS() << "Bad encoding " << encoding << " at " << tokens.line() << LL_ENDL;
}
// get deprecation
@@ -544,8 +544,8 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens)
if(!tokens.want("}"))
{
- llerrs << "Expecting closing } for message " << template_name
- << " at " << tokens.line() << llendl;
+ LL_ERRS() << "Expecting closing } for message " << template_name
+ << " at " << tokens.line() << LL_ENDL;
}
return templatep;
}
@@ -566,8 +566,8 @@ LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens)
// is name a legit C variable name
if (!b_variable_ok(block_name.c_str()))
{
- llerrs << "not a legal block name: " << block_name
- << " at " << tokens.line() << llendl;
+ LL_ERRS() << "not a legal block name: " << block_name
+ << " at " << tokens.line() << LL_ENDL;
}
// now, block type ("Single", "Multiple", or "Variable")
@@ -586,8 +586,8 @@ LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens)
// is it a legal integer
if (!b_positive_integer_ok(repeats.c_str()))
{
- llerrs << "not a legal integer for block multiple count: "
- << repeats << " at " << tokens.line() << llendl;
+ LL_ERRS() << "not a legal integer for block multiple count: "
+ << repeats << " at " << tokens.line() << LL_ENDL;
}
// ok, we can create a block
@@ -602,8 +602,8 @@ LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens)
}
else
{
- llerrs << "bad block type: " << block_type
- << " at " << tokens.line() << llendl;
+ LL_ERRS() << "bad block type: " << block_type
+ << " at " << tokens.line() << LL_ENDL;
}
@@ -617,8 +617,8 @@ LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens)
if(!tokens.want("}"))
{
- llerrs << "Expecting closing } for block " << block_name
- << " at " << tokens.line() << llendl;
+ LL_ERRS() << "Expecting closing } for block " << block_name
+ << " at " << tokens.line() << LL_ENDL;
}
return blockp;
@@ -637,8 +637,8 @@ LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens
if (!b_variable_ok(var_name.c_str()))
{
- llerrs << "Not a legit variable name: " << var_name
- << " at " << tokens.line() << llendl;
+ LL_ERRS() << "Not a legit variable name: " << var_name
+ << " at " << tokens.line() << LL_ENDL;
}
std::string var_type = tokens.next();
@@ -721,8 +721,8 @@ LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens
if (!b_positive_integer_ok(variable_size.c_str()))
{
- llerrs << "not a legal integer variable size: " << variable_size
- << " at " << tokens.line() << llendl;
+ LL_ERRS() << "not a legal integer variable size: " << variable_size
+ << " at " << tokens.line() << LL_ENDL;
}
EMsgVariableType type_enum;
@@ -737,8 +737,8 @@ LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens
else
{
type_enum = MVT_FIXED; // removes a warning
- llerrs << "bad variable type: " << var_type
- << " at " << tokens.line() << llendl;
+ LL_ERRS() << "bad variable type: " << var_type
+ << " at " << tokens.line() << LL_ENDL;
}
varp = new LLMessageVariable(
@@ -748,14 +748,14 @@ LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens
}
else
{
- llerrs << "bad variable type:" << var_type
- << " at " << tokens.line() << llendl;
+ LL_ERRS() << "bad variable type:" << var_type
+ << " at " << tokens.line() << LL_ENDL;
}
if(!tokens.want("}"))
{
- llerrs << "Expecting closing } for variable " << var_name
- << " at " << tokens.line() << llendl;
+ LL_ERRS() << "Expecting closing } for variable " << var_name
+ << " at " << tokens.line() << LL_ENDL;
}
return varp;
}
diff --git a/indra/llmessage/llmime.cpp b/indra/llmessage/llmime.cpp
deleted file mode 100755
index 9d9c4ebd68..0000000000
--- a/indra/llmessage/llmime.cpp
+++ /dev/null
@@ -1,629 +0,0 @@
-/**
- * @file llmime.cpp
- * @author Phoenix
- * @date 2006-12-20
- * @brief Implementation of mime tools.
- *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-#include "llmime.h"
-
-#include <vector>
-
-#include "llmemorystream.h"
-
-/**
- * Useful constants.
- */
-// Headers specified in rfc-2045 will be canonicalized below.
-static const std::string CONTENT_LENGTH("Content-Length");
-static const std::string CONTENT_TYPE("Content-Type");
-static const S32 KNOWN_HEADER_COUNT = 6;
-static const std::string KNOWN_HEADER[KNOWN_HEADER_COUNT] =
-{
- CONTENT_LENGTH,
- CONTENT_TYPE,
- std::string("MIME-Version"),
- std::string("Content-Transfer-Encoding"),
- std::string("Content-ID"),
- std::string("Content-Description"),
-};
-
-// parser helpers
-static const std::string MULTIPART("multipart");
-static const std::string BOUNDARY("boundary");
-static const std::string END_OF_CONTENT_PARAMETER("\r\n ;\t");
-static const std::string SEPARATOR_PREFIX("--");
-//static const std::string SEPARATOR_SUFFIX("\r\n");
-
-/*
-Content-Type: multipart/mixed; boundary="segment"
-Content-Length: 24832
-
---segment
-Content-Type: image/j2c
-Content-Length: 23715
-
-<data>
-
---segment
-Content-Type: text/xml; charset=UTF-8
-
-<meta data>
-EOF
-
-*/
-
-/**
- * LLMimeIndex
- */
-
-/**
- * @class LLMimeIndex::Impl
- * @brief Implementation details of the mime index class.
- * @see LLMimeIndex
- */
-class LLMimeIndex::Impl
-{
-public:
- Impl() : mOffset(-1), mUseCount(1)
- {}
- Impl(LLSD headers, S32 offset) :
- mHeaders(headers), mOffset(offset), mUseCount(1)
- {}
-public:
- LLSD mHeaders;
- S32 mOffset;
- S32 mUseCount;
-
- typedef std::vector<LLMimeIndex> sub_part_t;
- sub_part_t mAttachments;
-};
-
-LLSD LLMimeIndex::headers() const
-{
- return mImpl->mHeaders;
-}
-
-S32 LLMimeIndex::offset() const
-{
- return mImpl->mOffset;
-}
-
-S32 LLMimeIndex::contentLength() const
-{
- // Find the content length in the headers.
- S32 length = -1;
- LLSD content_length = mImpl->mHeaders[CONTENT_LENGTH];
- if(content_length.isDefined())
- {
- length = content_length.asInteger();
- }
- return length;
-}
-
-std::string LLMimeIndex::contentType() const
-{
- std::string type;
- LLSD content_type = mImpl->mHeaders[CONTENT_TYPE];
- if(content_type.isDefined())
- {
- type = content_type.asString();
- }
- return type;
-}
-
-bool LLMimeIndex::isMultipart() const
-{
- bool multipart = false;
- LLSD content_type = mImpl->mHeaders[CONTENT_TYPE];
- if(content_type.isDefined())
- {
- std::string type = content_type.asString();
- int comp = type.compare(0, MULTIPART.size(), MULTIPART);
- if(0 == comp)
- {
- multipart = true;
- }
- }
- return multipart;
-}
-
-S32 LLMimeIndex::subPartCount() const
-{
- return mImpl->mAttachments.size();
-}
-
-LLMimeIndex LLMimeIndex::subPart(S32 index) const
-{
- LLMimeIndex part;
- if((index >= 0) && (index < (S32)mImpl->mAttachments.size()))
- {
- part = mImpl->mAttachments[index];
- }
- return part;
-}
-
-LLMimeIndex::LLMimeIndex() : mImpl(new LLMimeIndex::Impl)
-{
-}
-
-LLMimeIndex::LLMimeIndex(LLSD headers, S32 content_offset) :
- mImpl(new LLMimeIndex::Impl(headers, content_offset))
-{
-}
-
-LLMimeIndex::LLMimeIndex(const LLMimeIndex& mime) :
- mImpl(mime.mImpl)
-{
- ++mImpl->mUseCount;
-}
-
-LLMimeIndex::~LLMimeIndex()
-{
- if(0 == --mImpl->mUseCount)
- {
- delete mImpl;
- }
-}
-
-LLMimeIndex& LLMimeIndex::operator=(const LLMimeIndex& mime)
-{
- // Increment use count first so that we handle self assignment
- // automatically.
- ++mime.mImpl->mUseCount;
- if(0 == --mImpl->mUseCount)
- {
- delete mImpl;
- }
- mImpl = mime.mImpl;
- return *this;
-}
-
-bool LLMimeIndex::attachSubPart(LLMimeIndex sub_part)
-{
- // *FIX: Should we check for multi-part?
- if(mImpl->mAttachments.size() < S32_MAX)
- {
- mImpl->mAttachments.push_back(sub_part);
- return true;
- }
- return false;
-}
-
-/**
- * LLMimeParser
- */
-/**
- * @class LLMimeParser::Impl
- * @brief Implementation details of the mime parser class.
- * @see LLMimeParser
- */
-class LLMimeParser::Impl
-{
-public:
- // @brief Constructor.
- Impl();
-
- // @brief Reset this for a new parse.
- void reset();
-
- /**
- * @brief Parse a mime entity to find the index information.
- *
- * This method will scan the istr until a single complete mime
- * entity is read, an EOF, or limit bytes have been scanned. The
- * istr will be modified by this parsing, so pass in a temporary
- * stream or rewind/reset the stream after this call.
- * @param istr An istream which contains a mime entity.
- * @param limit The maximum number of bytes to scan.
- * @param separator The multipart separator if it is known.
- * @param is_subpart Set true if parsing a multipart sub part.
- * @param index[out] The parsed output.
- * @return Returns true if an index was parsed and no errors occurred.
- */
- bool parseIndex(
- std::istream& istr,
- S32 limit,
- const std::string& separator,
- bool is_subpart,
- LLMimeIndex& index);
-
-protected:
- /**
- * @brief parse the headers.
- *
- * At the end of a successful parse, mScanCount will be at the
- * start of the content.
- * @param istr The input stream.
- * @param limit maximum number of bytes to process
- * @param headers[out] A map of the headers found.
- * @return Returns true if the parse was successful.
- */
- bool parseHeaders(std::istream& istr, S32 limit, LLSD& headers);
-
- /**
- * @brief Figure out the separator string from a content type header.
- *
- * @param multipart_content_type The content type value from the headers.
- * @return Returns the separator string.
- */
- std::string findSeparator(std::string multipart_content_type);
-
- /**
- * @brief Scan through istr past the separator.
- *
- * @param istr The input stream.
- * @param limit Maximum number of bytes to scan.
- * @param separator The multipart separator.
- */
- void scanPastSeparator(
- std::istream& istr,
- S32 limit,
- const std::string& separator);
-
- /**
- * @brief Scan through istr past the content of the current mime part.
- *
- * @param istr The input stream.
- * @param limit Maximum number of bytes to scan.
- * @param headers The headers for this mime part.
- * @param separator The multipart separator if known.
- */
- void scanPastContent(
- std::istream& istr,
- S32 limit,
- LLSD headers,
- const std::string separator);
-
- /**
- * @brief Eat CRLF.
- *
- * This method has no concept of the limit, so ensure you have at
- * least 2 characters left to eat before hitting the limit. This
- * method will increment mScanCount as it goes.
- * @param istr The input stream.
- * @return Returns true if CRLF was found and consumed off of istr.
- */
- bool eatCRLF(std::istream& istr);
-
- // @brief Returns true if parsing should continue.
- bool continueParse() const { return (!mError && mContinue); }
-
- // @brief anonymous enumeration for parse buffer size.
- enum
- {
- LINE_BUFFER_LENGTH = 1024
- };
-
-protected:
- S32 mScanCount;
- bool mContinue;
- bool mError;
- char mBuffer[LINE_BUFFER_LENGTH];
-};
-
-LLMimeParser::Impl::Impl()
-{
- reset();
-}
-
-void LLMimeParser::Impl::reset()
-{
- mScanCount = 0;
- mContinue = true;
- mError = false;
- mBuffer[0] = '\0';
-}
-
-bool LLMimeParser::Impl::parseIndex(
- std::istream& istr,
- S32 limit,
- const std::string& separator,
- bool is_subpart,
- LLMimeIndex& index)
-{
- LLSD headers;
- bool parsed_something = false;
- if(parseHeaders(istr, limit, headers))
- {
- parsed_something = true;
- LLMimeIndex mime(headers, mScanCount);
- index = mime;
- if(index.isMultipart())
- {
- // Figure out the separator, scan past it, and recurse.
- std::string ct = headers[CONTENT_TYPE].asString();
- std::string sep = findSeparator(ct);
- scanPastSeparator(istr, limit, sep);
- while(continueParse() && parseIndex(istr, limit, sep, true, mime))
- {
- index.attachSubPart(mime);
- }
- }
- else
- {
- // Scan to the end of content.
- scanPastContent(istr, limit, headers, separator);
- if(is_subpart)
- {
- scanPastSeparator(istr, limit, separator);
- }
- }
- }
- if(mError) return false;
- return parsed_something;
-}
-
-bool LLMimeParser::Impl::parseHeaders(
- std::istream& istr,
- S32 limit,
- LLSD& headers)
-{
- while(continueParse())
- {
- // Get the next line.
- // We subtract 1 from the limit so that we make sure
- // not to read past limit when we get() the newline.
- S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
- istr.getline(mBuffer, max_get, '\r');
- mScanCount += (S32)istr.gcount();
- int c = istr.get();
- if(EOF == c)
- {
- mContinue = false;
- return false;
- }
- ++mScanCount;
- if(c != '\n')
- {
- mError = true;
- return false;
- }
- if(mScanCount >= limit)
- {
- mContinue = false;
- }
-
- // Check if that's the end of headers.
- if('\0' == mBuffer[0])
- {
- break;
- }
-
- // Split out the name and value.
- // *NOTE: The use of strchr() here is safe since mBuffer is
- // guaranteed to be NULL terminated from the call to getline()
- // above.
- char* colon = strchr(mBuffer, ':');
- if(!colon)
- {
- mError = true;
- return false;
- }
-
- // Cononicalize the name part, and store the name: value in
- // the headers structure. We do this by iterating through
- // 'known' headers and replacing the value found with the
- // correct one.
- // *NOTE: Not so efficient, but iterating through a small
- // subset should not be too much of an issue.
- std::string name(mBuffer, colon++ - mBuffer);
- while(isspace(*colon)) ++colon;
- std::string value(colon);
- for(S32 ii = 0; ii < KNOWN_HEADER_COUNT; ++ii)
- {
- if(0 == LLStringUtil::compareInsensitive(name, KNOWN_HEADER[ii]))
- {
- name = KNOWN_HEADER[ii];
- break;
- }
- }
- headers[name] = value;
- }
- if(headers.isUndefined()) return false;
- return true;
-}
-
-std::string LLMimeParser::Impl::findSeparator(std::string header)
-{
- // 01234567890
- //Content-Type: multipart/mixed; boundary="segment"
- std::string separator;
- std::string::size_type pos = header.find(BOUNDARY);
- if(std::string::npos == pos) return separator;
- pos += BOUNDARY.size() + 1;
- std::string::size_type end;
- if(header[pos] == '"')
- {
- // the boundary is quoted, find the end from pos, and take the
- // substring.
- end = header.find('"', ++pos);
- if(std::string::npos == end)
- {
- // poorly formed boundary.
- mError = true;
- }
- }
- else
- {
- // otherwise, it's every character until a whitespace, end of
- // line, or another parameter begins.
- end = header.find_first_of(END_OF_CONTENT_PARAMETER, pos);
- if(std::string::npos == end)
- {
- // it goes to the end of the string.
- end = header.size();
- }
- }
- if(!mError) separator = header.substr(pos, end - pos);
- return separator;
-}
-
-void LLMimeParser::Impl::scanPastSeparator(
- std::istream& istr,
- S32 limit,
- const std::string& sep)
-{
- std::ostringstream ostr;
- ostr << SEPARATOR_PREFIX << sep;
- std::string separator = ostr.str();
- bool found_separator = false;
- while(!found_separator && continueParse())
- {
- // Subtract 1 from the limit so that we make sure not to read
- // past limit when we get() the newline.
- S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
- istr.getline(mBuffer, max_get, '\r');
- mScanCount += (S32)istr.gcount();
- if(istr.gcount() >= LINE_BUFFER_LENGTH - 1)
- {
- // that's way too long to be a separator, so ignore it.
- continue;
- }
- int c = istr.get();
- if(EOF == c)
- {
- mContinue = false;
- return;
- }
- ++mScanCount;
- if(c != '\n')
- {
- mError = true;
- return;
- }
- if(mScanCount >= limit)
- {
- mContinue = false;
- }
- if(0 == LLStringUtil::compareStrings(std::string(mBuffer), separator))
- {
- found_separator = true;
- }
- }
-}
-
-void LLMimeParser::Impl::scanPastContent(
- std::istream& istr,
- S32 limit,
- LLSD headers,
- const std::string separator)
-{
- if(headers.has(CONTENT_LENGTH))
- {
- S32 content_length = headers[CONTENT_LENGTH].asInteger();
- // Subtract 2 here for the \r\n after the content.
- S32 max_skip = llmin(content_length, limit - mScanCount - 2);
- istr.ignore(max_skip);
- mScanCount += max_skip;
-
- // *NOTE: Check for hitting the limit and eof here before
- // checking for the trailing EOF, because our mime parser has
- // to gracefully handle incomplete mime entites.
- if((mScanCount >= limit) || istr.eof())
- {
- mContinue = false;
- }
- else if(!eatCRLF(istr))
- {
- mError = true;
- return;
- }
- }
-}
-
-bool LLMimeParser::Impl::eatCRLF(std::istream& istr)
-{
- int c = istr.get();
- ++mScanCount;
- if(c != '\r')
- {
- return false;
- }
- c = istr.get();
- ++mScanCount;
- if(c != '\n')
- {
- return false;
- }
- return true;
-}
-
-
-LLMimeParser::LLMimeParser() : mImpl(* new LLMimeParser::Impl)
-{
-}
-
-LLMimeParser::~LLMimeParser()
-{
- delete & mImpl;
-}
-
-void LLMimeParser::reset()
-{
- mImpl.reset();
-}
-
-bool LLMimeParser::parseIndex(std::istream& istr, LLMimeIndex& index)
-{
- std::string separator;
- return mImpl.parseIndex(istr, S32_MAX, separator, false, index);
-}
-
-bool LLMimeParser::parseIndex(
- const std::vector<U8>& buffer,
- LLMimeIndex& index)
-{
- LLMemoryStream mstr(&buffer[0], buffer.size());
- return parseIndex(mstr, buffer.size() + 1, index);
-}
-
-bool LLMimeParser::parseIndex(
- std::istream& istr,
- S32 limit,
- LLMimeIndex& index)
-{
- std::string separator;
- return mImpl.parseIndex(istr, limit, separator, false, index);
-}
-
-bool LLMimeParser::parseIndex(const U8* buffer, S32 length, LLMimeIndex& index)
-{
- LLMemoryStream mstr(buffer, length);
- return parseIndex(mstr, length + 1, index);
-}
-
-/*
-bool LLMimeParser::verify(std::istream& isr, LLMimeIndex& index) const
-{
- return false;
-}
-
-bool LLMimeParser::verify(U8* buffer, S32 length, LLMimeIndex& index) const
-{
- LLMemoryStream mstr(buffer, length);
- return verify(mstr, index);
-}
-*/
diff --git a/indra/llmessage/llmime.h b/indra/llmessage/llmime.h
deleted file mode 100755
index e6617fb503..0000000000
--- a/indra/llmessage/llmime.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/**
- * @file llmime.h
- * @author Phoenix
- * @date 2006-12-20
- * @brief Declaration of mime tools.
- *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLMIME_H
-#define LL_LLMIME_H
-
-#include <string>
-#include "llsd.h"
-
-/**
- * This file declares various tools for parsing and creating MIME
- * objects as described in RFCs 2045, 2046, 2047, 2048, and 2049.
- */
-
-/**
- * @class LLMimeIndex
- * @brief Skeletal information useful for handling mime packages.
- * @see LLMimeParser
- *
- * An instance of this class is the parsed output from a LLMimeParser
- * which then allows for easy access into a data stream to find and
- * get what you want out of it.
- *
- * This class meant as a tool to quickly find what you seek in a
- * parsed mime entity. As such, it does not have useful support for
- * modification of a mime entity and specializes the interface toward
- * querying data from a fixed mime entity. Modifying an instance of
- * LLMimeIndx does not alter a mime entity and changes to a mime
- * entity itself are not propogated into an instance of a LLMimeIndex.
- *
- * Usage:<br>
- * LLMimeIndex mime_index;<br>
- * std::ifstream fstr("package.mime", ios::binary);<br>
- * LLMimeParser parser;<br>
- * if(parser.parseIndex(fstr, mime_index))<br>
- * {<br>
- * std::vector<U8> content;<br>
- * content.resize(mime_index.contentLength());<br>
- * fstr.seekg(mime_index.offset(), ios::beg);<br>
- * // ...do work on fstr and content<br>
- * }<br>
- */
-class LLMimeIndex
-{
-public:
- /* @name Client interface.
- */
- //@{
- /**
- * @brief Get the full parsed headers for this.
- *
- * If there are any headers, it will be a map of header name to
- * the value found on the line. The name is everything before the
- * colon, and the value is the string found after the colon to the
- * end of the line after trimming leading whitespace. So, for
- * example:
- * Content-Type: text/plain
- * would become an entry in the headers of:
- * headers["Content-Type"] == "text/plain"
- *
- * If this instance of an index was generated by the
- * LLMimeParser::parseIndex() call, all header names in rfc2045
- * will be capitalized as in rfc, eg Content-Length and
- * MIME-Version, not content-length and mime-version.
- * @return Returns an LLSD map of header name to value. Returns
- * undef if there are no headers.
- */
- LLSD headers() const;
-
- /**
- * @brief Get the content offset.
- *
- * @return Returns the number of bytes to the start of the data
- * segment from the start of serialized mime entity. Returns -1 if
- * offset is not known.
- */
- S32 offset() const;
-
- /**
- * @brief Get the length of the data segment for this mime part.
- *
- * @return Returns the content length in bytes. Returns -1 if
- * length is not known.
- */
- S32 contentLength() const;
-
- /**
- * @brief Get the mime type associated with this node.
- *
- * @return Returns the mimetype.
- */
- std::string contentType() const;
-
- /**
- * @brief Helper method which simplifies parsing the return from type()
- *
- * @return Returns true if this is a multipart mime, and therefore
- * getting subparts will succeed.
- */
- bool isMultipart() const;
-
- /**
- * @brief Get the number of atachments.
- *
- * @return Returns the number of sub-parts for this.
- */
- S32 subPartCount() const;
-
- /**
- * @brief Get the indicated attachment.
- *
- * @param index Value from 0 to (subPartCount() - 1).
- * @return Returns the indicated sub-part, or an invalid mime
- * index on failure.
- */
- LLMimeIndex subPart(S32 index) const;
- //@}
-
- /* @name Interface for building, testing, and helpers for typical use.
- */
- //@{
- /**
- * @brief Default constructor - creates a useless LLMimeIndex.
- */
- LLMimeIndex();
-
- /**
- * @brief Full constructor.
- *
- * @param headers The complete headers.
- * @param content_offset The number of bytes to the start of the
- * data segment of this mime entity from the start of the stream
- * or buffer.
- */
- LLMimeIndex(LLSD headers, S32 content_offset);
-
- /**
- * @brief Copy constructor.
- *
- * @param mime The other mime object.
- */
- LLMimeIndex(const LLMimeIndex& mime);
-
- // @brief Destructor.
- ~LLMimeIndex();
-
- /*
- * @breif Assignment operator.
- *
- * @param mime The other mime object.
- * @return Returns this after assignment.
- */
- LLMimeIndex& operator=(const LLMimeIndex& mime);
-
- /**
- * @brief Add attachment information as a sub-part to a multipart mime.
- *
- * @param sub_part the part to attach.
- * @return Returns true on success, false on failure.
- */
- bool attachSubPart(LLMimeIndex sub_part);
- //@}
-
-protected:
- // Implementation.
- class Impl;
- Impl* mImpl;
-};
-
-
-/**
- * @class LLMimeParser
- * @brief This class implements a MIME parser and verifier.
- *
- * THOROUGH_DESCRIPTION
- */
-class LLMimeParser
-{
-public:
- // @brief Make a new mime parser.
- LLMimeParser();
-
- // @brief Mime parser Destructor.
- ~LLMimeParser();
-
- // @brief Reset internal state of this parser.
- void reset();
-
-
- /* @name Index generation interface.
- */
- //@{
- /**
- * @brief Parse a stream to find the mime index information.
- *
- * This method will scan the istr until a single complete mime
- * entity is read or EOF. The istr will be modified by this
- * parsing, so pass in a temporary stream or rewind/reset the
- * stream after this call.
- * @param istr An istream which contains a mime entity.
- * @param index[out] The parsed output.
- * @return Returns true if an index was parsed and no errors occurred.
- */
- bool parseIndex(std::istream& istr, LLMimeIndex& index);
-
- /**
- * @brief Parse a vector to find the mime index information.
- *
- * @param buffer A vector with data to parse.
- * @param index[out] The parsed output.
- * @return Returns true if an index was parsed and no errors occurred.
- */
- bool parseIndex(const std::vector<U8>& buffer, LLMimeIndex& index);
-
- /**
- * @brief Parse a stream to find the mime index information.
- *
- * This method will scan the istr until a single complete mime
- * entity is read, an EOF, or limit bytes have been scanned. The
- * istr will be modified by this parsing, so pass in a temporary
- * stream or rewind/reset the stream after this call.
- * @param istr An istream which contains a mime entity.
- * @param limit The maximum number of bytes to scan.
- * @param index[out] The parsed output.
- * @return Returns true if an index was parsed and no errors occurred.
- */
- bool parseIndex(std::istream& istr, S32 limit, LLMimeIndex& index);
-
- /**
- * @brief Parse a memory bufffer to find the mime index information.
- *
- * @param buffer The start of the buffer to parse.
- * @param buffer_length The length of the buffer.
- * @param index[out] The parsed output.
- * @return Returns true if an index was parsed and no errors occurred.
- */
- bool parseIndex(const U8* buffer, S32 buffer_length, LLMimeIndex& index);
- //@}
-
- /**
- * @brief
- *
- * @return
- */
- //bool verify(std::istream& istr, LLMimeIndex& index) const;
-
- /**
- * @brief
- *
- * @return
- */
- //bool verify(U8* buffer, S32 buffer_length, LLMimeIndex& index) const;
-
-protected:
- // Implementation.
- class Impl;
- Impl& mImpl;
-
-private:
- // @brief Not implemneted to prevent copy consturction.
- LLMimeParser(const LLMimeParser& parser);
-
- // @brief Not implemneted to prevent assignment.
- LLMimeParser& operator=(const LLMimeParser& mime);
-};
-
-#endif // LL_LLMIME_H
diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp
index d799403029..c51883ee3d 100755
--- a/indra/llmessage/llnamevalue.cpp
+++ b/indra/llmessage/llnamevalue.cpp
@@ -33,7 +33,7 @@
#include "u64.h"
#include "llstring.h"
-#include "string_table.h"
+#include "llstringtable.h"
// Anonymous enumeration to provide constants in this file.
// *NOTE: These values may be used in sscanf statements below as their
@@ -209,7 +209,7 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con
}
else
{
- llwarns << "Unknown name value type string " << mStringType << " for " << mName << llendl;
+ LL_WARNS() << "Unknown name value type string " << mStringType << " for " << mName << LL_ENDL;
mType = NVT_NULL;
}
@@ -261,8 +261,8 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con
}
else
{
- llwarns << "LLNameValue::init() - unknown sendto field "
- << nvsendto << " for NV " << mName << llendl;
+ LL_WARNS() << "LLNameValue::init() - unknown sendto field "
+ << nvsendto << " for NV " << mName << LL_ENDL;
mSendto = NVS_NULL;
mStringSendto = mNVNameTable->addString("S");
}
@@ -332,7 +332,7 @@ LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass
else
{
mType = NVT_NULL;
- llinfos << "Unknown name-value type " << mStringType << llendl;
+ LL_INFOS() << "Unknown name-value type " << mStringType << LL_ENDL;
}
// Nota Bene: Whatever global structure manages this should have these in the name table already!
@@ -580,7 +580,7 @@ char *LLNameValue::getString()
}
else
{
- llerrs << mName << " not a string!" << llendl;
+ LL_ERRS() << mName << " not a string!" << LL_ENDL;
return NULL;
}
}
@@ -593,7 +593,7 @@ const char *LLNameValue::getAsset() const
}
else
{
- llerrs << mName << " not an asset!" << llendl;
+ LL_ERRS() << mName << " not an asset!" << LL_ENDL;
return NULL;
}
}
@@ -606,7 +606,7 @@ F32 *LLNameValue::getF32()
}
else
{
- llerrs << mName << " not a F32!" << llendl;
+ LL_ERRS() << mName << " not a F32!" << LL_ENDL;
return NULL;
}
}
@@ -619,7 +619,7 @@ S32 *LLNameValue::getS32()
}
else
{
- llerrs << mName << " not a S32!" << llendl;
+ LL_ERRS() << mName << " not a S32!" << LL_ENDL;
return NULL;
}
}
@@ -632,7 +632,7 @@ U32 *LLNameValue::getU32()
}
else
{
- llerrs << mName << " not a U32!" << llendl;
+ LL_ERRS() << mName << " not a U32!" << LL_ENDL;
return NULL;
}
}
@@ -645,7 +645,7 @@ U64 *LLNameValue::getU64()
}
else
{
- llerrs << mName << " not a U64!" << llendl;
+ LL_ERRS() << mName << " not a U64!" << LL_ENDL;
return NULL;
}
}
@@ -658,7 +658,7 @@ void LLNameValue::getVec3(LLVector3 &vec)
}
else
{
- llerrs << mName << " not a Vec3!" << llendl;
+ LL_ERRS() << mName << " not a Vec3!" << LL_ENDL;
}
}
@@ -670,7 +670,7 @@ LLVector3 *LLNameValue::getVec3()
}
else
{
- llerrs << mName << " not a Vec3!" << llendl;
+ LL_ERRS() << mName << " not a Vec3!" << LL_ENDL;
return NULL;
}
}
@@ -726,7 +726,7 @@ LLNameValue &LLNameValue::operator=(const LLNameValue &a)
*mNameValueReference.u64 = *a.mNameValueReference.u64;
break;
default:
- llerrs << "Unknown Name value type " << (U32)a.mType << llendl;
+ LL_ERRS() << "Unknown Name value type " << (U32)a.mType << LL_ENDL;
break;
}
@@ -865,7 +865,7 @@ void LLNameValue::setU32(const U32 a)
*mNameValueReference.f32 = (F32)a;
break;
default:
- llerrs << "NameValue: Trying to set U32 into a " << mStringType << ", unknown conversion" << llendl;
+ LL_ERRS() << "NameValue: Trying to set U32 into a " << mStringType << ", unknown conversion" << LL_ENDL;
break;
}
return;
@@ -883,7 +883,7 @@ void LLNameValue::setVec3(const LLVector3 &a)
*mNameValueReference.vec3 = a;
break;
default:
- llerrs << "NameValue: Trying to set LLVector3 into a " << mStringType << ", unknown conversion" << llendl;
+ LL_ERRS() << "NameValue: Trying to set LLVector3 into a " << mStringType << ", unknown conversion" << LL_ENDL;
break;
}
return;
@@ -895,7 +895,7 @@ std::string LLNameValue::printNameValue() const
std::string buffer;
buffer = llformat("%s %s %s %s ", mName, mStringType, mStringClass, mStringSendto);
buffer += printData();
-// llinfos << "Name Value Length: " << buffer.size() + 1 << llendl;
+// LL_INFOS() << "Name Value Length: " << buffer.size() + 1 << LL_ENDL;
return buffer;
}
@@ -928,7 +928,7 @@ std::string LLNameValue::printData() const
buffer = llformat( "%f, %f, %f", mNameValueReference.vec3->mV[VX], mNameValueReference.vec3->mV[VY], mNameValueReference.vec3->mV[VZ]);
break;
default:
- llerrs << "Trying to print unknown NameValue type " << mStringType << llendl;
+ LL_ERRS() << "Trying to print unknown NameValue type " << mStringType << LL_ENDL;
break;
}
return buffer;
@@ -962,7 +962,7 @@ std::ostream& operator<<(std::ostream& s, const LLNameValue &a)
s << *(a.mNameValueReference.vec3);
break;
default:
- llerrs << "Trying to print unknown NameValue type " << a.mStringType << llendl;
+ LL_ERRS() << "Trying to print unknown NameValue type " << a.mStringType << LL_ENDL;
break;
}
return s;
diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h
index 273de475f8..f8b556b5fe 100755
--- a/indra/llmessage/llnamevalue.h
+++ b/indra/llmessage/llnamevalue.h
@@ -41,7 +41,7 @@
// SitObject STRING
// SitPosition VEC3
-#include "string_table.h"
+#include "llstringtable.h"
#include "llmath.h"
#include "v3math.h"
#include "lldbstrings.h"
diff --git a/indra/llmessage/llpacketack.cpp b/indra/llmessage/llpacketack.cpp
index f08d3404ea..c3c022c297 100755
--- a/indra/llmessage/llpacketack.cpp
+++ b/indra/llmessage/llpacketack.cpp
@@ -50,7 +50,7 @@ LLReliablePacket::LLReliablePacket(
mHost = params->mHost;
mRetries = params->mRetries;
mPingBasedRetry = params->mPingBasedRetry;
- mTimeout = params->mTimeout;
+ mTimeout = F32Seconds(params->mTimeout);
mCallback = params->mCallback;
mCallbackData = params->mCallbackData;
mMessageName = params->mMessageName;
@@ -59,13 +59,13 @@ LLReliablePacket::LLReliablePacket(
{
mRetries = 0;
mPingBasedRetry = TRUE;
- mTimeout = 0.f;
+ mTimeout = F32Seconds(0.f);
mCallback = NULL;
mCallbackData = NULL;
mMessageName = NULL;
}
- mExpirationTime = (F64)((S64)totalTime())/1000000.0 + mTimeout;
+ mExpirationTime = (F64Seconds)totalTime() + mTimeout;
mPacketID = ntohl(*((U32*)(&buf_ptr[PHL_PACKET_ID])));
mSocket = socket;
diff --git a/indra/llmessage/llpacketack.h b/indra/llmessage/llpacketack.h
index 2ef3c48e44..f0ed923f19 100755
--- a/indra/llmessage/llpacketack.h
+++ b/indra/llmessage/llpacketack.h
@@ -28,6 +28,7 @@
#define LL_LLPACKETACK_H
#include "llhost.h"
+#include "llunits.h"
class LLReliablePacketParams
{
@@ -35,7 +36,7 @@ public:
LLHost mHost;
S32 mRetries;
BOOL mPingBasedRetry;
- F32 mTimeout;
+ F32Seconds mTimeout;
void (*mCallback)(void **,S32);
void** mCallbackData;
char* mMessageName;
@@ -53,7 +54,7 @@ public:
mHost.invalidate();
mRetries = 0;
mPingBasedRetry = TRUE;
- mTimeout = 0.f;
+ mTimeout = F32Seconds(0.f);
mCallback = NULL;
mCallbackData = NULL;
mMessageName = NULL;
@@ -63,7 +64,7 @@ public:
const LLHost& host,
S32 retries,
BOOL ping_based_retry,
- F32 timeout,
+ F32Seconds timeout,
void (*callback)(void**,S32),
void** callback_data, char* name)
{
@@ -98,7 +99,7 @@ protected:
LLHost mHost;
S32 mRetries;
BOOL mPingBasedRetry;
- F32 mTimeout;
+ F32Seconds mTimeout;
void (*mCallback)(void**,S32);
void** mCallbackData;
char* mMessageName;
@@ -108,7 +109,7 @@ protected:
TPACKETID mPacketID;
- F64 mExpirationTime;
+ F64Seconds mExpirationTime;
};
#endif
diff --git a/indra/llmessage/llpacketbuffer.cpp b/indra/llmessage/llpacketbuffer.cpp
index e69631eb3b..ccf991b1a7 100755
--- a/indra/llmessage/llpacketbuffer.cpp
+++ b/indra/llmessage/llpacketbuffer.cpp
@@ -29,7 +29,7 @@
#include "llpacketbuffer.h"
#include "net.h"
-#include "timing.h"
+#include "lltimer.h"
#include "llhost.h"
///////////////////////////////////////////////////////////
@@ -41,7 +41,7 @@ LLPacketBuffer::LLPacketBuffer(const LLHost &host, const char *datap, const S32
if (size > NET_BUFFER_SIZE)
{
- llerrs << "Sending packet > " << NET_BUFFER_SIZE << " of size " << size << llendl;
+ LL_ERRS() << "Sending packet > " << NET_BUFFER_SIZE << " of size " << size << LL_ENDL;
}
else
{
diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp
index fc6e9c5193..687212ea10 100755
--- a/indra/llmessage/llpacketring.cpp
+++ b/indra/llmessage/llpacketring.cpp
@@ -41,7 +41,6 @@
#include "llproxy.h"
#include "llrand.h"
#include "message.h"
-#include "timing.h"
#include "u64.h"
///////////////////////////////////////////////////////////
@@ -196,7 +195,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap)
if (mInBufferLength + packetp->getSize() > mMaxBufferLength)
{
// Toss it.
- llwarns << "Throwing away packet, overflowing buffer" << llendl;
+ LL_WARNS() << "Throwing away packet, overflowing buffer" << LL_ENDL;
delete packetp;
packetp = NULL;
}
@@ -324,7 +323,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
{
// Nuke this packet, we overflowed the buffer.
// Toss it.
- llwarns << "Throwing away outbound packet, overflowing buffer" << llendl;
+ LL_WARNS() << "Throwing away outbound packet, overflowing buffer" << LL_ENDL;
}
else
{
@@ -332,7 +331,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
if ((mOutBufferLength > 4192) && queue_timer.getElapsedTimeF32() > 1.f)
{
// Add it to the queue
- llinfos << "Outbound packet queue " << mOutBufferLength << " bytes" << llendl;
+ LL_INFOS() << "Outbound packet queue " << mOutBufferLength << " bytes" << LL_ENDL;
queue_timer.reset();
}
packetp = new LLPacketBuffer(host, send_buffer, buf_size);
diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp
index 9988fcd9c0..9b8d19cc3e 100755
--- a/indra/llmessage/llproxy.cpp
+++ b/indra/llmessage/llproxy.cpp
@@ -57,13 +57,15 @@ LLProxy::LLProxy():
mAuthMethodSelected(METHOD_NOAUTH),
mSocksUsername(),
mSocksPassword()
-{
-}
+{}
LLProxy::~LLProxy()
{
- stopSOCKSProxy();
- disableHTTPProxy();
+ if (ll_apr_is_initialized())
+ {
+ stopSOCKSProxy();
+ disableHTTPProxy();
+ }
}
/**
diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp
index 0623e99f0a..506ccc98a4 100755
--- a/indra/llmessage/llpumpio.cpp
+++ b/indra/llmessage/llpumpio.cpp
@@ -34,6 +34,7 @@
#include "apr_poll.h"
#include "llapr.h"
+#include "llfasttimer.h"
#include "llstl.h"
// These should not be enabled in production, but they can be
@@ -81,7 +82,7 @@ void ll_debug_poll_fd(const char* msg, const apr_pollfd_t* poll)
#if LL_DEBUG_POLL_FILE_DESCRIPTORS
if(!poll)
{
- lldebugs << "Poll -- " << (msg?msg:"") << ": no pollfd." << llendl;
+ LL_DEBUGS() << "Poll -- " << (msg?msg:"") << ": no pollfd." << LL_ENDL;
return;
}
if(poll->desc.s)
@@ -89,13 +90,13 @@ void ll_debug_poll_fd(const char* msg, const apr_pollfd_t* poll)
apr_os_sock_t os_sock;
if(APR_SUCCESS == apr_os_sock_get(&os_sock, poll->desc.s))
{
- lldebugs << "Poll -- " << (msg?msg:"") << " on fd " << os_sock
- << " at " << poll->desc.s << llendl;
+ LL_DEBUGS() << "Poll -- " << (msg?msg:"") << " on fd " << os_sock
+ << " at " << poll->desc.s << LL_ENDL;
}
else
{
- lldebugs << "Poll -- " << (msg?msg:"") << " no fd "
- << " at " << poll->desc.s << llendl;
+ LL_DEBUGS() << "Poll -- " << (msg?msg:"") << " no fd "
+ << " at " << poll->desc.s << LL_ENDL;
}
}
else if(poll->desc.f)
@@ -103,18 +104,18 @@ void ll_debug_poll_fd(const char* msg, const apr_pollfd_t* poll)
apr_os_file_t os_file;
if(APR_SUCCESS == apr_os_file_get(&os_file, poll->desc.f))
{
- lldebugs << "Poll -- " << (msg?msg:"") << " on fd " << os_file
- << " at " << poll->desc.f << llendl;
+ LL_DEBUGS() << "Poll -- " << (msg?msg:"") << " on fd " << os_file
+ << " at " << poll->desc.f << LL_ENDL;
}
else
{
- lldebugs << "Poll -- " << (msg?msg:"") << " no fd "
- << " at " << poll->desc.f << llendl;
+ LL_DEBUGS() << "Poll -- " << (msg?msg:"") << " no fd "
+ << " at " << poll->desc.f << LL_ENDL;
}
}
else
{
- lldebugs << "Poll -- " << (msg?msg:"") << ": no descriptor." << llendl;
+ LL_DEBUGS() << "Poll -- " << (msg?msg:"") << ": no descriptor." << LL_ENDL;
}
#endif
}
@@ -203,10 +204,10 @@ bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request
info.mData->setThreaded(has_curl_request);
LLLinkInfo link;
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
- lldebugs << "LLPumpIO::addChain() " << chain[0] << " '"
- << typeid(*(chain[0])).name() << "'" << llendl;
+ LL_DEBUGS() << "LLPumpIO::addChain() " << chain[0] << " '"
+ << typeid(*(chain[0])).name() << "'" << LL_ENDL;
#else
- lldebugs << "LLPumpIO::addChain() " << chain[0] <<llendl;
+ LL_DEBUGS() << "LLPumpIO::addChain() " << chain[0] <<LL_ENDL;
#endif
chain_t::const_iterator it = chain.begin();
chain_t::const_iterator end = chain.end();
@@ -237,10 +238,10 @@ bool LLPumpIO::addChain(
LLScopedLock lock(mChainsMutex);
#endif
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
- lldebugs << "LLPumpIO::addChain() " << links[0].mPipe << " '"
- << typeid(*(links[0].mPipe)).name() << "'" << llendl;
+ LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << " '"
+ << typeid(*(links[0].mPipe)).name() << "'" << LL_ENDL;
#else
- lldebugs << "LLPumpIO::addChain() " << links[0].mPipe << llendl;
+ LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << LL_ENDL;
#endif
LLChainInfo info;
info.setTimeoutSeconds(timeout);
@@ -306,12 +307,12 @@ bool LLPumpIO::setConditional(LLIOPipe* pipe, const apr_pollfd_t* poll)
if(!pipe) return false;
ll_debug_poll_fd("Set conditional", poll);
- lldebugs << "Setting conditionals (" << (poll ? events_2_string(poll->reqevents) :"null")
+ LL_DEBUGS() << "Setting conditionals (" << (poll ? events_2_string(poll->reqevents) :"null")
<< ") "
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
<< "on pipe " << typeid(*pipe).name()
#endif
- << " at " << pipe << llendl;
+ << " at " << pipe << LL_ENDL;
// remove any matching poll file descriptors for this pipe.
LLIOPipe::ptr_t pipe_ptr(pipe);
@@ -430,8 +431,8 @@ void LLPumpIO::pump()
pump(DEFAULT_POLL_TIMEOUT);
}
-static LLFastTimer::DeclareTimer FTM_PUMP_IO("Pump IO");
-static LLFastTimer::DeclareTimer FTM_PUMP_POLL("Pump Poll");
+static LLTrace::BlockTimerStatHandle FTM_PUMP_IO("Pump IO");
+static LLTrace::BlockTimerStatHandle FTM_PUMP_POLL("Pump Poll");
LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t& run_chain)
{
@@ -445,8 +446,8 @@ LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t
//timeout is in microseconds
void LLPumpIO::pump(const S32& poll_timeout)
{
- LLFastTimer t1(FTM_PUMP_IO);
- //llinfos << "LLPumpIO::pump()" << llendl;
+ LL_RECORD_BLOCK_TIME(FTM_PUMP_IO);
+ //LL_INFOS() << "LLPumpIO::pump()" << LL_ENDL;
// Run any pending runners.
mRunner.run();
@@ -474,7 +475,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
if(!mPendingChains.empty())
{
PUMP_DEBUG;
- //lldebugs << "Pushing " << mPendingChains.size() << "." << llendl;
+ //LL_DEBUGS() << "Pushing " << mPendingChains.size() << "." << LL_ENDL;
std::copy(
mPendingChains.begin(),
mPendingChains.end(),
@@ -522,11 +523,11 @@ void LLPumpIO::pump(const S32& poll_timeout)
if(mPollset)
{
PUMP_DEBUG;
- //llinfos << "polling" << llendl;
+ //LL_INFOS() << "polling" << LL_ENDL;
S32 count = 0;
S32 client_id = 0;
{
- LLFastTimer _(FTM_PUMP_POLL);
+ LL_RECORD_BLOCK_TIME(FTM_PUMP_POLL);
apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd);
}
PUMP_DEBUG;
@@ -544,7 +545,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
signal_client_t::iterator not_signalled = signalled_client.end();
// Process everything as appropriate
- //lldebugs << "Running chain count: " << mRunningChains.size() << llendl;
+ //LL_DEBUGS() << "Running chain count: " << mRunningChains.size() << LL_ENDL;
running_chains_t::iterator run_chain = mRunningChains.begin();
bool process_this_chain = false;
while( run_chain != mRunningChains.end() )
@@ -564,9 +565,9 @@ void LLPumpIO::pump(const S32& poll_timeout)
&& (*run_chain).mTimer.hasExpired())
{
PUMP_DEBUG;
- llinfos << "Error handler forgot to reset timeout. "
+ LL_INFOS() << "Error handler forgot to reset timeout. "
<< "Resetting to " << DEFAULT_CHAIN_EXPIRY_SECS
- << " seconds." << llendl;
+ << " seconds." << LL_ENDL;
(*run_chain).setTimeoutSeconds(DEFAULT_CHAIN_EXPIRY_SECS);
}
}
@@ -576,15 +577,15 @@ void LLPumpIO::pump(const S32& poll_timeout)
// it timed out and no one handled it, so we need to
// retire the chain
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
- lldebugs << "Removing chain "
+ LL_DEBUGS() << "Removing chain "
<< (*run_chain).mChainLinks[0].mPipe
<< " '"
<< typeid(*((*run_chain).mChainLinks[0].mPipe)).name()
- << "' because it timed out." << llendl;
+ << "' because it timed out." << LL_ENDL;
#else
-// lldebugs << "Removing chain "
+// LL_DEBUGS() << "Removing chain "
// << (*run_chain).mChainLinks[0].mPipe
-// << " because we reached the end." << llendl;
+// << " because we reached the end." << LL_ENDL;
#endif
run_chain = removeRunningChain(run_chain);
continue;
@@ -609,12 +610,12 @@ void LLPumpIO::pump(const S32& poll_timeout)
{
// if there are no conditionals, just process this chain.
process_this_chain = true;
- //lldebugs << "no conditionals - processing" << llendl;
+ //LL_DEBUGS() << "no conditionals - processing" << LL_ENDL;
}
else
{
PUMP_DEBUG;
- //lldebugs << "checking conditionals" << llendl;
+ //LL_DEBUGS() << "checking conditionals" << LL_ENDL;
// Check if this run chain was signalled. If any file
// descriptor is ready for something, then go ahead and
// process this chian.
@@ -654,7 +655,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
error_status = LLIOPipe::STATUS_ERROR;
if(handleChainError(*run_chain, error_status)) break;
ll_debug_poll_fd("Removing pipe", poll);
- llwarns << "Removing pipe "
+ LL_WARNS() << "Removing pipe "
<< (*run_chain).mChainLinks[0].mPipe
<< " '"
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
@@ -663,7 +664,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
#endif
<< "' because: "
<< events_2_string(poll->rtnevents)
- << llendl;
+ << LL_ENDL;
(*run_chain).mHead = (*run_chain).mChainLinks.end();
break;
}
@@ -691,13 +692,13 @@ void LLPumpIO::pump(const S32& poll_timeout)
if((*run_chain).mHead == (*run_chain).mChainLinks.end())
{
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
- lldebugs << "Removing chain " << (*run_chain).mChainLinks[0].mPipe
+ LL_DEBUGS() << "Removing chain " << (*run_chain).mChainLinks[0].mPipe
<< " '"
<< typeid(*((*run_chain).mChainLinks[0].mPipe)).name()
- << "' because we reached the end." << llendl;
+ << "' because we reached the end." << LL_ENDL;
#else
-// lldebugs << "Removing chain " << (*run_chain).mChainLinks[0].mPipe
-// << " because we reached the end." << llendl;
+// LL_DEBUGS() << "Removing chain " << (*run_chain).mChainLinks[0].mPipe
+// << " because we reached the end." << LL_ENDL;
#endif
PUMP_DEBUG;
@@ -773,11 +774,11 @@ bool LLPumpIO::respond(
return true;
}
-static LLFastTimer::DeclareTimer FTM_PUMP_CALLBACK_CHAIN("Chain");
+static LLTrace::BlockTimerStatHandle FTM_PUMP_CALLBACK_CHAIN("Chain");
void LLPumpIO::callback()
{
- //llinfos << "LLPumpIO::callback()" << llendl;
+ //LL_INFOS() << "LLPumpIO::callback()" << LL_ENDL;
if(true)
{
#if LL_THREADS_APR
@@ -795,7 +796,7 @@ void LLPumpIO::callback()
callbacks_t::iterator end = mCallbacks.end();
for(; it != end; ++it)
{
- LLFastTimer t(FTM_PUMP_CALLBACK_CHAIN);
+ LL_RECORD_BLOCK_TIME(FTM_PUMP_CALLBACK_CHAIN);
// it's always the first and last time for respone chains
(*it).mHead = (*it).mChainLinks.begin();
(*it).mInit = true;
@@ -846,7 +847,7 @@ void LLPumpIO::cleanup()
mCallbackMutex = NULL;
if(mPollset)
{
-// lldebugs << "cleaning up pollset" << llendl;
+// LL_DEBUGS() << "cleaning up pollset" << LL_ENDL;
apr_pollset_destroy(mPollset);
mPollset = NULL;
}
@@ -860,10 +861,10 @@ void LLPumpIO::cleanup()
void LLPumpIO::rebuildPollset()
{
-// lldebugs << "LLPumpIO::rebuildPollset()" << llendl;
+// LL_DEBUGS() << "LLPumpIO::rebuildPollset()" << LL_ENDL;
if(mPollset)
{
- //lldebugs << "destroying pollset" << llendl;
+ //LL_DEBUGS() << "destroying pollset" << LL_ENDL;
apr_pollset_destroy(mPollset);
mPollset = NULL;
}
@@ -874,7 +875,7 @@ void LLPumpIO::rebuildPollset()
{
size += (*run_it).mDescriptors.size();
}
- //lldebugs << "found " << size << " descriptors." << llendl;
+ //LL_DEBUGS() << "found " << size << " descriptors." << LL_ENDL;
if(size)
{
// Recycle the memory pool
@@ -921,10 +922,10 @@ void LLPumpIO::processChain(LLChainInfo& chain)
{
#if LL_DEBUG_PROCESS_LINK
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
- llinfos << "Processing " << typeid(*((*it).mPipe)).name() << "."
- << llendl;
+ LL_INFOS() << "Processing " << typeid(*((*it).mPipe)).name() << "."
+ << LL_ENDL;
#else
- llinfos << "Processing link " << (*it).mPipe << "." << llendl;
+ LL_INFOS() << "Processing link " << (*it).mPipe << "." << LL_ENDL;
#endif
#endif
#if LL_DEBUG_SPEW_BUFFER_CHANNEL_IN
@@ -941,15 +942,15 @@ void LLPumpIO::processChain(LLChainInfo& chain)
(U8*)buf,
bytes);
buf[bytes] = '\0';
- llinfos << "CHANNEL IN(" << (*it).mChannels.in() << "): "
- << buf << llendl;
+ LL_INFOS() << "CHANNEL IN(" << (*it).mChannels.in() << "): "
+ << buf << LL_ENDL;
delete[] buf;
buf = NULL;
}
else
{
- llinfos << "CHANNEL IN(" << (*it).mChannels.in()<< "): (null)"
- << llendl;
+ LL_INFOS() << "CHANNEL IN(" << (*it).mChannels.in()<< "): (null)"
+ << LL_ENDL;
}
}
#endif
@@ -974,15 +975,15 @@ void LLPumpIO::processChain(LLChainInfo& chain)
(U8*)buf,
bytes);
buf[bytes] = '\0';
- llinfos << "CHANNEL OUT(" << (*it).mChannels.out()<< "): "
- << buf << llendl;
+ LL_INFOS() << "CHANNEL OUT(" << (*it).mChannels.out()<< "): "
+ << buf << LL_ENDL;
delete[] buf;
buf = NULL;
}
else
{
- llinfos << "CHANNEL OUT(" << (*it).mChannels.out()<< "): (null)"
- << llendl;
+ LL_INFOS() << "CHANNEL OUT(" << (*it).mChannels.out()<< "): (null)"
+ << LL_ENDL;
}
}
#endif
@@ -992,11 +993,11 @@ void LLPumpIO::processChain(LLChainInfo& chain)
// below.
if(LLIOPipe::isSuccess(status))
{
- llinfos << "Pipe returned: '"
+ LL_INFOS() << "Pipe returned: '"
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
<< typeid(*((*it).mPipe)).name() << "':'"
#endif
- << LLIOPipe::lookupStatusString(status) << "'" << llendl;
+ << LLIOPipe::lookupStatusString(status) << "'" << LL_ENDL;
}
#endif
@@ -1036,12 +1037,12 @@ void LLPumpIO::processChain(LLChainInfo& chain)
PUMP_DEBUG;
if(LLIOPipe::isError(status))
{
- llinfos << "Pump generated pipe err: '"
+ LL_INFOS() << "Pump generated pipe err: '"
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
<< typeid(*((*it).mPipe)).name() << "':'"
#endif
<< LLIOPipe::lookupStatusString(status)
- << "'" << llendl;
+ << "'" << LL_ENDL;
#if LL_DEBUG_SPEW_BUFFER_CHANNEL_IN_ON_ERROR
if(chain.mData)
{
@@ -1058,18 +1059,18 @@ void LLPumpIO::processChain(LLChainInfo& chain)
(U8*)buf,
bytes);
buf[bytes] = '\0';
- llinfos << "Input After Error: " << buf << llendl;
+ LL_INFOS() << "Input After Error: " << buf << LL_ENDL;
delete[] buf;
buf = NULL;
}
else
{
- llinfos << "Input After Error: (null)" << llendl;
+ LL_INFOS() << "Input After Error: (null)" << LL_ENDL;
}
}
else
{
- llinfos << "Input After Error: (null)" << llendl;
+ LL_INFOS() << "Input After Error: (null)" << LL_ENDL;
}
#endif
keep_going = false;
@@ -1081,8 +1082,8 @@ void LLPumpIO::processChain(LLChainInfo& chain)
}
else
{
- llinfos << "Unhandled status code: " << status << ":"
- << LLIOPipe::lookupStatusString(status) << llendl;
+ LL_INFOS() << "Unhandled status code: " << status << ":"
+ << LLIOPipe::lookupStatusString(status) << LL_ENDL;
}
break;
}
@@ -1129,8 +1130,8 @@ bool LLPumpIO::handleChainError(
do
{
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
- lldebugs << "Passing error to " << typeid(*((*rit).mPipe)).name()
- << "." << llendl;
+ LL_DEBUGS() << "Passing error to " << typeid(*((*rit).mPipe)).name()
+ << "." << LL_ENDL;
#endif
error = (*rit).mPipe->handleError(error, this);
switch(error)
@@ -1144,8 +1145,8 @@ bool LLPumpIO::handleChainError(
case LLIOPipe::STATUS_BREAK:
case LLIOPipe::STATUS_NEED_PROCESS:
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
- lldebugs << "Pipe " << typeid(*((*rit).mPipe)).name()
- << " returned code to stop error handler." << llendl;
+ LL_DEBUGS() << "Pipe " << typeid(*((*rit).mPipe)).name()
+ << " returned code to stop error handler." << LL_ENDL;
#endif
keep_going = false;
break;
@@ -1155,8 +1156,8 @@ bool LLPumpIO::handleChainError(
default:
if(LLIOPipe::isSuccess(error))
{
- llinfos << "Unhandled status code: " << error << ":"
- << LLIOPipe::lookupStatusString(error) << llendl;
+ LL_INFOS() << "Unhandled status code: " << error << ":"
+ << LLIOPipe::lookupStatusString(error) << LL_ENDL;
error = LLIOPipe::STATUS_ERROR;
keep_going = false;
}
diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h
index 1cf940918b..40d7b04a90 100755
--- a/indra/llmessage/llregionflags.h
+++ b/indra/llmessage/llregionflags.h
@@ -76,6 +76,8 @@ const U64 REGION_FLAGS_DENY_ANONYMOUS = (1 << 23);
const U64 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1 << 26);
+const U64 REGION_FLAGS_BLOCK_FLYOVER = (1 << 27);
+
const U64 REGION_FLAGS_ALLOW_VOICE = (1 << 28);
const U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29);
diff --git a/indra/llmessage/llregionhandle.h b/indra/llmessage/llregionhandle.h
index c77794e4b8..e3ddd46acd 100755
--- a/indra/llmessage/llregionhandle.h
+++ b/indra/llmessage/llregionhandle.h
@@ -68,7 +68,7 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl
U32 x_int, y_int;
if (x_pos < 0.f)
{
-// llwarns << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << llendl;
+// LL_WARNS() << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << LL_ENDL;
return FALSE;
}
else
@@ -77,7 +77,7 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl
}
if (y_pos < 0.f)
{
-// llwarns << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << llendl;
+// LL_WARNS() << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << LL_ENDL;
return FALSE;
}
else
diff --git a/indra/llmessage/llregionpresenceverifier.cpp b/indra/llmessage/llregionpresenceverifier.cpp
deleted file mode 100755
index 932cbf375e..0000000000
--- a/indra/llmessage/llregionpresenceverifier.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * @file llregionpresenceverifier.cpp
- * @brief
- *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-#include "llregionpresenceverifier.h"
-#include "llhttpclientinterface.h"
-#include <sstream>
-#include "net.h"
-#include "message.h"
-
-namespace boost
-{
- void intrusive_ptr_add_ref(LLRegionPresenceVerifier::Response* p)
- {
- ++p->mReferenceCount;
- }
-
- void intrusive_ptr_release(LLRegionPresenceVerifier::Response* p)
- {
- if(p && 0 == --p->mReferenceCount)
- {
- delete p;
- }
- }
-};
-
-LLRegionPresenceVerifier::Response::~Response()
-{
-}
-
-LLRegionPresenceVerifier::RegionResponder::RegionResponder(const std::string&
- uri,
- ResponsePtr data,
- S32 retry_count) :
- mUri(uri),
- mSharedData(data),
- mRetryCount(retry_count)
-{
-}
-
-//virtual
-LLRegionPresenceVerifier::RegionResponder::~RegionResponder()
-{
-}
-
-void LLRegionPresenceVerifier::RegionResponder::result(const LLSD& content)
-{
- std::string host = content["private_host"].asString();
- U32 port = content["private_port"].asInteger();
- LLHost destination(host, port);
- LLUUID id = content["region_id"];
-
- lldebugs << "Verifying " << destination.getString() << " is region " << id << llendl;
-
- std::stringstream uri;
- uri << "http://" << destination.getString() << "/state/basic/";
- mSharedData->getHttpClient().get(
- uri.str(),
- new VerifiedDestinationResponder(mUri, mSharedData, content, mRetryCount));
-}
-
-void LLRegionPresenceVerifier::RegionResponder::error(U32 status,
- const std::string& reason)
-{
- // TODO: babbage: distinguish between region presence service and
- // region verification errors?
- mSharedData->onRegionVerificationFailed();
-}
-
-LLRegionPresenceVerifier::VerifiedDestinationResponder::VerifiedDestinationResponder(const std::string& uri, ResponsePtr data, const LLSD& content,
- S32 retry_count):
- mUri(uri),
- mSharedData(data),
- mContent(content),
- mRetryCount(retry_count)
-{
-}
-
-//virtual
-LLRegionPresenceVerifier::VerifiedDestinationResponder::~VerifiedDestinationResponder()
-{
-}
-
-void LLRegionPresenceVerifier::VerifiedDestinationResponder::result(const LLSD& content)
-{
- LLUUID actual_region_id = content["region_id"];
- LLUUID expected_region_id = mContent["region_id"];
-
- lldebugs << "Actual region: " << content << llendl;
- lldebugs << "Expected region: " << mContent << llendl;
-
- if (mSharedData->checkValidity(content) &&
- (actual_region_id == expected_region_id))
- {
- mSharedData->onRegionVerified(mContent);
- }
- else if (mRetryCount > 0)
- {
- retry();
- }
- else
- {
- llwarns << "Simulator verification failed. Region: " << mUri << llendl;
- mSharedData->onRegionVerificationFailed();
- }
-}
-
-void LLRegionPresenceVerifier::VerifiedDestinationResponder::retry()
-{
- LLSD headers;
- headers["Cache-Control"] = "no-cache, max-age=0";
- llinfos << "Requesting region information, get uncached for region "
- << mUri << llendl;
- --mRetryCount;
- mSharedData->getHttpClient().get(mUri, new RegionResponder(mUri, mSharedData, mRetryCount), headers);
-}
-
-void LLRegionPresenceVerifier::VerifiedDestinationResponder::error(U32 status, const std::string& reason)
-{
- if(mRetryCount > 0)
- {
- retry();
- }
- else
- {
- llwarns << "Failed to contact simulator for verification. Region: " << mUri << llendl;
- mSharedData->onRegionVerificationFailed();
- }
-}
diff --git a/indra/llmessage/llregionpresenceverifier.h b/indra/llmessage/llregionpresenceverifier.h
deleted file mode 100755
index 5e8251e519..0000000000
--- a/indra/llmessage/llregionpresenceverifier.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * @file llregionpresenceverifier.cpp
- * @brief
- *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-/* Macro Definitions */
-#ifndef LL_LLREGIONPRESENCEVERIFIER_H
-#define LL_LLREGIONPRESENCEVERIFIER_H
-
-#include "llhttpclient.h"
-#include <string>
-#include "llsd.h"
-#include <boost/intrusive_ptr.hpp>
-
-class LLHTTPClientInterface;
-
-class LLRegionPresenceVerifier
-{
-public:
- class Response
- {
- public:
- virtual ~Response() = 0;
-
- virtual bool checkValidity(const LLSD& content) const = 0;
- virtual void onRegionVerified(const LLSD& region_details) = 0;
- virtual void onRegionVerificationFailed() = 0;
-
- virtual LLHTTPClientInterface& getHttpClient() = 0;
-
- public: /* but not really -- don't touch this */
- U32 mReferenceCount;
- };
-
- typedef boost::intrusive_ptr<Response> ResponsePtr;
-
- class RegionResponder : public LLHTTPClient::Responder
- {
- public:
- RegionResponder(const std::string& uri, ResponsePtr data,
- S32 retry_count);
- virtual ~RegionResponder();
- virtual void result(const LLSD& content);
- virtual void error(U32 status, const std::string& reason);
-
- private:
- ResponsePtr mSharedData;
- std::string mUri;
- S32 mRetryCount;
- };
-
- class VerifiedDestinationResponder : public LLHTTPClient::Responder
- {
- public:
- VerifiedDestinationResponder(const std::string& uri, ResponsePtr data,
- const LLSD& content, S32 retry_count);
- virtual ~VerifiedDestinationResponder();
- virtual void result(const LLSD& content);
-
- virtual void error(U32 status, const std::string& reason);
-
- private:
- void retry();
- ResponsePtr mSharedData;
- LLSD mContent;
- std::string mUri;
- S32 mRetryCount;
- };
-};
-
-namespace boost
-{
- void intrusive_ptr_add_ref(LLRegionPresenceVerifier::Response* p);
- void intrusive_ptr_release(LLRegionPresenceVerifier::Response* p);
-};
-
-#endif //LL_LLREGIONPRESENCEVERIFIER_H
diff --git a/indra/llmessage/llsdappservices.cpp b/indra/llmessage/llsdappservices.cpp
index 8bab91b0c0..4ca45267bd 100755
--- a/indra/llmessage/llsdappservices.cpp
+++ b/indra/llmessage/llsdappservices.cpp
@@ -119,9 +119,9 @@ public:
virtual bool validate(const std::string& name, LLSD& context) const
{
- //llinfos << "validate: " << name << ", "
- // << LLSDOStreamer<LLSDNotationFormatter>(context) << llendl;
- if((std::string("PUT") == context["request"]["verb"].asString()) && !name.empty())
+ //LL_INFOS() << "validate: " << name << ", "
+ // << LLSDOStreamer<LLSDNotationFormatter>(context) << LL_ENDL;
+ if((std::string("PUT") == context[CONTEXT_REQUEST][CONTEXT_VERB].asString()) && !name.empty())
{
return true;
}
@@ -139,7 +139,7 @@ public:
LLHTTPNode::ResponsePtr response,
const LLSD& context) const
{
- std::string name = context["request"]["wildcard"]["option-name"];
+ std::string name = context[CONTEXT_REQUEST][CONTEXT_WILDCARD]["option-name"];
LLSD options = LLApp::instance()->getOptionData(
LLApp::PRIORITY_RUNTIME_OVERRIDE);
response->result(options[name]);
@@ -150,7 +150,7 @@ public:
const LLSD& context,
const LLSD& input) const
{
- std::string name = context["request"]["wildcard"]["option-name"];
+ std::string name = context[CONTEXT_REQUEST][CONTEXT_WILDCARD]["option-name"];
LLSD options = LLApp::instance()->getOptionData(
LLApp::PRIORITY_RUNTIME_OVERRIDE);
options[name] = input;
@@ -164,7 +164,7 @@ public:
LLHTTPNode::ResponsePtr response,
const LLSD& context) const
{
- std::string name = context["request"]["wildcard"]["option-name"];
+ std::string name = context[CONTEXT_REQUEST][CONTEXT_WILDCARD]["option-name"];
LLSD options = LLApp::instance()->getOptionData(
LLApp::PRIORITY_RUNTIME_OVERRIDE);
options.erase(name);
@@ -257,8 +257,8 @@ public:
virtual bool validate(const std::string& name, LLSD& context) const
{
- llinfos << "LLHTTPLiveConfigSingleService::validate(" << name
- << ")" << llendl;
+ LL_INFOS() << "LLHTTPLiveConfigSingleService::validate(" << name
+ << ")" << LL_ENDL;
LLSD option = LLApp::instance()->getOption(name);
if(option.isDefined()) return true;
else return false;
@@ -268,7 +268,7 @@ public:
LLHTTPNode::ResponsePtr response,
const LLSD& context) const
{
- std::string name = context["request"]["wildcard"]["option-name"];
+ std::string name = context[CONTEXT_REQUEST][CONTEXT_WILDCARD]["option-name"];
response->result(LLApp::instance()->getOption(name));
}
};
diff --git a/indra/llmessage/llsdhttpserver.cpp b/indra/llmessage/llsdhttpserver.cpp
index 5c8fc7b2bb..8ac6b3cb12 100755
--- a/indra/llmessage/llsdhttpserver.cpp
+++ b/indra/llmessage/llsdhttpserver.cpp
@@ -109,7 +109,7 @@ public:
virtual void get(ResponsePtr response, const LLSD& context) const
{
- const LLSD& remainder = context["request"]["remainder"];
+ const LLSD& remainder = context[CONTEXT_REQUEST]["remainder"];
if (remainder.size() > 0)
{
diff --git a/indra/llmessage/llsdmessage.cpp b/indra/llmessage/llsdmessage.cpp
index 1c93c12d99..61fcc5dd2f 100755
--- a/indra/llmessage/llsdmessage.cpp
+++ b/indra/llmessage/llsdmessage.cpp
@@ -92,14 +92,14 @@ bool LLSDMessage::httpListener(const LLSD& request)
return false;
}
-void LLSDMessage::EventResponder::result(const LLSD& data)
+void LLSDMessage::EventResponder::httpSuccess()
{
// If our caller passed an empty replyPump name, they're not
// listening: this is a fire-and-forget message. Don't bother posting
// to the pump whose name is "".
if (! mReplyPump.empty())
{
- LLSD response(data);
+ LLSD response(getContent());
mReqID.stamp(response);
mPumps.obtain(mReplyPump).post(response);
}
@@ -111,7 +111,7 @@ void LLSDMessage::EventResponder::result(const LLSD& data)
}
}
-void LLSDMessage::EventResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content)
+void LLSDMessage::EventResponder::httpFailure()
{
// If our caller passed an empty errorPump name, they're not
// listening: "default error handling is acceptable." Only post to an
@@ -121,19 +121,17 @@ void LLSDMessage::EventResponder::errorWithContent(U32 status, const std::string
LLSD info(mReqID.makeResponse());
info["target"] = mTarget;
info["message"] = mMessage;
- info["status"] = LLSD::Integer(status);
- info["reason"] = reason;
- info["content"] = content;
+ info["status"] = getStatus();
+ info["reason"] = getReason();
+ info["content"] = getContent();
mPumps.obtain(mErrorPump).post(info);
}
else // default error handling
{
- // convention seems to be to use llinfos, but that seems a bit casual?
+ // convention seems to be to use LL_INFOS(), but that seems a bit casual?
LL_WARNS("LLSDMessage::EventResponder")
<< "'" << mMessage << "' to '" << mTarget
- << "' failed with code " << status << ": " << reason << '\n'
- << ll_pretty_print_sd(content)
- << LL_ENDL;
+ << "' failed " << dumpResponse() << LL_ENDL;
}
}
@@ -151,11 +149,11 @@ bool LLSDMessage::ResponderAdapter::listener(const LLSD& payload, bool success)
{
if (success)
{
- mResponder->result(payload);
+ mResponder->successResult(payload);
}
else
{
- mResponder->errorWithContent(payload["status"].asInteger(), payload["reason"], payload["content"]);
+ mResponder->failureResult(payload["status"].asInteger(), payload["reason"], payload["content"]);
}
/*---------------- MUST BE LAST STATEMENT BEFORE RETURN ----------------*/
diff --git a/indra/llmessage/llsdmessage.h b/indra/llmessage/llsdmessage.h
index 0d34847ff2..e5d532d6a4 100755
--- a/indra/llmessage/llsdmessage.h
+++ b/indra/llmessage/llsdmessage.h
@@ -123,6 +123,7 @@ private:
/// LLCapabilityListener. Others should use higher-level APIs.
class EventResponder: public LLHTTPClient::Responder
{
+ LOG_CLASS(EventResponder);
public:
/**
* LLHTTPClient::Responder that dispatches via named LLEventPump instances.
@@ -149,8 +150,9 @@ private:
mErrorPump(errorPump)
{}
- virtual void result(const LLSD& data);
- virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content);
+ protected:
+ virtual void httpSuccess();
+ virtual void httpFailure();
private:
LLEventPumps& mPumps;
diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp
index 615221e0ad..49456c71ed 100755
--- a/indra/llmessage/llsdmessagebuilder.cpp
+++ b/indra/llmessage/llsdmessagebuilder.cpp
@@ -91,7 +91,7 @@ void LLSDMessageBuilder::nextBlock(const char* blockname)
}
else
{
- llerrs << "existing block not array" << llendl;
+ LL_ERRS() << "existing block not array" << LL_ENDL;
}
}
@@ -380,7 +380,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data)
break;
default:
- llwarns << "Unknown type in conversion of message to LLSD" << llendl;
+ LL_WARNS() << "Unknown type in conversion of message to LLSD" << LL_ENDL;
break;
}
}
@@ -391,7 +391,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data)
void LLSDMessageBuilder::copyFromLLSD(const LLSD& msg)
{
mCurrentMessage = msg;
- lldebugs << LLSDNotationStreamer(mCurrentMessage) << llendl;
+ LL_DEBUGS() << LLSDNotationStreamer(mCurrentMessage) << LL_ENDL;
}
const LLSD& LLSDMessageBuilder::getMessage() const
diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp
index a6fccd2a56..b729ebafa9 100755
--- a/indra/llmessage/llsdmessagereader.cpp
+++ b/indra/llmessage/llsdmessagereader.cpp
@@ -53,16 +53,16 @@ LLSDMessageReader::~LLSDMessageReader()
LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum)
{
- // babbage: log error to llerrs if variable not found to mimic
+ // babbage: log error to LL_ERRS() if variable not found to mimic
// LLTemplateMessageReader::getData behaviour
if(NULL == block)
{
- llerrs << "NULL block name" << llendl;
+ LL_ERRS() << "NULL block name" << LL_ENDL;
return LLSD();
}
if(NULL == var)
{
- llerrs << "NULL var name" << llendl;
+ LL_ERRS() << "NULL var name" << LL_ENDL;
return LLSD();
}
if(! input[block].isArray())
@@ -70,7 +70,7 @@ LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum
// NOTE: babbage: need to return default for missing blocks to allow
// backwards/forwards compatibility - handlers must cope with default
// values.
- llwarns << "block " << block << " not found" << llendl;
+ LL_WARNS() << "block " << block << " not found" << LL_ENDL;
return LLSD();
}
@@ -80,7 +80,7 @@ LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum
// NOTE: babbage: need to return default for missing vars to allow
// backwards/forwards compatibility - handlers must cope with default
// values.
- llwarns << "var " << var << " not found" << llendl;
+ LL_WARNS() << "var " << var << " not found" << LL_ENDL;
}
return result;
}
@@ -238,7 +238,7 @@ void LLSDMessageReader::getString(const char *block, const char *var,
{
if(buffer_size <= 0)
{
- llwarns << "buffer_size <= 0" << llendl;
+ LL_WARNS() << "buffer_size <= 0" << LL_ENDL;
return;
}
std::string data = getLLSD(mMessage, block, var, blocknum);
diff --git a/indra/llmessage/llsdrpcclient.cpp b/indra/llmessage/llsdrpcclient.cpp
index fcda0e81a3..eb773ceb3a 100755
--- a/indra/llmessage/llsdrpcclient.cpp
+++ b/indra/llmessage/llsdrpcclient.cpp
@@ -30,6 +30,7 @@
#include "llsdrpcclient.h"
#include "llbufferstream.h"
+#include "llfasttimer.h"
#include "llfiltersd2xmlrpc.h"
#include "llpumpio.h"
#include "llsd.h"
@@ -78,7 +79,7 @@ bool LLSDRPCResponse::extractResponse(const LLSD& sd)
return rv;
}
-static LLFastTimer::DeclareTimer FTM_SDRPC_RESPONSE("SDRPC Response");
+static LLTrace::BlockTimerStatHandle FTM_SDRPC_RESPONSE("SDRPC Response");
// virtual
LLIOPipe::EStatus LLSDRPCResponse::process_impl(
@@ -88,7 +89,7 @@ LLIOPipe::EStatus LLSDRPCResponse::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_SDRPC_RESPONSE);
+ LL_RECORD_BLOCK_TIME(FTM_SDRPC_RESPONSE);
PUMP_DEBUG;
if(mIsError)
{
@@ -128,8 +129,8 @@ bool LLSDRPCClient::call(
LLSDRPCResponse* response,
EPassBackQueue queue)
{
- //llinfos << "RPC: " << uri << "." << method << "(" << *parameter << ")"
- // << llendl;
+ //LL_INFOS() << "RPC: " << uri << "." << method << "(" << *parameter << ")"
+ // << LL_ENDL;
if(method.empty() || !response)
{
return false;
@@ -154,8 +155,8 @@ bool LLSDRPCClient::call(
LLSDRPCResponse* response,
EPassBackQueue queue)
{
- //llinfos << "RPC: " << uri << "." << method << "(" << parameter << ")"
- // << llendl;
+ //LL_INFOS() << "RPC: " << uri << "." << method << "(" << parameter << ")"
+ // << LL_ENDL;
if(method.empty() || parameter.empty() || !response)
{
return false;
@@ -172,7 +173,7 @@ bool LLSDRPCClient::call(
return true;
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_SDRPC_CLIENT("SDRPC Client");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_SDRPC_CLIENT("SDRPC Client");
// virtual
LLIOPipe::EStatus LLSDRPCClient::process_impl(
@@ -182,7 +183,7 @@ LLIOPipe::EStatus LLSDRPCClient::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_SDRPC_CLIENT);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_SDRPC_CLIENT);
PUMP_DEBUG;
if((STATE_NONE == mState) || (!pump))
{
@@ -195,7 +196,7 @@ LLIOPipe::EStatus LLSDRPCClient::process_impl(
case STATE_READY:
{
PUMP_DEBUG;
-// lldebugs << "LLSDRPCClient::process_impl STATE_READY" << llendl;
+// LL_DEBUGS() << "LLSDRPCClient::process_impl STATE_READY" << LL_ENDL;
buffer->append(
channels.out(),
(U8*)mRequest.c_str(),
@@ -208,8 +209,8 @@ LLIOPipe::EStatus LLSDRPCClient::process_impl(
{
PUMP_DEBUG;
// The input channel has the sd response in it.
- //lldebugs << "LLSDRPCClient::process_impl STATE_WAITING_FOR_RESPONSE"
- // << llendl;
+ //LL_DEBUGS() << "LLSDRPCClient::process_impl STATE_WAITING_FOR_RESPONSE"
+ // << LL_ENDL;
LLBufferStream resp(channels, buffer.get());
LLSD sd;
LLSDSerialize::fromNotation(sd, resp, buffer->count(channels.in()));
@@ -236,7 +237,7 @@ LLIOPipe::EStatus LLSDRPCClient::process_impl(
case STATE_DONE:
default:
PUMP_DEBUG;
- llinfos << "invalid state to process" << llendl;
+ LL_INFOS() << "invalid state to process" << LL_ENDL;
rv = STATUS_ERROR;
break;
}
diff --git a/indra/llmessage/llsdrpcclient.h b/indra/llmessage/llsdrpcclient.h
index 0cecf4f688..c4e0333ca3 100755
--- a/indra/llmessage/llsdrpcclient.h
+++ b/indra/llmessage/llsdrpcclient.h
@@ -239,11 +239,11 @@ public:
LLSDRPCClientFactory(const std::string& fixed_url) : mURL(fixed_url) {}
virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
{
- lldebugs << "LLSDRPCClientFactory::build" << llendl;
- LLURLRequest* http(new LLURLRequest(LLURLRequest::HTTP_POST));
+ LL_DEBUGS() << "LLSDRPCClientFactory::build" << LL_ENDL;
+ LLURLRequest* http(new LLURLRequest(HTTP_POST));
if(!http->isValid())
{
- llwarns << "Creating LLURLRequest failed." << llendl ;
+ LL_WARNS() << "Creating LLURLRequest failed." << LL_ENDL ;
delete http;
return false;
}
@@ -251,7 +251,7 @@ public:
LLIOPipe::ptr_t service(new Client);
chain.push_back(service);
LLIOPipe::ptr_t http_pipe(http);
- http->addHeader("Content-Type: text/llsd");
+ http->addHeader(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_TEXT_LLSD);
if(mURL.empty())
{
chain.push_back(LLIOPipe::ptr_t(new LLContextURLExtractor(http)));
@@ -289,19 +289,19 @@ public:
LLXMLSDRPCClientFactory(const std::string& fixed_url) : mURL(fixed_url) {}
virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
{
- lldebugs << "LLXMLSDRPCClientFactory::build" << llendl;
+ LL_DEBUGS() << "LLXMLSDRPCClientFactory::build" << LL_ENDL;
- LLURLRequest* http(new LLURLRequest(LLURLRequest::HTTP_POST));
+ LLURLRequest* http(new LLURLRequest(HTTP_POST));
if(!http->isValid())
{
- llwarns << "Creating LLURLRequest failed." << llendl ;
+ LL_WARNS() << "Creating LLURLRequest failed." << LL_ENDL ;
delete http;
return false ;
}
LLIOPipe::ptr_t service(new Client);
chain.push_back(service);
LLIOPipe::ptr_t http_pipe(http);
- http->addHeader("Content-Type: text/xml");
+ http->addHeader(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_TEXT_XML);
if(mURL.empty())
{
chain.push_back(LLIOPipe::ptr_t(new LLContextURLExtractor(http)));
diff --git a/indra/llmessage/llsdrpcserver.cpp b/indra/llmessage/llsdrpcserver.cpp
index f26ee52f71..c3ed19889e 100755
--- a/indra/llmessage/llsdrpcserver.cpp
+++ b/indra/llmessage/llsdrpcserver.cpp
@@ -31,6 +31,7 @@
#include "llbuffer.h"
#include "llbufferstream.h"
+#include "llfasttimer.h"
#include "llpumpio.h"
#include "llsdserialize.h"
#include "llstl.h"
@@ -94,7 +95,7 @@ void LLSDRPCServer::clearLock()
}
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_SDRPC_SERVER("SDRPC Server");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_SDRPC_SERVER("SDRPC Server");
// virtual
LLIOPipe::EStatus LLSDRPCServer::process_impl(
@@ -104,9 +105,9 @@ LLIOPipe::EStatus LLSDRPCServer::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_SDRPC_SERVER);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_SDRPC_SERVER);
PUMP_DEBUG;
-// lldebugs << "LLSDRPCServer::process_impl" << llendl;
+// LL_DEBUGS() << "LLSDRPCServer::process_impl" << LL_ENDL;
// Once we have all the data, We need to read the sd on
// the the in channel, and respond on the out channel
if(!eos) return STATUS_BREAK;
@@ -131,10 +132,10 @@ LLIOPipe::EStatus LLSDRPCServer::process_impl(
return STATUS_DONE;
case STATE_DONE:
-// lldebugs << "STATE_DONE" << llendl;
+// LL_DEBUGS() << "STATE_DONE" << LL_ENDL;
break;
case STATE_CALLBACK:
-// lldebugs << "STATE_CALLBACK" << llendl;
+// LL_DEBUGS() << "STATE_CALLBACK" << LL_ENDL;
PUMP_DEBUG;
method_name = mRequest[LLSDRPC_METHOD_SD_NAME].asString();
if(!method_name.empty() && mRequest.has(LLSDRPC_PARAMETER_SD_NAME))
@@ -168,7 +169,7 @@ LLIOPipe::EStatus LLSDRPCServer::process_impl(
mState = STATE_DONE;
break;
case STATE_NONE:
-// lldebugs << "STATE_NONE" << llendl;
+// LL_DEBUGS() << "STATE_NONE" << LL_ENDL;
default:
{
// First time we got here - process the SD request, and call
@@ -316,7 +317,7 @@ void LLSDRPCServer::buildFault(
{
LLBufferStream ostr(channels, data);
ostr << FAULT_PART_1 << code << FAULT_PART_2 << msg << FAULT_PART_3;
- llinfos << "LLSDRPCServer::buildFault: " << code << ", " << msg << llendl;
+ LL_INFOS() << "LLSDRPCServer::buildFault: " << code << ", " << msg << LL_ENDL;
}
// static
@@ -333,6 +334,6 @@ void LLSDRPCServer::buildResponse(
std::ostringstream debug_ostr;
debug_ostr << "LLSDRPCServer::buildResponse: ";
LLSDSerialize::toNotation(response, debug_ostr);
- llinfos << debug_ostr.str() << llendl;
+ LL_INFOS() << debug_ostr.str() << LL_ENDL;
#endif
}
diff --git a/indra/llmessage/llsdrpcserver.h b/indra/llmessage/llsdrpcserver.h
index 9e56e4ea46..415bd31c26 100755
--- a/indra/llmessage/llsdrpcserver.h
+++ b/indra/llmessage/llsdrpcserver.h
@@ -323,7 +323,7 @@ class LLSDRPCServerFactory : public LLChainIOFactory
public:
virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
{
- lldebugs << "LLXMLSDRPCServerFactory::build" << llendl;
+ LL_DEBUGS() << "LLXMLSDRPCServerFactory::build" << LL_ENDL;
chain.push_back(LLIOPipe::ptr_t(new Server));
return true;
}
@@ -341,7 +341,7 @@ class LLXMLRPCServerFactory : public LLChainIOFactory
public:
virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
{
- lldebugs << "LLXMLSDRPCServerFactory::build" << llendl;
+ LL_DEBUGS() << "LLXMLSDRPCServerFactory::build" << LL_ENDL;
chain.push_back(LLIOPipe::ptr_t(new LLFilterXMLRPCRequest2LLSD));
chain.push_back(LLIOPipe::ptr_t(new Server));
chain.push_back(LLIOPipe::ptr_t(new LLFilterSD2XMLRPCResponse));
diff --git a/indra/llmessage/llservice.cpp b/indra/llmessage/llservice.cpp
index dbec92c221..ddcc13d969 100755
--- a/indra/llmessage/llservice.cpp
+++ b/indra/llmessage/llservice.cpp
@@ -41,7 +41,7 @@ LLService::~LLService()
// static
bool LLService::registerCreator(const std::string& name, creator_t fn)
{
- llinfos << "LLService::registerCreator(" << name << ")" << llendl;
+ LL_INFOS() << "LLService::registerCreator(" << name << ")" << LL_ENDL;
if(name.empty())
{
return false;
@@ -64,7 +64,7 @@ LLIOPipe* LLService::activate(
{
if(name.empty())
{
- llinfos << "LLService::activate - no service specified." << llendl;
+ LL_INFOS() << "LLService::activate - no service specified." << LL_ENDL;
return NULL;
}
creators_t::iterator it = sCreatorFunctors.find(name);
@@ -79,15 +79,15 @@ LLIOPipe* LLService::activate(
{
// empty out the chain, because failed service creation
// should just discard this stuff.
- llwarns << "LLService::activate - unable to build chain: " << name
- << llendl;
+ LL_WARNS() << "LLService::activate - unable to build chain: " << name
+ << LL_ENDL;
chain.clear();
}
}
else
{
- llwarns << "LLService::activate - unable find factory: " << name
- << llendl;
+ LL_WARNS() << "LLService::activate - unable find factory: " << name
+ << LL_ENDL;
}
return rv;
}
diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp
index b9aef3d0ba..392e7f1091 100755
--- a/indra/llmessage/llservicebuilder.cpp
+++ b/indra/llmessage/llservicebuilder.cpp
@@ -50,11 +50,11 @@ void LLServiceBuilder::loadServiceDefinitionsFromFile(
std::string service_name = (*array_itr)["name"].asString();
createServiceDefinition(service_name, service_llsd);
}
- llinfos << "loaded config file: " << service_filename << llendl;
+ LL_INFOS() << "loaded config file: " << service_filename << LL_ENDL;
}
else
{
- llwarns << "unable to find config file: " << service_filename << llendl;
+ LL_WARNS() << "unable to find config file: " << service_filename << LL_ENDL;
}
}
@@ -119,7 +119,7 @@ std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) c
}
else
{
- llwarns << "Cannot find service " << service_name << llendl;
+ LL_WARNS() << "Cannot find service " << service_name << LL_ENDL;
}
return service_url.str();
}
@@ -204,9 +204,9 @@ std::string russ_format(const std::string& format_str, const LLSD& context)
}
else
{
- llwarns << "Unknown key: " << key << " in option map: "
+ LL_WARNS() << "Unknown key: " << key << " in option map: "
<< LLSDOStreamer<LLSDNotationFormatter>(context)
- << llendl;
+ << LL_ENDL;
keep_looping = false;
}
break;
@@ -220,8 +220,8 @@ std::string russ_format(const std::string& format_str, const LLSD& context)
}
break;
default:
- llinfos << "Unknown directive: " << *(deepest_node + 1)
- << llendl;
+ LL_INFOS() << "Unknown directive: " << *(deepest_node + 1)
+ << LL_ENDL;
keep_looping = false;
break;
}
@@ -229,8 +229,8 @@ std::string russ_format(const std::string& format_str, const LLSD& context)
}
if (service_url.find('{') != std::string::npos)
{
- llwarns << "Constructed a likely bogus service URL: " << service_url
- << llendl;
+ LL_WARNS() << "Constructed a likely bogus service URL: " << service_url
+ << LL_ENDL;
}
return service_url;
}
diff --git a/indra/llmessage/lltemplatemessagebuilder.cpp b/indra/llmessage/lltemplatemessagebuilder.cpp
index 9e8eb48460..8d7c4c0282 100755
--- a/indra/llmessage/lltemplatemessagebuilder.cpp
+++ b/indra/llmessage/lltemplatemessagebuilder.cpp
@@ -81,7 +81,7 @@ void LLTemplateMessageBuilder::newMessage(const char *name)
if (msg_template->getDeprecation() != MD_NOTDEPRECATED)
{
- llwarns << "Sending deprecated message " << namep << llendl;
+ LL_WARNS() << "Sending deprecated message " << namep << LL_ENDL;
}
LLMessageTemplate::message_block_map_t::const_iterator iter;
@@ -96,7 +96,7 @@ void LLTemplateMessageBuilder::newMessage(const char *name)
}
else
{
- llerrs << "newMessage - Message " << name << " not registered" << llendl;
+ LL_ERRS() << "newMessage - Message " << name << " not registered" << LL_ENDL;
}
}
@@ -125,7 +125,7 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname)
if (!mCurrentSMessageTemplate)
{
- llerrs << "newMessage not called prior to setBlock" << llendl;
+ LL_ERRS() << "newMessage not called prior to setBlock" << LL_ENDL;
return;
}
@@ -133,8 +133,8 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname)
const LLMessageBlock* template_data = mCurrentSMessageTemplate->getBlock(bnamep);
if (!template_data)
{
- llerrs << "LLTemplateMessageBuilder::nextBlock " << bnamep
- << " not a block in " << mCurrentSMessageTemplate->mName << llendl;
+ LL_ERRS() << "LLTemplateMessageBuilder::nextBlock " << bnamep
+ << " not a block in " << mCurrentSMessageTemplate->mName << LL_ENDL;
return;
}
@@ -164,8 +164,8 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname)
// if the block is type MBT_SINGLE this is bad!
if (template_data->mType == MBT_SINGLE)
{
- llerrs << "LLTemplateMessageBuilder::nextBlock called multiple times"
- << " for " << bnamep << " but is type MBT_SINGLE" << llendl;
+ LL_ERRS() << "LLTemplateMessageBuilder::nextBlock called multiple times"
+ << " for " << bnamep << " but is type MBT_SINGLE" << LL_ENDL;
return;
}
@@ -175,10 +175,10 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname)
if ( (template_data->mType == MBT_MULTIPLE)
&&(mCurrentSDataBlock->mBlockNumber == template_data->mNumber))
{
- llerrs << "LLTemplateMessageBuilder::nextBlock called "
+ LL_ERRS() << "LLTemplateMessageBuilder::nextBlock called "
<< mCurrentSDataBlock->mBlockNumber << " times for " << bnamep
<< " exceeding " << template_data->mNumber
- << " specified in type MBT_MULTIPLE." << llendl;
+ << " specified in type MBT_MULTIPLE." << LL_ENDL;
return;
}
@@ -191,8 +191,8 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname)
if (block_data->mBlockNumber > MAX_BLOCKS)
{
- llerrs << "Trying to pack too many blocks into MBT_VARIABLE type "
- << "(limited to " << MAX_BLOCKS << ")" << llendl;
+ LL_ERRS() << "Trying to pack too many blocks into MBT_VARIABLE type "
+ << "(limited to " << MAX_BLOCKS << ")" << LL_ENDL;
}
// create new name
@@ -263,11 +263,11 @@ BOOL LLTemplateMessageBuilder::removeLastBlock()
if (num_blocks <= 1)
{
// we just blew away the last one, so return FALSE
- llwarns << "not blowing away the only block of message "
+ LL_WARNS() << "not blowing away the only block of message "
<< mCurrentSMessageName
<< ". Block: " << block_name
<< ". Number: " << num_blocks
- << llendl;
+ << LL_ENDL;
return FALSE;
}
else
@@ -290,14 +290,14 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM
// do we have a current message?
if (!mCurrentSMessageTemplate)
{
- llerrs << "newMessage not called prior to addData" << llendl;
+ LL_ERRS() << "newMessage not called prior to addData" << LL_ENDL;
return;
}
// do we have a current block?
if (!mCurrentSDataBlock)
{
- llerrs << "setBlock not called prior to addData" << llendl;
+ LL_ERRS() << "setBlock not called prior to addData" << LL_ENDL;
return;
}
@@ -305,7 +305,7 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM
const LLMessageVariable* var_data = mCurrentSMessageTemplate->getBlock(mCurrentSBlockName)->getVariable(vnamep);
if (!var_data || !var_data->getName())
{
- llerrs << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << llendl;
+ LL_ERRS() << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << LL_ENDL;
return;
}
@@ -316,9 +316,9 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM
if ((var_data->getSize() == 1) &&
(size > 255))
{
- llwarns << "Field " << varname << " is a Variable 1 but program "
+ LL_WARNS() << "Field " << varname << " is a Variable 1 but program "
<< "attempted to stuff more than 255 bytes in "
- << "(" << size << "). Clamping size and truncating data." << llendl;
+ << "(" << size << "). Clamping size and truncating data." << LL_ENDL;
size = 255;
char *truncate = (char *)data;
truncate[254] = 0; // array size is 255 but the last element index is 254
@@ -332,8 +332,8 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM
{
if (size != var_data->getSize())
{
- llerrs << varname << " is type MVT_FIXED but request size " << size << " doesn't match template size "
- << var_data->getSize() << llendl;
+ LL_ERRS() << varname << " is type MVT_FIXED but request size " << size << " doesn't match template size "
+ << var_data->getSize() << LL_ENDL;
return;
}
// alright, smash it in
@@ -350,14 +350,14 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM
// do we have a current message?
if (!mCurrentSMessageTemplate)
{
- llerrs << "newMessage not called prior to addData" << llendl;
+ LL_ERRS() << "newMessage not called prior to addData" << LL_ENDL;
return;
}
// do we have a current block?
if (!mCurrentSDataBlock)
{
- llerrs << "setBlock not called prior to addData" << llendl;
+ LL_ERRS() << "setBlock not called prior to addData" << LL_ENDL;
return;
}
@@ -365,7 +365,7 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM
const LLMessageVariable* var_data = mCurrentSMessageTemplate->getBlock(mCurrentSBlockName)->getVariable(vnamep);
if (!var_data->getName())
{
- llerrs << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << llendl;
+ LL_ERRS() << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << LL_ENDL;
return;
}
@@ -373,7 +373,7 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM
if (var_data->getType() == MVT_VARIABLE)
{
// nope
- llerrs << vnamep << " is type MVT_VARIABLE. Call using addData(name, data, size)" << llendl;
+ LL_ERRS() << vnamep << " is type MVT_VARIABLE. Call using addData(name, data, size)" << LL_ENDL;
return;
}
else
@@ -643,8 +643,8 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat
// Just reporting error is likely not enough. Need
// to check how to abort or error out gracefully
// from this function. XXXTBD
- llerrs << "buildBlock failed. Message excedding "
- << "sendBuffersize." << llendl;
+ LL_ERRS() << "buildBlock failed. Message excedding "
+ << "sendBuffersize." << LL_ENDL;
}
}
else if (template_data->mType == MBT_MULTIPLE)
@@ -652,10 +652,10 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat
if (block_count != template_data->mNumber)
{
// nope! need to fill it in all the way!
- llerrs << "Block " << mbci->mName
+ LL_ERRS() << "Block " << mbci->mName
<< " is type MBT_MULTIPLE but only has data for "
<< block_count << " out of its "
- << template_data->mNumber << " blocks" << llendl;
+ << template_data->mNumber << " blocks" << LL_ENDL;
}
}
@@ -669,10 +669,10 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat
if (mvci.getSize() == -1)
{
// oops, this variable wasn't ever set!
- llerrs << "The variable " << mvci.getName() << " in block "
+ LL_ERRS() << "The variable " << mvci.getName() << " in block "
<< mbci->mName << " of message "
<< template_data->mName
- << " wasn't set prior to buildMessage call" << llendl;
+ << " wasn't set prior to buildMessage call" << LL_ENDL;
}
else
{
@@ -699,7 +699,7 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat
htonmemcpy(&buffer[result], &size, MVT_S32, 4);
break;
default:
- llerrs << "Attempting to build variable field with unknown size of " << size << llendl;
+ LL_ERRS() << "Attempting to build variable field with unknown size of " << size << LL_ENDL;
break;
}
result += mvci.getDataSize();
@@ -721,11 +721,11 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat
// Just reporting error is likely not
// enough. Need to check how to abort or error
// out gracefully from this function. XXXTBD
- llerrs << "buildBlock failed. "
+ LL_ERRS() << "buildBlock failed. "
<< "Attempted to pack "
<< (result + mvci.getSize())
<< " bytes into a buffer with size "
- << buffer_size << "." << llendl;
+ << buffer_size << "." << LL_ENDL;
}
}
}
@@ -760,7 +760,7 @@ U32 LLTemplateMessageBuilder::buildMessage(
// do we have a current message?
if (!mCurrentSMessageTemplate)
{
- llerrs << "newMessage not called prior to buildMessage" << llendl;
+ LL_ERRS() << "newMessage not called prior to buildMessage" << LL_ENDL;
return 0;
}
@@ -809,7 +809,7 @@ U32 LLTemplateMessageBuilder::buildMessage(
}
else
{
- llerrs << "unexpected message frequency in buildMessage" << llendl;
+ LL_ERRS() << "unexpected message frequency in buildMessage" << LL_ENDL;
return 0;
}
diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp
index 94bc7cb045..406afadd2f 100755
--- a/indra/llmessage/lltemplatemessagereader.cpp
+++ b/indra/llmessage/lltemplatemessagereader.cpp
@@ -68,13 +68,13 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname
// is there a message ready to go?
if (mReceiveSize == -1)
{
- llerrs << "No message waiting for decode 2!" << llendl;
+ LL_ERRS() << "No message waiting for decode 2!" << LL_ENDL;
return;
}
if (!mCurrentRMessageData)
{
- llerrs << "Invalid mCurrentMessageData in getData!" << llendl;
+ LL_ERRS() << "Invalid mCurrentMessageData in getData!" << LL_ENDL;
return;
}
@@ -85,8 +85,8 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname
if (iter == mCurrentRMessageData->mMemberBlocks.end())
{
- llerrs << "Block " << blockname << " #" << blocknum
- << " not in message " << mCurrentRMessageData->mName << llendl;
+ LL_ERRS() << "Block " << blockname << " #" << blocknum
+ << " not in message " << mCurrentRMessageData->mName << LL_ENDL;
return;
}
@@ -95,8 +95,8 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname
if (var_data_map.find(vnamep) == var_data_map.end())
{
- llerrs << "Variable "<< vnamep << " not in message "
- << mCurrentRMessageData->mName<< " block " << bnamep << llendl;
+ LL_ERRS() << "Variable "<< vnamep << " not in message "
+ << mCurrentRMessageData->mName<< " block " << bnamep << LL_ENDL;
return;
}
@@ -104,11 +104,11 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname
if (size && size != vardata.getSize())
{
- llerrs << "Msg " << mCurrentRMessageData->mName
+ LL_ERRS() << "Msg " << mCurrentRMessageData->mName
<< " variable " << vnamep
<< " is size " << vardata.getSize()
<< " but copying into buffer of size " << size
- << llendl;
+ << LL_ENDL;
return;
}
@@ -138,11 +138,11 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname
}
else
{
- llwarns << "Msg " << mCurrentRMessageData->mName
+ LL_WARNS() << "Msg " << mCurrentRMessageData->mName
<< " variable " << vnamep
<< " is size " << vardata.getSize()
<< " but truncated to max size of " << max_size
- << llendl;
+ << LL_ENDL;
memcpy(datap, vardata.getData(), max_size);
}
@@ -153,13 +153,13 @@ S32 LLTemplateMessageReader::getNumberOfBlocks(const char *blockname)
// is there a message ready to go?
if (mReceiveSize == -1)
{
- llerrs << "No message waiting for decode 3!" << llendl;
+ LL_ERRS() << "No message waiting for decode 3!" << LL_ENDL;
return -1;
}
if (!mCurrentRMessageData)
{
- llerrs << "Invalid mCurrentRMessageData in getData!" << llendl;
+ LL_ERRS() << "Invalid mCurrentRMessageData in getData!" << LL_ENDL;
return -1;
}
@@ -180,13 +180,13 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname)
// is there a message ready to go?
if (mReceiveSize == -1)
{ // This is a serious error - crash
- llerrs << "No message waiting for decode 4!" << llendl;
+ LL_ERRS() << "No message waiting for decode 4!" << LL_ENDL;
return LL_MESSAGE_ERROR;
}
if (!mCurrentRMessageData)
{ // This is a serious error - crash
- llerrs << "Invalid mCurrentRMessageData in getData!" << llendl;
+ LL_ERRS() << "Invalid mCurrentRMessageData in getData!" << LL_ENDL;
return LL_MESSAGE_ERROR;
}
@@ -196,8 +196,8 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname)
if (iter == mCurrentRMessageData->mMemberBlocks.end())
{ // don't crash
- llinfos << "Block " << bnamep << " not in message "
- << mCurrentRMessageData->mName << llendl;
+ LL_INFOS() << "Block " << bnamep << " not in message "
+ << mCurrentRMessageData->mName << LL_ENDL;
return LL_BLOCK_NOT_IN_MESSAGE;
}
@@ -208,15 +208,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname)
if (!vardata.getName())
{ // don't crash
- llinfos << "Variable " << varname << " not in message "
- << mCurrentRMessageData->mName << " block " << bnamep << llendl;
+ LL_INFOS() << "Variable " << varname << " not in message "
+ << mCurrentRMessageData->mName << " block " << bnamep << LL_ENDL;
return LL_VARIABLE_NOT_IN_BLOCK;
}
if (mCurrentRMessageTemplate->mMemberBlocks[bnamep]->mType != MBT_SINGLE)
{ // This is a serious error - crash
- llerrs << "Block " << bnamep << " isn't type MBT_SINGLE,"
- " use getSize with blocknum argument!" << llendl;
+ LL_ERRS() << "Block " << bnamep << " isn't type MBT_SINGLE,"
+ " use getSize with blocknum argument!" << LL_ENDL;
return LL_MESSAGE_ERROR;
}
@@ -228,13 +228,13 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const
// is there a message ready to go?
if (mReceiveSize == -1)
{ // This is a serious error - crash
- llerrs << "No message waiting for decode 5!" << llendl;
+ LL_ERRS() << "No message waiting for decode 5!" << LL_ENDL;
return LL_MESSAGE_ERROR;
}
if (!mCurrentRMessageData)
{ // This is a serious error - crash
- llerrs << "Invalid mCurrentRMessageData in getData!" << llendl;
+ LL_ERRS() << "Invalid mCurrentRMessageData in getData!" << LL_ENDL;
return LL_MESSAGE_ERROR;
}
@@ -245,8 +245,8 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const
if (iter == mCurrentRMessageData->mMemberBlocks.end())
{ // don't crash
- llinfos << "Block " << bnamep << " not in message "
- << mCurrentRMessageData->mName << llendl;
+ LL_INFOS() << "Block " << bnamep << " not in message "
+ << mCurrentRMessageData->mName << LL_ENDL;
return LL_BLOCK_NOT_IN_MESSAGE;
}
@@ -255,8 +255,8 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const
if (!vardata.getName())
{ // don't crash
- llinfos << "Variable " << vnamep << " not in message "
- << mCurrentRMessageData->mName << " block " << bnamep << llendl;
+ LL_INFOS() << "Variable " << vnamep << " not in message "
+ << mCurrentRMessageData->mName << " block " << bnamep << LL_ENDL;
return LL_VARIABLE_NOT_IN_BLOCK;
}
@@ -328,8 +328,8 @@ void LLTemplateMessageReader::getF32(const char *block, const char *var,
if( !llfinite( d ) )
{
- llwarns << "non-finite in getF32Fast " << block << " " << var
- << llendl;
+ LL_WARNS() << "non-finite in getF32Fast " << block << " " << var
+ << LL_ENDL;
d = 0;
}
}
@@ -341,8 +341,8 @@ void LLTemplateMessageReader::getF64(const char *block, const char *var,
if( !llfinite( d ) )
{
- llwarns << "non-finite in getF64Fast " << block << " " << var
- << llendl;
+ LL_WARNS() << "non-finite in getF64Fast " << block << " " << var
+ << LL_ENDL;
d = 0;
}
}
@@ -354,8 +354,8 @@ void LLTemplateMessageReader::getVector3(const char *block, const char *var,
if( !v.isFinite() )
{
- llwarns << "non-finite in getVector3Fast " << block << " "
- << var << llendl;
+ LL_WARNS() << "non-finite in getVector3Fast " << block << " "
+ << var << LL_ENDL;
v.zeroVec();
}
}
@@ -367,8 +367,8 @@ void LLTemplateMessageReader::getVector4(const char *block, const char *var,
if( !v.isFinite() )
{
- llwarns << "non-finite in getVector4Fast " << block << " "
- << var << llendl;
+ LL_WARNS() << "non-finite in getVector4Fast " << block << " "
+ << var << LL_ENDL;
v.zeroVec();
}
}
@@ -380,8 +380,8 @@ void LLTemplateMessageReader::getVector3d(const char *block, const char *var,
if( !v.isFinite() )
{
- llwarns << "non-finite in getVector3dFast " << block << " "
- << var << llendl;
+ LL_WARNS() << "non-finite in getVector3dFast " << block << " "
+ << var << LL_ENDL;
v.zeroVec();
}
@@ -398,8 +398,8 @@ void LLTemplateMessageReader::getQuat(const char *block, const char *var,
}
else
{
- llwarns << "non-finite in getQuatFast " << block << " " << var
- << llendl;
+ LL_WARNS() << "non-finite in getQuatFast " << block << " " << var
+ << LL_ENDL;
q.loadIdentity();
}
}
@@ -452,7 +452,7 @@ BOOL LLTemplateMessageReader::decodeTemplate(
// is there a message ready to go?
if (buffer_size <= 0)
{
- llwarns << "No message waiting for decode!" << llendl;
+ LL_WARNS() << "No message waiting for decode!" << LL_ENDL;
return(FALSE);
}
@@ -487,8 +487,8 @@ BOOL LLTemplateMessageReader::decodeTemplate(
}
else // bogus packet received (too short)
{
- llwarns << "Packet with unusable length received (too short): "
- << buffer_size << llendl;
+ LL_WARNS() << "Packet with unusable length received (too short): "
+ << buffer_size << LL_ENDL;
return(FALSE);
}
@@ -499,8 +499,8 @@ BOOL LLTemplateMessageReader::decodeTemplate(
}
else
{
- llwarns << "Message #" << std::hex << num << std::dec
- << " received but not registered!" << llendl;
+ LL_WARNS() << "Message #" << std::hex << num << std::dec
+ << " received but not registered!" << LL_ENDL;
gMessageSystem->callExceptionFunc(MX_UNREGISTERED_MESSAGE);
return(FALSE);
}
@@ -511,23 +511,23 @@ BOOL LLTemplateMessageReader::decodeTemplate(
void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted )
{
// we've run off the end of the packet!
- llwarns << "Ran off end of packet " << mCurrentRMessageTemplate->mName
+ LL_WARNS() << "Ran off end of packet " << mCurrentRMessageTemplate->mName
// << " with id " << mCurrentRecvPacketID
<< " from " << host
<< " trying to read " << wanted
<< " bytes at position " << where
<< " going past packet end at " << mReceiveSize
- << llendl;
+ << LL_ENDL;
if(gMessageSystem->mVerboseLog)
{
- llinfos << "MSG: -> " << host << "\tREAD PAST END:\t"
+ LL_INFOS() << "MSG: -> " << host << "\tREAD PAST END:\t"
// << mCurrentRecvPacketID << " "
- << getMessageName() << llendl;
+ << getMessageName() << LL_ENDL;
}
gMessageSystem->callExceptionFunc(MX_RAN_OFF_END_OF_PACKET);
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_MESSAGES("Process Messages");
// decode a given message
BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender )
@@ -588,7 +588,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
}
else
{
- llerrs << "Unknown block type" << llendl;
+ LL_ERRS() << "Unknown block type" << LL_ENDL;
return FALSE;
}
@@ -655,7 +655,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
htonmemcpy(&tsize, &buffer[decode_pos], MVT_U32, 4);
break;
default:
- llerrs << "Attempting to read variable field with unknown size of " << data_size << llendl;
+ LL_ERRS() << "Attempting to read variable field with unknown size of " << data_size << LL_ENDL;
break;
}
}
@@ -694,7 +694,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
if (mCurrentRMessageData->mMemberBlocks.empty()
&& !mCurrentRMessageTemplate->mMemberBlocks.empty())
{
- lldebugs << "Empty message '" << mCurrentRMessageTemplate->mName << "' (no blocks)" << llendl;
+ LL_DEBUGS() << "Empty message '" << mCurrentRMessageTemplate->mName << "' (no blocks)" << LL_ENDL;
return FALSE;
}
@@ -707,10 +707,10 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
}
{
- LLFastTimer t(FTM_PROCESS_MESSAGES);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_MESSAGES);
if( !mCurrentRMessageTemplate->callHandlerFunc(gMessageSystem) )
{
- llwarns << "Message from " << sender << " with no handler function received: " << mCurrentRMessageTemplate->mName << llendl;
+ LL_WARNS() << "Message from " << sender << " with no handler function received: " << mCurrentRMessageTemplate->mName << LL_ENDL;
}
}
@@ -740,9 +740,9 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
if(decode_time > LLMessageReader::getTimeDecodesSpamThreshold())
{
- lldebugs << "--------- Message " << mCurrentRMessageTemplate->mName << " decode took " << decode_time << " seconds. (" <<
+ LL_DEBUGS() << "--------- Message " << mCurrentRMessageTemplate->mName << " decode took " << decode_time << " seconds. (" <<
mCurrentRMessageTemplate->mMaxDecodeTimePerMsg << " max, " <<
- (mCurrentRMessageTemplate->mTotalDecodeTime / mCurrentRMessageTemplate->mTotalDecoded) << " avg)" << llendl;
+ (mCurrentRMessageTemplate->mTotalDecodeTime / mCurrentRMessageTemplate->mTotalDecoded) << " avg)" << LL_ENDL;
}
}
}
@@ -760,9 +760,9 @@ BOOL LLTemplateMessageReader::validateMessage(const U8* buffer,
if(valid)
{
mCurrentRMessageTemplate->mReceiveCount++;
- //lldebugs << "MessageRecvd:"
+ //LL_DEBUGS() << "MessageRecvd:"
// << mCurrentRMessageTemplate->mName
- // << " from " << sender << llendl;
+ // << " from " << sender << LL_ENDL;
}
if (valid && isBanned(trusted))
@@ -772,15 +772,15 @@ BOOL LLTemplateMessageReader::validateMessage(const U8* buffer,
<< getMessageName()
<< " from "
<< ((trusted) ? "trusted " : "untrusted ")
- << sender << llendl;
+ << sender << LL_ENDL;
valid = FALSE;
}
if(valid && isUdpBanned())
{
- llwarns << "Received UDP black listed message "
+ LL_WARNS() << "Received UDP black listed message "
<< getMessageName()
- << " from " << sender << llendl;
+ << " from " << sender << LL_ENDL;
valid = FALSE;
}
return valid;
diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp
index 64ebd51fec..e484bd258d 100755
--- a/indra/llmessage/llthrottle.cpp
+++ b/indra/llmessage/llthrottle.cpp
@@ -53,8 +53,8 @@ F32 LLThrottle::getAvailable()
{
// use a temporary bits_available
// since we don't want to change mBitsAvailable every time
- F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime);
- return mAvailable + (mRate * elapsed_time);
+ F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime;
+ return mAvailable + (mRate * elapsed_time.value());
}
BOOL LLThrottle::checkOverflow(const F32 amount)
@@ -65,8 +65,8 @@ BOOL LLThrottle::checkOverflow(const F32 amount)
// use a temporary bits_available
// since we don't want to change mBitsAvailable every time
- F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime);
- F32 amount_available = mAvailable + (mRate * elapsed_time);
+ F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime;
+ F32 amount_available = mAvailable + (mRate * elapsed_time.value());
if ((amount_available >= lookahead_amount) || (amount_available > amount))
{
@@ -80,17 +80,17 @@ BOOL LLThrottle::checkOverflow(const F32 amount)
BOOL LLThrottle::throttleOverflow(const F32 amount)
{
- F32 elapsed_time;
+ F32Seconds elapsed_time;
F32 lookahead_amount;
BOOL retval = TRUE;
lookahead_amount = mRate * mLookaheadSecs;
- F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
- elapsed_time = (F32)(mt_sec - mLastSendTime);
+ F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
+ elapsed_time = mt_sec - mLastSendTime;
mLastSendTime = mt_sec;
- mAvailable += mRate * elapsed_time;
+ mAvailable += mRate * elapsed_time.value();
if (mAvailable >= lookahead_amount)
{
@@ -222,7 +222,7 @@ void LLThrottleGroup::unpackThrottle(LLDataPacker &dp)
// into NOT resetting the system.
void LLThrottleGroup::resetDynamicAdjust()
{
- F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
S32 i;
for (i = 0; i < TC_EOF; i++)
{
@@ -269,8 +269,8 @@ S32 LLThrottleGroup::getAvailable(S32 throttle_cat)
// use a temporary bits_available
// since we don't want to change mBitsAvailable every time
- F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]);
- F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time);
+ F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat];
+ F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time.value());
if (bits_available >= lookahead_bits)
{
@@ -294,8 +294,8 @@ BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits)
// use a temporary bits_available
// since we don't want to change mBitsAvailable every time
- F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]);
- F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time);
+ F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat];
+ F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time.value());
if (bits_available >= lookahead_bits)
{
@@ -315,7 +315,7 @@ BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits)
BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits)
{
- F32 elapsed_time;
+ F32Seconds elapsed_time;
F32 category_bps;
F32 lookahead_bits;
BOOL retval = TRUE;
@@ -323,10 +323,10 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits)
category_bps = mCurrentBPS[throttle_cat];
lookahead_bits = category_bps * THROTTLE_LOOKAHEAD_TIME;
- F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
- elapsed_time = (F32)(mt_sec - mLastSendTime[throttle_cat]);
+ F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
+ elapsed_time = mt_sec - mLastSendTime[throttle_cat];
mLastSendTime[throttle_cat] = mt_sec;
- mBitsAvailable[throttle_cat] += category_bps * elapsed_time;
+ mBitsAvailable[throttle_cat] += category_bps * elapsed_time.value();
if (mBitsAvailable[throttle_cat] >= lookahead_bits)
{
@@ -356,7 +356,7 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits)
BOOL LLThrottleGroup::dynamicAdjust()
{
- const F32 DYNAMIC_ADJUST_TIME = 1.0f; // seconds
+ const F32Seconds DYNAMIC_ADJUST_TIME(1.0f);
const F32 CURRENT_PERIOD_WEIGHT = .25f; // how much weight to give to last period while determining BPS utilization
const F32 BUSY_PERCENT = 0.75f; // if use more than this fraction of BPS, you are busy
const F32 IDLE_PERCENT = 0.70f; // if use less than this fraction, you are "idle"
@@ -365,7 +365,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
S32 i;
- F64 mt_sec = LLMessageSystem::getMessageTimeSeconds();
+ F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds();
// Only dynamically adjust every few seconds
if ((mt_sec - mDynamicAdjustTime) < DYNAMIC_ADJUST_TIME)
@@ -405,7 +405,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
for (i = 0; i < TC_EOF; i++)
{
// Is this a busy channel?
- if (mBitsSentHistory[i] >= BUSY_PERCENT * DYNAMIC_ADJUST_TIME * mCurrentBPS[i])
+ if (mBitsSentHistory[i] >= BUSY_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i])
{
// this channel is busy
channels_busy = TRUE;
@@ -418,7 +418,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
}
// Is this an idle channel?
- if ((mBitsSentHistory[i] < IDLE_PERCENT * DYNAMIC_ADJUST_TIME * mCurrentBPS[i]) &&
+ if ((mBitsSentHistory[i] < IDLE_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i]) &&
(mBitsAvailable[i] > 0))
{
channel_idle[i] = TRUE;
@@ -440,8 +440,8 @@ BOOL LLThrottleGroup::dynamicAdjust()
//if (total)
//{
- // llinfos << i << ": B" << channel_busy[i] << " I" << channel_idle[i] << " N" << channel_over_nominal[i];
- // llcont << " Nom: " << mNominalBPS[i] << " Cur: " << mCurrentBPS[i] << " BS: " << mBitsSentHistory[i] << llendl;
+ // LL_INFOS() << i << ": B" << channel_busy[i] << " I" << channel_idle[i] << " N" << channel_over_nominal[i];
+ // LL_CONT << " Nom: " << mNominalBPS[i] << " Cur: " << mCurrentBPS[i] << " BS: " << mBitsSentHistory[i] << LL_ENDL;
//}
}
@@ -462,7 +462,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
// Therefore it's a candidate to give up some bandwidth.
// Figure out how much bandwidth it has been using, and how
// much is available to steal.
- used_bps = mBitsSentHistory[i] / DYNAMIC_ADJUST_TIME;
+ used_bps = mBitsSentHistory[i] / DYNAMIC_ADJUST_TIME.value();
// CRO make sure to keep a minimum amount of throttle available
// CRO NB: channels set to < MINIMUM_BPS will never give up bps,
@@ -482,7 +482,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
avail_bps = mCurrentBPS[i] - used_bps;
}
- //llinfos << i << " avail " << avail_bps << llendl;
+ //LL_INFOS() << i << " avail " << avail_bps << LL_ENDL;
// Historically, a channel could have used more than its current share,
// even if it's idle right now.
@@ -499,7 +499,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
}
}
- //llinfos << "Pool BPS: " << pool_bps << llendl;
+ //LL_INFOS() << "Pool BPS: " << pool_bps << LL_ENDL;
// Now redistribute the bandwidth to busy channels.
F32 unused_bps = 0.f;
@@ -508,7 +508,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
if (channel_busy[i])
{
F32 add_amount = pool_bps * (mNominalBPS[i] / busy_nominal_sum);
- //llinfos << "Busy " << i << " gets " << pool_bps << llendl;
+ //LL_INFOS() << "Busy " << i << " gets " << pool_bps << LL_ENDL;
mCurrentBPS[i] += add_amount;
// CRO: make sure this doesn't get too huge
diff --git a/indra/llmessage/llthrottle.h b/indra/llmessage/llthrottle.h
index ed0aeb4602..e43e54f61b 100755
--- a/indra/llmessage/llthrottle.h
+++ b/indra/llmessage/llthrottle.h
@@ -50,7 +50,7 @@ private:
F32 mLookaheadSecs; // Seconds to look ahead, maximum
F32 mRate; // BPS available, dynamically adjusted
F32 mAvailable; // Bits available to send right now on each channel
- F64 mLastSendTime; // Time since last send on this channel
+ F64Seconds mLastSendTime; // Time since last send on this channel
};
typedef enum e_throttle_categories
@@ -93,8 +93,8 @@ protected:
F32 mBitsSentThisPeriod[TC_EOF]; // Sent in this dynamic allocation period
F32 mBitsSentHistory[TC_EOF]; // Sent before this dynamic allocation period, adjusted to one period length
- F64 mLastSendTime[TC_EOF]; // Time since last send on this channel
- F64 mDynamicAdjustTime; // Only dynamic adjust every 2 seconds or so.
+ F64Seconds mLastSendTime[TC_EOF]; // Time since last send on this channel
+ F64Seconds mDynamicAdjustTime; // Only dynamic adjust every 2 seconds or so.
};
diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp
index 38b743fb75..d6db20d7a3 100755
--- a/indra/llmessage/lltransfermanager.cpp
+++ b/indra/llmessage/lltransfermanager.cpp
@@ -64,7 +64,7 @@ LLTransferManager::~LLTransferManager()
{
if (mValid)
{
- llwarns << "LLTransferManager::~LLTransferManager - Should have been cleaned up by message system shutdown process" << llendl;
+ LL_WARNS() << "LLTransferManager::~LLTransferManager - Should have been cleaned up by message system shutdown process" << LL_ENDL;
cleanup();
}
}
@@ -74,7 +74,7 @@ void LLTransferManager::init()
{
if (mValid)
{
- llerrs << "Double initializing LLTransferManager!" << llendl;
+ LL_ERRS() << "Double initializing LLTransferManager!" << LL_ENDL;
}
mValid = TRUE;
@@ -122,7 +122,7 @@ void LLTransferManager::cleanupConnection(const LLHost &host)
{
// This can happen legitimately if we've never done a transfer, and we're
// cleaning up a circuit.
- //llwarns << "Cleaning up nonexistent transfer connection to " << host << llendl;
+ //LL_WARNS() << "Cleaning up nonexistent transfer connection to " << host << LL_ENDL;
return;
}
LLTransferConnection *connp = iter->second;
@@ -203,7 +203,7 @@ LLTransferSource *LLTransferManager::findTransferSource(const LLUUID &transfer_i
//static
void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **)
{
- //llinfos << "LLTransferManager::processTransferRequest" << llendl;
+ //LL_INFOS() << "LLTransferManager::processTransferRequest" << LL_ENDL;
LLUUID transfer_id;
LLTransferSourceType source_type;
@@ -219,33 +219,33 @@ void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **)
if (!tscp)
{
- llwarns << "Source channel not found" << llendl;
+ LL_WARNS() << "Source channel not found" << LL_ENDL;
return;
}
if (tscp->findTransferSource(transfer_id))
{
- llwarns << "Duplicate request for transfer " << transfer_id << ", aborting!" << llendl;
+ LL_WARNS() << "Duplicate request for transfer " << transfer_id << ", aborting!" << LL_ENDL;
return;
}
S32 size = msgp->getSize("TransferInfo", "Params");
if(size > MAX_PARAMS_SIZE)
{
- llwarns << "LLTransferManager::processTransferRequest params too big."
- << llendl;
+ LL_WARNS() << "LLTransferManager::processTransferRequest params too big."
+ << LL_ENDL;
return;
}
- //llinfos << transfer_id << ":" << source_type << ":" << channel_type << ":" << priority << llendl;
+ //LL_INFOS() << transfer_id << ":" << source_type << ":" << channel_type << ":" << priority << LL_ENDL;
LLTransferSource* tsp = LLTransferSource::createSource(
source_type,
transfer_id,
priority);
if(!tsp)
{
- llwarns << "LLTransferManager::processTransferRequest couldn't create"
- << " transfer source!" << llendl;
+ LL_WARNS() << "LLTransferManager::processTransferRequest couldn't create"
+ << " transfer source!" << LL_ENDL;
return;
}
U8 tmp[MAX_PARAMS_SIZE];
@@ -258,8 +258,8 @@ void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **)
// This should only happen if the data is corrupt or
// incorrectly packed.
// *NOTE: We may want to call abortTransfer().
- llwarns << "LLTransferManager::processTransferRequest: bad parameters."
- << llendl;
+ LL_WARNS() << "LLTransferManager::processTransferRequest: bad parameters."
+ << LL_ENDL;
delete tsp;
return;
}
@@ -272,7 +272,7 @@ void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **)
//static
void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
{
- //llinfos << "LLTransferManager::processTransferInfo" << llendl;
+ //LL_INFOS() << "LLTransferManager::processTransferInfo" << LL_ENDL;
LLUUID transfer_id;
LLTransferTargetType target_type;
@@ -286,11 +286,11 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
msgp->getS32("TransferInfo", "Status", (S32 &)status);
msgp->getS32("TransferInfo", "Size", size);
- //llinfos << transfer_id << ":" << target_type<< ":" << channel_type << llendl;
+ //LL_INFOS() << transfer_id << ":" << target_type<< ":" << channel_type << LL_ENDL;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(msgp->getSender(), channel_type);
if (!ttcp)
{
- llwarns << "Target channel not found" << llendl;
+ LL_WARNS() << "Target channel not found" << LL_ENDL;
// Should send a message to abort the transfer.
return;
}
@@ -298,7 +298,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
LLTransferTarget *ttp = ttcp->findTransferTarget(transfer_id);
if (!ttp)
{
- llwarns << "TransferInfo for unknown transfer! Not able to handle this yet!" << llendl;
+ LL_WARNS() << "TransferInfo for unknown transfer! Not able to handle this yet!" << LL_ENDL;
// This could happen if we're doing a push transfer, although to avoid confusion,
// maybe it should be a different message.
return;
@@ -306,7 +306,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
if (status != LLTS_OK)
{
- llwarns << transfer_id << ": Non-ok status, cleaning up" << llendl;
+ LL_WARNS() << transfer_id << ": Non-ok status, cleaning up" << LL_ENDL;
ttp->completionCallback(status);
// Clean up the transfer.
ttcp->deleteTransfer(ttp);
@@ -317,8 +317,8 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
S32 params_size = msgp->getSize("TransferInfo", "Params");
if(params_size > MAX_PARAMS_SIZE)
{
- llwarns << "LLTransferManager::processTransferInfo params too big."
- << llendl;
+ LL_WARNS() << "LLTransferManager::processTransferInfo params too big."
+ << LL_ENDL;
return;
}
else if(params_size > 0)
@@ -330,15 +330,15 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
{
// This should only happen if the data is corrupt or
// incorrectly packed.
- llwarns << "LLTransferManager::processTransferRequest: bad params."
- << llendl;
+ LL_WARNS() << "LLTransferManager::processTransferRequest: bad params."
+ << LL_ENDL;
ttp->abortTransfer();
ttcp->deleteTransfer(ttp);
return;
}
}
- //llinfos << "Receiving " << transfer_id << ", size " << size << " bytes" << llendl;
+ //LL_INFOS() << "Receiving " << transfer_id << ", size " << size << " bytes" << LL_ENDL;
ttp->setSize(size);
ttp->setGotInfo(TRUE);
@@ -358,7 +358,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
{
// Perhaps this stuff should be inside a method in LLTransferPacket?
// I'm too lazy to do it now, though.
-// llinfos << "Playing back delayed packet " << packet_id << llendl;
+// LL_INFOS() << "Playing back delayed packet " << packet_id << LL_ENDL;
LLTransferPacket *packetp = ttp->mDelayedPacketMap[packet_id];
// This is somewhat inefficient, but avoids us having to duplicate
@@ -392,11 +392,11 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
{
if (status != LLTS_DONE)
{
- llwarns << "LLTransferManager::processTransferInfo Error in playback!" << llendl;
+ LL_WARNS() << "LLTransferManager::processTransferInfo Error in playback!" << LL_ENDL;
}
else
{
- llinfos << "LLTransferManager::processTransferInfo replay FINISHED for " << transfer_id << llendl;
+ LL_INFOS() << "LLTransferManager::processTransferInfo replay FINISHED for " << transfer_id << LL_ENDL;
}
// This transfer is done, either via error or not.
ttp->completionCallback(status);
@@ -410,7 +410,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **)
//static
void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **)
{
- //llinfos << "LLTransferManager::processTransferPacket" << llendl;
+ //LL_INFOS() << "LLTransferManager::processTransferPacket" << LL_ENDL;
LLUUID transfer_id;
LLTransferChannelType channel_type;
@@ -423,20 +423,20 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **)
msgp->getS32("TransferData", "Status", (S32 &)status);
// Find the transfer associated with this packet.
- //llinfos << transfer_id << ":" << channel_type << llendl;
+ //LL_INFOS() << transfer_id << ":" << channel_type << LL_ENDL;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(msgp->getSender(), channel_type);
if (!ttcp)
{
- llwarns << "Target channel not found" << llendl;
+ LL_WARNS() << "Target channel not found" << LL_ENDL;
return;
}
LLTransferTarget *ttp = ttcp->findTransferTarget(transfer_id);
if (!ttp)
{
- llwarns << "Didn't find matching transfer for " << transfer_id
+ LL_WARNS() << "Didn't find matching transfer for " << transfer_id
<< " processing packet " << packet_id
- << " from " << msgp->getSender() << llendl;
+ << " from " << msgp->getSender() << LL_ENDL;
return;
}
@@ -455,7 +455,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **)
if ((size < 0) || (size > MAX_PACKET_DATA_SIZE))
{
- llwarns << "Invalid transfer packet size " << size << llendl;
+ LL_WARNS() << "Invalid transfer packet size " << size << LL_ENDL;
return;
}
@@ -472,8 +472,8 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **)
if(!ttp->addDelayedPacket(packet_id, status, tmp_data, size))
{
// Whoops - failed to add a delayed packet for some reason.
- llwarns << "Too many delayed packets processing transfer "
- << transfer_id << " from " << msgp->getSender() << llendl;
+ LL_WARNS() << "Too many delayed packets processing transfer "
+ << transfer_id << " from " << msgp->getSender() << LL_ENDL;
ttp->abortTransfer();
ttcp->deleteTransfer(ttp);
return;
@@ -483,15 +483,15 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **)
const S32 LL_TRANSFER_WARN_GAP = 10;
if(!ttp->gotInfo())
{
- llwarns << "Got data packet before information in transfer "
+ LL_WARNS() << "Got data packet before information in transfer "
<< transfer_id << " from " << msgp->getSender()
- << ", got " << packet_id << llendl;
+ << ", got " << packet_id << LL_ENDL;
}
else if((packet_id - ttp->getNextPacketID()) > LL_TRANSFER_WARN_GAP)
{
- llwarns << "Out of order packet in transfer " << transfer_id
+ LL_WARNS() << "Out of order packet in transfer " << transfer_id
<< " from " << msgp->getSender() << ", got " << packet_id
- << " expecting " << ttp->getNextPacketID() << llendl;
+ << " expecting " << ttp->getNextPacketID() << LL_ENDL;
}
#endif
return;
@@ -516,11 +516,11 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **)
{
if (status != LLTS_DONE)
{
- llwarns << "LLTransferManager::processTransferPacket Error in transfer!" << llendl;
+ LL_WARNS() << "LLTransferManager::processTransferPacket Error in transfer!" << LL_ENDL;
}
else
{
-// llinfos << "LLTransferManager::processTransferPacket done for " << transfer_id << llendl;
+// LL_INFOS() << "LLTransferManager::processTransferPacket done for " << transfer_id << LL_ENDL;
}
// This transfer is done, either via error or not.
ttp->completionCallback(status);
@@ -534,7 +534,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **)
{
// Perhaps this stuff should be inside a method in LLTransferPacket?
// I'm too lazy to do it now, though.
-// llinfos << "Playing back delayed packet " << packet_id << llendl;
+// LL_INFOS() << "Playing back delayed packet " << packet_id << LL_ENDL;
LLTransferPacket *packetp = ttp->mDelayedPacketMap[packet_id];
// This is somewhat inefficient, but avoids us having to duplicate
@@ -564,7 +564,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **)
//static
void LLTransferManager::processTransferAbort(LLMessageSystem *msgp, void **)
{
- //llinfos << "LLTransferManager::processTransferPacket" << llendl;
+ //LL_INFOS() << "LLTransferManager::processTransferPacket" << LL_ENDL;
LLUUID transfer_id;
LLTransferChannelType channel_type;
@@ -598,7 +598,7 @@ void LLTransferManager::processTransferAbort(LLMessageSystem *msgp, void **)
}
}
- llwarns << "Couldn't find transfer " << transfer_id << " to abort!" << llendl;
+ LL_WARNS() << "Couldn't find transfer " << transfer_id << " to abort!" << LL_ENDL;
}
@@ -612,14 +612,14 @@ void LLTransferManager::reliablePacketCallback(void **user_data, S32 result)
LLTransferSource *tsp = gTransferManager.findTransferSource(*transfer_idp);
if (tsp)
{
- llwarns << "Aborting reliable transfer " << *transfer_idp << " due to failed reliable resends!" << llendl;
+ LL_WARNS() << "Aborting reliable transfer " << *transfer_idp << " due to failed reliable resends!" << LL_ENDL;
LLTransferSourceChannel *tscp = tsp->mChannelp;
tsp->abortTransfer();
tscp->deleteTransfer(tsp);
}
else
{
- llwarns << "Aborting reliable transfer " << *transfer_idp << " but can't find the LLTransferSource object" << llendl;
+ LL_WARNS() << "Aborting reliable transfer " << *transfer_idp << " but can't find the LLTransferSource object" << LL_ENDL;
}
}
delete transfer_idp;
@@ -763,7 +763,7 @@ void LLTransferSourceChannel::updateTransfers()
// We DON'T want to send any packets if they're blocked, they'll just end up
// piling up on the other end.
- //llwarns << "Blocking transfers due to blocked circuit for " << getHost() << llendl;
+ //LL_WARNS() << "Blocking transfers due to blocked circuit for " << getHost() << LL_ENDL;
return;
}
@@ -781,7 +781,7 @@ void LLTransferSourceChannel::updateTransfers()
BOOL done = FALSE;
for (iter = mTransferSources.mMap.begin(); (iter != mTransferSources.mMap.end()) && !done;)
{
- //llinfos << "LLTransferSourceChannel::updateTransfers()" << llendl;
+ //LL_INFOS() << "LLTransferSourceChannel::updateTransfers()" << LL_ENDL;
// Do stuff.
next = iter;
next++;
@@ -820,7 +820,7 @@ void LLTransferSourceChannel::updateTransfers()
gMessageSystem->addS32("Status", status);
gMessageSystem->addBinaryData("Data", datap, data_size);
sent_bytes = gMessageSystem->getCurrentSendTotal();
- gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, TRUE, 0.f,
+ gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, TRUE, F32Seconds(0.f),
LLTransferManager::reliablePacketCallback, (void**)cb_uuid);
// Do bookkeeping for the throttle
@@ -853,11 +853,11 @@ void LLTransferSourceChannel::updateTransfers()
// We're OK, don't need to do anything. Keep sending data.
break;
case LLTS_ERROR:
- llwarns << "Error in transfer dataCallback!" << llendl;
+ LL_WARNS() << "Error in transfer dataCallback!" << LL_ENDL;
// fall through
case LLTS_DONE:
// We need to clean up this transfer source.
- //llinfos << "LLTransferSourceChannel::updateTransfers() " << tsp->getID() << " done" << llendl;
+ //LL_INFOS() << "LLTransferSourceChannel::updateTransfers() " << tsp->getID() << " done" << LL_ENDL;
tsp->completionCallback(status);
delete tsp;
@@ -865,7 +865,7 @@ void LLTransferSourceChannel::updateTransfers()
iter = next;
break;
default:
- llerrs << "Unknown transfer error code!" << llendl;
+ LL_ERRS() << "Unknown transfer error code!" << LL_ENDL;
}
// At this point, we should do priority adjustment (since some transfers like
@@ -912,10 +912,10 @@ void LLTransferSourceChannel::deleteTransfer(LLTransferSource *tsp)
}
}
- llwarns << "Unable to find transfer source id "
+ LL_WARNS() << "Unable to find transfer source id "
<< tsp->getID()
<< " to delete!"
- << llendl;
+ << LL_ENDL;
}
}
@@ -956,7 +956,7 @@ void LLTransferTargetChannel::requestTransfer(
source_params.getType());
if (!ttp)
{
- llwarns << "LLTransferManager::requestTransfer aborting due to target creation failure!" << llendl;
+ LL_WARNS() << "LLTransferManager::requestTransfer aborting due to target creation failure!" << LL_ENDL;
return;
}
@@ -1032,10 +1032,10 @@ void LLTransferTargetChannel::deleteTransfer(LLTransferTarget *ttp)
}
}
- llwarns << "Unable to find transfer target id "
+ LL_WARNS() << "Unable to find transfer target id "
<< ttp->getID()
<< " to delete!"
- << llendl;
+ << LL_ENDL;
}
}
@@ -1097,7 +1097,7 @@ void LLTransferSource::sendTransferStatus(LLTSCode status)
void LLTransferSource::abortTransfer()
{
// Send a message down, call the completion callback
- llinfos << "LLTransferSource::Aborting transfer " << getID() << " to " << mChannelp->getHost() << llendl;
+ LL_INFOS() << "LLTransferSource::Aborting transfer " << getID() << " to " << mChannelp->getHost() << LL_ENDL;
gMessageSystem->newMessage("TransferAbort");
gMessageSystem->nextBlock("TransferInfo");
gMessageSystem->addUUID("TransferID", getID());
@@ -1115,7 +1115,7 @@ void LLTransferSource::registerSourceType(const LLTransferSourceType stype, LLTr
{
// Disallow changing what class handles a source type
// Unclear when you would want to do this, and whether it would work.
- llerrs << "Reregistering source type " << stype << llendl;
+ LL_ERRS() << "Reregistering source type " << stype << LL_ENDL;
}
else
{
@@ -1143,7 +1143,7 @@ LLTransferSource *LLTransferSource::createSource(const LLTransferSourceType styp
if (!sSourceCreateMap.count(stype))
{
// Use the callback to create the source type if it's not there.
- llwarns << "Unknown transfer source type: " << stype << llendl;
+ LL_WARNS() << "Unknown transfer source type: " << stype << LL_ENDL;
return NULL;
}
return (sSourceCreateMap[stype])(id, priority);
@@ -1230,7 +1230,7 @@ LLTransferTarget::~LLTransferTarget()
void LLTransferTarget::abortTransfer()
{
// Send a message up, call the completion callback
- llinfos << "LLTransferTarget::Aborting transfer " << getID() << " from " << mChannelp->getHost() << llendl;
+ LL_INFOS() << "LLTransferTarget::Aborting transfer " << getID() << " from " << mChannelp->getHost() << LL_ENDL;
gMessageSystem->newMessage("TransferAbort");
gMessageSystem->nextBlock("TransferInfo");
gMessageSystem->addUUID("TransferID", getID());
@@ -1262,7 +1262,7 @@ bool LLTransferTarget::addDelayedPacket(
#ifdef _DEBUG
if (mDelayedPacketMap.find(packet_id) != mDelayedPacketMap.end())
{
- llerrs << "Packet ALREADY in delayed packet map!" << llendl;
+ LL_ERRS() << "Packet ALREADY in delayed packet map!" << LL_ENDL;
}
#endif
@@ -1283,7 +1283,7 @@ LLTransferTarget* LLTransferTarget::createTarget(
case LLTTT_VFILE:
return new LLTransferTargetVFile(id, source_type);
default:
- llwarns << "Unknown transfer target type: " << type << llendl;
+ LL_WARNS() << "Unknown transfer target type: " << type << LL_ENDL;
return NULL;
}
}
@@ -1318,7 +1318,7 @@ void LLTransferSourceParamsInvItem::setAsset(const LLUUID &asset_id, const LLAss
void LLTransferSourceParamsInvItem::packParams(LLDataPacker &dp) const
{
- lldebugs << "LLTransferSourceParamsInvItem::packParams()" << llendl;
+ LL_DEBUGS() << "LLTransferSourceParamsInvItem::packParams()" << LL_ENDL;
dp.packUUID(mAgentID, "AgentID");
dp.packUUID(mSessionID, "SessionID");
dp.packUUID(mOwnerID, "OwnerID");
diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp
index 8537773a3f..80ed3340c6 100755
--- a/indra/llmessage/lltransfersourceasset.cpp
+++ b/indra/llmessage/lltransfersourceasset.cpp
@@ -66,18 +66,18 @@ void LLTransferSourceAsset::initTransfer()
}
else
{
- llwarns << "Attempted to request blocked asset "
+ LL_WARNS() << "Attempted to request blocked asset "
<< mParams.getAssetID() << ":"
<< LLAssetType::lookupHumanReadable(mParams.getAssetType())
- << llendl;
+ << LL_ENDL;
sendTransferStatus(LLTS_ERROR);
}
}
else
{
- llwarns << "Attempted to request asset " << mParams.getAssetID()
+ LL_WARNS() << "Attempted to request asset " << mParams.getAssetID()
<< ":" << LLAssetType::lookupHumanReadable(mParams.getAssetType())
- << " without an asset system!" << llendl;
+ << " without an asset system!" << LL_ENDL;
sendTransferStatus(LLTS_ERROR);
}
}
@@ -93,7 +93,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id,
S32 &returned_bytes,
BOOL &delete_returned)
{
- //llinfos << "LLTransferSourceAsset::dataCallback" << llendl;
+ //LL_INFOS() << "LLTransferSourceAsset::dataCallback" << LL_ENDL;
if (!mGotResponse)
{
return LLTS_SKIP;
@@ -109,14 +109,14 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id,
if (packet_id != mLastPacketID + 1)
{
- llerrs << "Can't handle out of order file transfer yet!" << llendl;
+ LL_ERRS() << "Can't handle out of order file transfer yet!" << LL_ENDL;
}
// grab a buffer from the right place in the file
if (!vf.seek(mCurPos, 0))
{
- llwarns << "LLTransferSourceAsset Can't seek to " << mCurPos << " length " << vf.getSize() << llendl;
- llwarns << "While sending " << mParams.getAssetID() << llendl;
+ LL_WARNS() << "LLTransferSourceAsset Can't seek to " << mCurPos << " length " << vf.getSize() << LL_ENDL;
+ LL_WARNS() << "While sending " << mParams.getAssetID() << LL_ENDL;
return LLTS_ERROR;
}
@@ -160,13 +160,13 @@ void LLTransferSourceAsset::completionCallback(const LLTSCode status)
void LLTransferSourceAsset::packParams(LLDataPacker& dp) const
{
- //llinfos << "LLTransferSourceAsset::packParams" << llendl;
+ //LL_INFOS() << "LLTransferSourceAsset::packParams" << LL_ENDL;
mParams.packParams(dp);
}
BOOL LLTransferSourceAsset::unpackParams(LLDataPacker &dp)
{
- //llinfos << "LLTransferSourceAsset::unpackParams" << llendl;
+ //LL_INFOS() << "LLTransferSourceAsset::unpackParams" << LL_ENDL;
return mParams.unpackParams(dp);
}
@@ -183,13 +183,13 @@ void LLTransferSourceAsset::responderCallback(LLVFS *vfs, const LLUUID& uuid, LL
if (!tsap)
{
- llinfos << "Aborting transfer " << transfer_id << " callback, transfer source went away" << llendl;
+ LL_INFOS() << "Aborting transfer " << transfer_id << " callback, transfer source went away" << LL_ENDL;
return;
}
if (result)
{
- llinfos << "AssetStorage: Error " << gAssetStorage->getErrorString(result) << " downloading uuid " << uuid << llendl;
+ LL_INFOS() << "AssetStorage: Error " << gAssetStorage->getErrorString(result) << " downloading uuid " << uuid << LL_ENDL;
}
LLTSCode status;
diff --git a/indra/llmessage/lltransfersourcefile.cpp b/indra/llmessage/lltransfersourcefile.cpp
index 43c9448fba..1f284a158d 100755
--- a/indra/llmessage/lltransfersourcefile.cpp
+++ b/indra/llmessage/lltransfersourcefile.cpp
@@ -43,7 +43,7 @@ LLTransferSourceFile::~LLTransferSourceFile()
{
if (mFP)
{
- llerrs << "Destructor called without the completion callback being called!" << llendl;
+ LL_ERRS() << "Destructor called without the completion callback being called!" << LL_ENDL;
}
}
@@ -56,7 +56,7 @@ void LLTransferSourceFile::initTransfer()
|| (filename == "..")
|| (filename.find(delimiter[0]) != std::string::npos))
{
- llwarns << "Attempting to transfer file " << filename << " with path delimiter, aborting!" << llendl;
+ LL_WARNS() << "Attempting to transfer file " << filename << " with path delimiter, aborting!" << LL_ENDL;
sendTransferStatus(LLTS_ERROR);
return;
@@ -88,17 +88,17 @@ LLTSCode LLTransferSourceFile::dataCallback(const S32 packet_id,
S32 &returned_bytes,
BOOL &delete_returned)
{
- //llinfos << "LLTransferSourceFile::dataCallback" << llendl;
+ //LL_INFOS() << "LLTransferSourceFile::dataCallback" << LL_ENDL;
if (!mFP)
{
- llerrs << "Data callback without file set!" << llendl;
+ LL_ERRS() << "Data callback without file set!" << LL_ENDL;
return LLTS_ERROR;
}
if (packet_id != mLastPacketID + 1)
{
- llerrs << "Can't handle out of order file transfer yet!" << llendl;
+ LL_ERRS() << "Can't handle out of order file transfer yet!" << LL_ENDL;
}
// Grab up until the max number of bytes from the file.
@@ -137,13 +137,13 @@ void LLTransferSourceFile::completionCallback(const LLTSCode status)
void LLTransferSourceFile::packParams(LLDataPacker& dp) const
{
- //llinfos << "LLTransferSourceFile::packParams" << llendl;
+ //LL_INFOS() << "LLTransferSourceFile::packParams" << LL_ENDL;
mParams.packParams(dp);
}
BOOL LLTransferSourceFile::unpackParams(LLDataPacker &dp)
{
- //llinfos << "LLTransferSourceFile::unpackParams" << llendl;
+ //LL_INFOS() << "LLTransferSourceFile::unpackParams" << LL_ENDL;
return mParams.unpackParams(dp);
}
@@ -169,6 +169,6 @@ BOOL LLTransferSourceParamsFile::unpackParams(LLDataPacker &dp)
dp.unpackU8(delete_flag, "Delete");
mDeleteOnCompletion = delete_flag;
- llinfos << "Unpacked filename: " << mFilename << llendl;
+ LL_INFOS() << "Unpacked filename: " << mFilename << LL_ENDL;
return TRUE;
}
diff --git a/indra/llmessage/lltransfertargetfile.cpp b/indra/llmessage/lltransfertargetfile.cpp
index 560fc8b6e4..ca0318a2d6 100755
--- a/indra/llmessage/lltransfertargetfile.cpp
+++ b/indra/llmessage/lltransfertargetfile.cpp
@@ -44,7 +44,7 @@ LLTransferTargetFile::~LLTransferTargetFile()
{
if (mFP)
{
- llerrs << "LLTransferTargetFile::~LLTransferTargetFile - Should have been cleaned up in completion callback" << llendl;
+ LL_ERRS() << "LLTransferTargetFile::~LLTransferTargetFile - Should have been cleaned up in completion callback" << LL_ENDL;
fclose(mFP);
mFP = NULL;
}
@@ -61,7 +61,7 @@ void LLTransferTargetFile::applyParams(const LLTransferTargetParams &params)
{
if (params.getType() != mType)
{
- llwarns << "Target parameter type doesn't match!" << llendl;
+ LL_WARNS() << "Target parameter type doesn't match!" << LL_ENDL;
return;
}
@@ -70,8 +70,8 @@ void LLTransferTargetFile::applyParams(const LLTransferTargetParams &params)
LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, const S32 in_size)
{
- //llinfos << "LLTransferTargetFile::dataCallback" << llendl;
- //llinfos << "Packet: " << packet_id << llendl;
+ //LL_INFOS() << "LLTransferTargetFile::dataCallback" << LL_ENDL;
+ //LL_INFOS() << "Packet: " << packet_id << LL_ENDL;
if (!mFP)
{
@@ -79,7 +79,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c
if (!mFP)
{
- llwarns << "Failure opening " << mParams.mFilename << " for write by LLTransferTargetFile" << llendl;
+ LL_WARNS() << "Failure opening " << mParams.mFilename << " for write by LLTransferTargetFile" << LL_ENDL;
return LLTS_ERROR;
}
}
@@ -91,7 +91,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c
S32 count = (S32)fwrite(in_datap, 1, in_size, mFP);
if (count != in_size)
{
- llwarns << "Failure in LLTransferTargetFile::dataCallback!" << llendl;
+ LL_WARNS() << "Failure in LLTransferTargetFile::dataCallback!" << LL_ENDL;
return LLTS_ERROR;
}
return LLTS_OK;
@@ -99,7 +99,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c
void LLTransferTargetFile::completionCallback(const LLTSCode status)
{
- llinfos << "LLTransferTargetFile::completionCallback" << llendl;
+ LL_INFOS() << "LLTransferTargetFile::completionCallback" << LL_ENDL;
if (mFP)
{
fclose(mFP);
@@ -113,7 +113,7 @@ void LLTransferTargetFile::completionCallback(const LLTSCode status)
case LLTS_ABORT:
case LLTS_ERROR:
// We're aborting this transfer, we don't want to keep this file.
- llwarns << "Aborting file transfer for " << mParams.mFilename << llendl;
+ LL_WARNS() << "Aborting file transfer for " << mParams.mFilename << LL_ENDL;
if (mFP)
{
// Only need to remove file if we successfully opened it.
diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp
index c78d9288b6..3c234b9726 100755
--- a/indra/llmessage/lltransfertargetvfile.cpp
+++ b/indra/llmessage/lltransfertargetvfile.cpp
@@ -115,7 +115,7 @@ void LLTransferTargetVFile::applyParams(const LLTransferTargetParams &params)
{
if (params.getType() != mType)
{
- llwarns << "Target parameter type doesn't match!" << llendl;
+ LL_WARNS() << "Target parameter type doesn't match!" << LL_ENDL;
return;
}
@@ -125,8 +125,8 @@ void LLTransferTargetVFile::applyParams(const LLTransferTargetParams &params)
LLTSCode LLTransferTargetVFile::dataCallback(const S32 packet_id, U8 *in_datap, const S32 in_size)
{
- //llinfos << "LLTransferTargetFile::dataCallback" << llendl;
- //llinfos << "Packet: " << packet_id << llendl;
+ //LL_INFOS() << "LLTransferTargetFile::dataCallback" << LL_ENDL;
+ //LL_INFOS() << "Packet: " << packet_id << LL_ENDL;
LLVFile vf(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::APPEND);
if (mNeedsCreate)
@@ -142,7 +142,7 @@ LLTSCode LLTransferTargetVFile::dataCallback(const S32 packet_id, U8 *in_datap,
if (!vf.write(in_datap, in_size))
{
- llwarns << "Failure in LLTransferTargetVFile::dataCallback!" << llendl;
+ LL_WARNS() << "Failure in LLTransferTargetVFile::dataCallback!" << LL_ENDL;
return LLTS_ERROR;
}
return LLTS_OK;
@@ -151,11 +151,11 @@ LLTSCode LLTransferTargetVFile::dataCallback(const S32 packet_id, U8 *in_datap,
void LLTransferTargetVFile::completionCallback(const LLTSCode status)
{
- //llinfos << "LLTransferTargetVFile::completionCallback" << llendl;
+ //LL_INFOS() << "LLTransferTargetVFile::completionCallback" << LL_ENDL;
if (!gAssetStorage)
{
- llwarns << "Aborting vfile transfer after asset storage shut down!" << llendl;
+ LL_WARNS() << "Aborting vfile transfer after asset storage shut down!" << LL_ENDL;
return;
}
@@ -169,14 +169,14 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status)
LLVFile file(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::WRITE);
if (!file.rename(mParams.getAssetID(), mParams.getAssetType()))
{
- llerrs << "LLTransferTargetVFile: rename failed" << llendl;
+ LL_ERRS() << "LLTransferTargetVFile: rename failed" << LL_ENDL;
}
}
err_code = LL_ERR_NOERR;
- lldebugs << "LLTransferTargetVFile::completionCallback for "
+ LL_DEBUGS() << "LLTransferTargetVFile::completionCallback for "
<< mParams.getAssetID() << ","
<< LLAssetType::lookup(mParams.getAssetType())
- << " with temp id " << mTempID << llendl;
+ << " with temp id " << mTempID << LL_ENDL;
break;
case LLTS_ERROR:
case LLTS_ABORT:
@@ -184,7 +184,7 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status)
default:
{
// We're aborting this transfer, we don't want to keep this file.
- llwarns << "Aborting vfile transfer for " << mParams.getAssetID() << llendl;
+ LL_WARNS() << "Aborting vfile transfer for " << mParams.getAssetID() << LL_ENDL;
LLVFile vf(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::APPEND);
vf.remove();
}
diff --git a/indra/llmessage/lltrustedmessageservice.cpp b/indra/llmessage/lltrustedmessageservice.cpp
index fea7fc72c4..5bd1112cfe 100755
--- a/indra/llmessage/lltrustedmessageservice.cpp
+++ b/indra/llmessage/lltrustedmessageservice.cpp
@@ -42,9 +42,9 @@ void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response,
const LLSD& context,
const LLSD& input) const
{
- std::string name = context["request"]["wildcard"]["message-name"];
- std::string senderIP = context["request"]["remote-host"];
- std::string senderPort = context["request"]["headers"]
+ std::string name = context[CONTEXT_REQUEST][CONTEXT_WILDCARD]["message-name"];
+ std::string senderIP = context[CONTEXT_REQUEST][CONTEXT_REMOTE_HOST];
+ std::string senderPort = context[CONTEXT_REQUEST][CONTEXT_HEADERS]
["x-secondlife-udp-listen-port"];
LLSD message_data;
@@ -63,21 +63,21 @@ void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response,
{
LL_WARNS("Messaging") << "trusted message POST to /trusted-message/"
<< name << " from unknown or untrusted sender "
- << sender << llendl;
- response->status(403, "Unknown or untrusted sender");
+ << sender << LL_ENDL;
+ response->status(HTTP_FORBIDDEN, "Unknown or untrusted sender");
}
else
{
gMessageSystem->receivedMessageFromTrustedSender();
if (input.has("binary-template-data"))
{
- llinfos << "Dispatching template: " << input << llendl;
+ LL_INFOS() << "Dispatching template: " << input << LL_ENDL;
// try and send this message using udp dispatch
LLMessageSystem::dispatchTemplate(name, message_data, response);
}
else
{
- llinfos << "Dispatching without template: " << input << llendl;
+ LL_INFOS() << "Dispatching without template: " << input << LL_ENDL;
LLMessageSystem::dispatch(name, message_data, response);
}
}
diff --git a/indra/llmessage/lltrustedmessageservice.h b/indra/llmessage/lltrustedmessageservice.h
index 688937ac2c..12a37bb535 100755
--- a/indra/llmessage/lltrustedmessageservice.h
+++ b/indra/llmessage/lltrustedmessageservice.h
@@ -30,6 +30,10 @@
#include "linden_common.h"
#include "llhttpnode.h"
+// These are defined in lliosocket.h/lliosocket.cpp
+extern const std::string CONTEXT_REMOTE_HOST;
+extern const std::string CONTEXT_REMOTE_PORT;
+
class LLSD;
class LLTrustedMessageService
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index 683065357d..1294379eca 100755
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -33,6 +33,7 @@
#include <openssl/x509_vfy.h>
#include <openssl/ssl.h>
#include "llcurl.h"
+#include "llfasttimer.h"
#include "llioutil.h"
#include "llproxy.h"
#include "llpumpio.h"
@@ -40,7 +41,6 @@
#include "llstring.h"
#include "apr_env.h"
#include "llapr.h"
-static const U32 HTTP_STATUS_PIPE_ERROR = 499;
/**
* String constants
@@ -48,11 +48,12 @@ static const U32 HTTP_STATUS_PIPE_ERROR = 499;
const std::string CONTEXT_DEST_URI_SD_LABEL("dest_uri");
const std::string CONTEXT_TRANSFERED_BYTES("transfered_bytes");
+// These are defined in llhttpnode.h/llhttpnode.cpp
+extern const std::string CONTEXT_REQUEST;
+extern const std::string CONTEXT_RESPONSE;
static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user);
-
-
/**
* class LLURLRequestDetail
*/
@@ -130,27 +131,8 @@ CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
* class LLURLRequest
*/
-// static
-std::string LLURLRequest::actionAsVerb(LLURLRequest::ERequestAction action)
-{
- static const std::string VERBS[] =
- {
- "(invalid)",
- "HEAD",
- "GET",
- "PUT",
- "POST",
- "DELETE",
- "MOVE"
- };
- if(((S32)action <=0) || ((S32)action >= REQUEST_ACTION_COUNT))
- {
- return VERBS[0];
- }
- return VERBS[action];
-}
-LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, bool follow_redirects /* = true */) :
+LLURLRequest::LLURLRequest(EHTTPMethod action, bool follow_redirects /* = true */) :
mAction(action),
mFollowRedirects(follow_redirects)
{
@@ -158,7 +140,7 @@ LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, bool follow_redi
}
LLURLRequest::LLURLRequest(
- LLURLRequest::ERequestAction action,
+ EHTTPMethod action,
const std::string& url,
bool follow_redirects /* = true */) :
mAction(action),
@@ -179,16 +161,21 @@ void LLURLRequest::setURL(const std::string& url)
mDetail->mURL = url;
if (url.empty())
{
- llwarns << "empty URL specified" << llendl;
+ LL_WARNS() << "empty URL specified" << LL_ENDL;
}
}
-std::string LLURLRequest::getURL() const
+const std::string& LLURLRequest::getURL() const
{
return mDetail->mURL;
}
-void LLURLRequest::addHeader(const char* header)
+void LLURLRequest::addHeader(const std::string& header, const std::string& value /* = "" */)
+{
+ mDetail->mCurlRequest->slist_append(header, value);
+}
+
+void LLURLRequest::addHeaderRaw(const char* header)
{
mDetail->mCurlRequest->slist_append(header);
}
@@ -232,7 +219,7 @@ void LLURLRequest::useProxy(bool use_proxy)
}
- lldebugs << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (env_proxy ? env_proxy : "(null)") << llendl;
+ LL_DEBUGS() << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (env_proxy ? env_proxy : "(null)") << LL_ENDL;
if (env_proxy && use_proxy)
{
@@ -275,7 +262,7 @@ LLIOPipe::EStatus LLURLRequest::handleError(
LLURLRequestComplete* complete = NULL;
complete = (LLURLRequestComplete*)mCompletionCallback.get();
complete->httpStatus(
- HTTP_STATUS_PIPE_ERROR,
+ HTTP_INTERNAL_ERROR,
LLIOPipe::lookupStatusString(status));
complete->responseStatus(status);
pump->respond(complete);
@@ -284,9 +271,11 @@ LLIOPipe::EStatus LLURLRequest::handleError(
return status;
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST("URL Request");
-static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result");
-static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_REQUEST("URL Request");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result");
+static LLTrace::BlockTimerStatHandle FTM_URL_PERFORM("Perform");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_PUMP_RESPOND("Pump Respond");
+static LLTrace::BlockTimerStatHandle FTM_URL_ADJUST_TIMEOUT("Adjust Timeout");
// virtual
LLIOPipe::EStatus LLURLRequest::process_impl(
@@ -296,9 +285,9 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_URL_REQUEST);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_REQUEST);
PUMP_DEBUG;
- //llinfos << "LLURLRequest::process_impl()" << llendl;
+ //LL_INFOS() << "LLURLRequest::process_impl()" << LL_ENDL;
if (!buffer) return STATUS_ERROR;
// we're still waiting or prcessing, check how many
@@ -306,8 +295,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
const S32 MIN_ACCUMULATION = 100000;
if(pump && (mDetail->mByteAccumulator > MIN_ACCUMULATION))
{
- static LLFastTimer::DeclareTimer FTM_URL_ADJUST_TIMEOUT("Adjust Timeout");
- LLFastTimer t(FTM_URL_ADJUST_TIMEOUT);
+ LL_RECORD_BLOCK_TIME(FTM_URL_ADJUST_TIMEOUT);
// This is a pretty sloppy calculation, but this
// tries to make the gross assumption that if data
// is coming in at 56kb/s, then this transfer will
@@ -317,11 +305,11 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
const F32 TIMEOUT_ADJUSTMENT = 2.0f;
mDetail->mByteAccumulator = 0;
pump->adjustTimeoutSeconds(TIMEOUT_ADJUSTMENT);
- lldebugs << "LLURLRequest adjustTimeoutSeconds for request: " << mDetail->mURL << llendl;
- if (mState == STATE_INITIALIZED)
- {
- llinfos << "LLURLRequest adjustTimeoutSeconds called during upload" << llendl;
- }
+ LL_DEBUGS() << "LLURLRequest adjustTimeoutSeconds for request: " << mDetail->mURL << LL_ENDL;
+ if (mState == STATE_INITIALIZED)
+ {
+ LL_INFOS() << "LLURLRequest adjustTimeoutSeconds called during upload" << LL_ENDL;
+ }
}
switch(mState)
@@ -356,7 +344,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
PUMP_DEBUG;
LLIOPipe::EStatus status = STATUS_BREAK;
{
- LLFastTimer t(FTM_URL_PERFORM);
+ LL_RECORD_BLOCK_TIME(FTM_URL_PERFORM);
if(!mDetail->mCurlRequest->wait())
{
return status ;
@@ -370,7 +358,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
bool newmsg = false;
{
- LLFastTimer t(FTM_PROCESS_URL_REQUEST_GET_RESULT);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_REQUEST_GET_RESULT);
newmsg = mDetail->mCurlRequest->getResult(&result);
}
@@ -384,7 +372,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
mState = STATE_HAVE_RESPONSE;
context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes;
context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes;
- lldebugs << this << "Setting context to " << context << llendl;
+ LL_DEBUGS() << this << "Setting context to " << context << LL_ENDL;
switch(result)
{
case CURLE_OK:
@@ -405,9 +393,8 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
link.mChannels = LLBufferArray::makeChannelConsumer(
channels);
chain.push_back(link);
- static LLFastTimer::DeclareTimer FTM_PROCESS_URL_PUMP_RESPOND("Pump Respond");
{
- LLFastTimer t(FTM_PROCESS_URL_PUMP_RESPOND);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_PUMP_RESPOND);
pump->respond(chain, buffer, context);
}
mCompletionCallback = NULL;
@@ -419,12 +406,12 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
keep_looping = false;
break;
default: // CURLE_URL_MALFORMAT
- llwarns << "URLRequest Error: " << result
+ LL_WARNS() << "URLRequest Error: " << result
<< ", "
<< LLCurl::strerror(result)
<< ", "
<< (mDetail->mURL.empty() ? "<EMPTY URL>" : mDetail->mURL)
- << llendl;
+ << LL_ENDL;
status = STATUS_ERROR;
keep_looping = false;
break;
@@ -439,14 +426,14 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
eos = true;
context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes;
context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes;
- lldebugs << this << "Setting context to " << context << llendl;
+ LL_DEBUGS() << this << "Setting context to " << context << LL_ENDL;
return STATUS_DONE;
default:
PUMP_DEBUG;
context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes;
context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes;
- lldebugs << this << "Setting context to " << context << llendl;
+ LL_DEBUGS() << this << "Setting context to " << context << LL_ENDL;
return STATUS_ERROR;
}
}
@@ -468,10 +455,10 @@ void LLURLRequest::initialize()
mResponseTransferedBytes = 0;
}
-static LLFastTimer::DeclareTimer FTM_URL_REQUEST_CONFIGURE("URL Configure");
+static LLTrace::BlockTimerStatHandle FTM_URL_REQUEST_CONFIGURE("URL Configure");
bool LLURLRequest::configure()
{
- LLFastTimer t(FTM_URL_REQUEST_CONFIGURE);
+ LL_RECORD_BLOCK_TIME(FTM_URL_REQUEST_CONFIGURE);
bool rv = false;
S32 bytes = mDetail->mResponseBuffer->countAfter(
@@ -503,21 +490,32 @@ bool LLURLRequest::configure()
case HTTP_PUT:
// Disable the expect http 1.1 extension. POST and PUT default
// to turning this on, and I am not too sure what it means.
- addHeader("Expect:");
+ addHeader(HTTP_OUT_HEADER_EXPECT);
mDetail->mCurlRequest->setopt(CURLOPT_UPLOAD, 1);
mDetail->mCurlRequest->setopt(CURLOPT_INFILESIZE, bytes);
rv = true;
break;
+ case HTTP_PATCH:
+ // Disable the expect http 1.1 extension. POST and PUT default
+ // to turning this on, and I am not too sure what it means.
+ addHeader(HTTP_OUT_HEADER_EXPECT);
+
+ mDetail->mCurlRequest->setopt(CURLOPT_UPLOAD, 1);
+ mDetail->mCurlRequest->setopt(CURLOPT_INFILESIZE, bytes);
+ mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "PATCH");
+ rv = true;
+ break;
+
case HTTP_POST:
// Disable the expect http 1.1 extension. POST and PUT default
// to turning this on, and I am not too sure what it means.
- addHeader("Expect:");
+ addHeader(HTTP_OUT_HEADER_EXPECT);
// Disable the content type http header.
// *FIX: what should it be?
- addHeader("Content-Type:");
+ addHeader(HTTP_OUT_HEADER_CONTENT_TYPE);
// Set the handle for an http post
mDetail->mCurlRequest->setPost(NULL, bytes);
@@ -528,20 +526,26 @@ bool LLURLRequest::configure()
break;
case HTTP_DELETE:
- // Set the handle for an http post
+ // Set the handle for an http delete
mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "DELETE");
rv = true;
break;
+ case HTTP_COPY:
+ // Set the handle for an http copy
+ mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "COPY");
+ rv = true;
+ break;
+
case HTTP_MOVE:
- // Set the handle for an http post
+ // Set the handle for an http move
mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "MOVE");
// *NOTE: should we check for the Destination header?
rv = true;
break;
default:
- llwarns << "Unhandled URLRequest action: " << mAction << llendl;
+ LL_WARNS() << "Unhandled URLRequest action: " << mAction << LL_ENDL;
break;
}
if(rv)
@@ -647,7 +651,7 @@ static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user)
S32 status_code = atoi(status.c_str());
if (status_code > 0)
{
- complete->httpStatus((U32)status_code, reason);
+ complete->httpStatus(status_code, reason);
return header_len;
}
}
@@ -669,14 +673,14 @@ static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user)
LLStringUtil::trim(header);
if (!header.empty())
{
- llwarns << "Unable to parse header: " << header << llendl;
+ LL_WARNS() << "Unable to parse header: " << header << LL_ENDL;
}
}
return header_len;
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_URL_EXTRACTOR("URL Extractor");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_EXTRACTOR("URL Extractor");
/**
* LLContextURLExtractor
*/
@@ -688,7 +692,7 @@ LLIOPipe::EStatus LLContextURLExtractor::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_URL_EXTRACTOR);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_EXTRACTOR);
PUMP_DEBUG;
// The destination host is in the context.
if(context.isUndefined() || !mRequest)
@@ -747,15 +751,15 @@ void LLURLRequestComplete::complete(const LLChannelDescriptors& channels,
void LLURLRequestComplete::response(const LLChannelDescriptors& channels,
const buffer_ptr_t& buffer)
{
- llwarns << "LLURLRequestComplete::response default implementation called"
- << llendl;
+ LL_WARNS() << "LLURLRequestComplete::response default implementation called"
+ << LL_ENDL;
}
//virtual
void LLURLRequestComplete::noResponse()
{
- llwarns << "LLURLRequestComplete::noResponse default implementation called"
- << llendl;
+ LL_WARNS() << "LLURLRequestComplete::noResponse default implementation called"
+ << LL_ENDL;
}
void LLURLRequestComplete::responseStatus(LLIOPipe::EStatus status)
@@ -763,7 +767,7 @@ void LLURLRequestComplete::responseStatus(LLIOPipe::EStatus status)
mRequestStatus = status;
}
-static LLFastTimer::DeclareTimer FTM_PROCESS_URL_COMPLETE("URL Complete");
+static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_COMPLETE("URL Complete");
// virtual
LLIOPipe::EStatus LLURLRequestComplete::process_impl(
const LLChannelDescriptors& channels,
@@ -772,7 +776,7 @@ LLIOPipe::EStatus LLURLRequestComplete::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- LLFastTimer t(FTM_PROCESS_URL_COMPLETE);
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_COMPLETE);
PUMP_DEBUG;
complete(channels, buffer);
return STATUS_OK;
diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h
index 20d6e30d17..88fccd4bf6 100755
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -42,9 +42,10 @@
#include "llcurl.h"
-extern const std::string CONTEXT_REQUEST;
+/**
+ * External constants
+ */
extern const std::string CONTEXT_DEST_URI_SD_LABEL;
-extern const std::string CONTEXT_RESPONSE;
extern const std::string CONTEXT_TRANSFERED_BYTES;
class LLURLRequestDetail;
@@ -68,42 +69,22 @@ class LLURLRequest : public LLIOPipe
{
LOG_CLASS(LLURLRequest);
public:
-
typedef int (* SSLCertVerifyCallback)(X509_STORE_CTX *ctx, void *param);
- /**
- * @brief This enumeration is for specifying the type of request.
- */
- enum ERequestAction
- {
- INVALID,
- HTTP_HEAD,
- HTTP_GET,
- HTTP_PUT,
- HTTP_POST,
- HTTP_DELETE,
- HTTP_MOVE, // Caller will need to set 'Destination' header
- REQUEST_ACTION_COUNT
- };
-
- /**
- * @brief Turn the requst action into an http verb.
- */
- static std::string actionAsVerb(ERequestAction action);
/**
* @brief Constructor.
*
- * @param action One of the ERequestAction enumerations.
+ * @param action One of the EHTTPMethod enumerations.
*/
- LLURLRequest(ERequestAction action, bool follow_redirects = true);
+ LLURLRequest(EHTTPMethod action, bool follow_redirects = true);
/**
* @brief Constructor.
*
- * @param action One of the ERequestAction enumerations.
+ * @param action One of the EHTTPMethod enumerations.
* @param url The url of the request. It should already be encoded.
*/
- LLURLRequest(ERequestAction action, const std::string& url, bool follow_redirects = true);
+ LLURLRequest(EHTTPMethod action, const std::string& url, bool follow_redirects = true);
/**
* @brief Destructor.
@@ -123,17 +104,17 @@ public:
*
*/
void setURL(const std::string& url);
- std::string getURL() const;
+ const std::string& getURL() const;
/**
* @brief Add a header to the http post.
*
- * The header must be correctly formatted for HTTP requests. This
- * provides a raw interface if you know what kind of request you
+ * This provides a raw interface if you know what kind of request you
* will be making during construction of this instance. All
* required headers will be automatically constructed, so this is
* usually useful for encoding parameters.
*/
- void addHeader(const char* header);
+ void addHeader(const std::string& header, const std::string& value = "");
+ void addHeaderRaw(const char* header);
/**
* @brief Check remote server certificate signed by a known root CA.
@@ -218,7 +199,7 @@ protected:
STATE_HAVE_RESPONSE,
};
EState mState;
- ERequestAction mAction;
+ EHTTPMethod mAction;
bool mFollowRedirects;
LLURLRequestDetail* mDetail;
LLIOPipe::ptr_t mCompletionCallback;
@@ -316,7 +297,7 @@ public:
// May be called more than once, particularly for redirects and proxy madness.
// Ex. a 200 for a connection to https through a proxy, followed by the "real" status
// a 3xx for a redirect followed by a "real" status, or more redirects.
- virtual void httpStatus(U32 status, const std::string& reason) { }
+ virtual void httpStatus(S32 status, const std::string& reason) { }
virtual void complete(
const LLChannelDescriptors& channels,
@@ -369,15 +350,8 @@ protected:
//@}
// value to note if we actually got the response. This value
- // depends on correct useage from the LLURLRequest instance.
+ // depends on correct usage from the LLURLRequest instance.
EStatus mRequestStatus;
};
-
-
-/**
- * External constants
- */
-extern const std::string CONTEXT_DEST_URI_SD_LABEL;
-
#endif // LL_LLURLREQUEST_H
diff --git a/indra/llmessage/lluseroperation.cpp b/indra/llmessage/lluseroperation.cpp
index a4a68d0c81..c506af19ce 100755
--- a/indra/llmessage/lluseroperation.cpp
+++ b/indra/llmessage/lluseroperation.cpp
@@ -100,7 +100,7 @@ LLUserOperationMgr::~LLUserOperationMgr()
{
if (mUserOperationList.size() > 0)
{
- llwarns << "Exiting with user operations pending." << llendl;
+ LL_WARNS() << "Exiting with user operations pending." << LL_ENDL;
}
}
@@ -109,7 +109,7 @@ void LLUserOperationMgr::addOperation(LLUserOperation* op)
{
if(!op)
{
- llwarns << "Tried to add null op" << llendl;
+ LL_WARNS() << "Tried to add null op" << LL_ENDL;
return;
}
LLUUID id = op->getTransactionID();
@@ -160,7 +160,7 @@ void LLUserOperationMgr::deleteExpiredOperations()
op = (*it).second;
if(op && op->isExpired())
{
- lldebugs << "expiring: " << (*it).first << llendl;
+ LL_DEBUGS() << "expiring: " << (*it).first << LL_ENDL;
op->expire();
mUserOperationList.erase(it++);
delete op;
diff --git a/indra/llmessage/llxfer.cpp b/indra/llmessage/llxfer.cpp
index f8c55d52ad..4aba5cae72 100755
--- a/indra/llmessage/llxfer.cpp
+++ b/indra/llmessage/llxfer.cpp
@@ -99,7 +99,7 @@ void LLXfer::cleanup ()
S32 LLXfer::startSend (U64 xfer_id, const LLHost &remote_host)
{
- llwarns << "undifferentiated LLXfer::startSend for " << getFileName() << llendl;
+ LL_WARNS() << "undifferentiated LLXfer::startSend for " << getFileName() << LL_ENDL;
return (-1);
}
@@ -115,8 +115,8 @@ void LLXfer::setXferSize (S32 xfer_size)
S32 LLXfer::startDownload()
{
- llwarns << "undifferentiated LLXfer::startDownload for " << getFileName()
- << llendl;
+ LL_WARNS() << "undifferentiated LLXfer::startDownload for " << getFileName()
+ << LL_ENDL;
return (-1);
}
@@ -140,7 +140,7 @@ S32 LLXfer::receiveData (char *datap, S32 data_size)
}
else
{
- llerrs << "NULL data passed in receiveData" << llendl;
+ LL_ERRS() << "NULL data passed in receiveData" << LL_ENDL;
}
}
@@ -163,7 +163,7 @@ S32 LLXfer::flush()
S32 LLXfer::suck(S32 start_position)
{
- llwarns << "Attempted to send a packet outside the buffer bounds in LLXfer::suck()" << llendl;
+ LL_WARNS() << "Attempted to send a packet outside the buffer bounds in LLXfer::suck()" << LL_ENDL;
return (-1);
}
@@ -196,7 +196,7 @@ void LLXfer::sendPacket(S32 packet_num)
if (fdata_size < 0)
{
- llwarns << "negative data size in xfer send, aborting" << llendl;
+ LL_WARNS() << "negative data size in xfer send, aborting" << LL_ENDL;
abort(LL_ERR_EOF);
return;
}
@@ -289,13 +289,13 @@ S32 LLXfer::processEOF()
if (LL_ERR_NOERR == mCallbackResult)
{
- llinfos << "xfer from " << mRemoteHost << " complete: " << getFileName()
- << llendl;
+ LL_INFOS() << "xfer from " << mRemoteHost << " complete: " << getFileName()
+ << LL_ENDL;
}
else
{
- llinfos << "xfer from " << mRemoteHost << " failed, code "
- << mCallbackResult << ": " << getFileName() << llendl;
+ LL_INFOS() << "xfer from " << mRemoteHost << " failed, code "
+ << mCallbackResult << ": " << getFileName() << LL_ENDL;
}
if (mCallback)
@@ -323,8 +323,8 @@ void LLXfer::abort (S32 result_code)
{
mCallbackResult = result_code;
- llinfos << "Aborting xfer from " << mRemoteHost << " named " << getFileName()
- << " - error: " << result_code << llendl;
+ LL_INFOS() << "Aborting xfer from " << mRemoteHost << " named " << getFileName()
+ << " - error: " << result_code << LL_ENDL;
gMessageSystem->newMessageFast(_PREHASH_AbortXfer);
gMessageSystem->nextBlockFast(_PREHASH_XferID);
diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h
index f9348eb11f..edf5eeb82d 100755
--- a/indra/llmessage/llxfer.h
+++ b/indra/llmessage/llxfer.h
@@ -32,6 +32,10 @@
#include "llextendedstatus.h"
const S32 LL_XFER_LARGE_PAYLOAD = 7680;
+const S32 LL_ERR_FILE_EMPTY = -44;
+const int LL_ERR_FILE_NOT_FOUND = -43;
+const int LL_ERR_CANNOT_OPEN_FILE = -42;
+const int LL_ERR_EOF = -39;
typedef enum ELLXferStatus {
e_LL_XFER_UNINITIALIZED,
diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp
index 9e02af2c3e..257a13f277 100755
--- a/indra/llmessage/llxfer_file.cpp
+++ b/indra/llmessage/llxfer_file.cpp
@@ -102,12 +102,12 @@ void LLXfer_File::cleanup ()
if (mDeleteLocalOnCompletion)
{
- lldebugs << "Removing file: " << mLocalFilename << llendl;
+ LL_DEBUGS() << "Removing file: " << mLocalFilename << LL_ENDL;
LLFile::remove(mLocalFilename);
}
else
{
- lldebugs << "Keeping local file: " << mLocalFilename << llendl;
+ LL_DEBUGS() << "Keeping local file: " << mLocalFilename << LL_ENDL;
}
LLXfer::cleanup();
@@ -139,7 +139,7 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id,
mCallbackDataHandle = user_data;
mCallbackResult = LL_ERR_NOERR;
- llinfos << "Requesting xfer from " << remote_host << " for file: " << mLocalFilename << llendl;
+ LL_INFOS() << "Requesting xfer from " << remote_host << " for file: " << mLocalFilename << LL_ENDL;
if (mBuffer)
{
@@ -182,7 +182,7 @@ S32 LLXfer_File::startDownload()
}
else
{
- llwarns << "Couldn't create file to be received!" << llendl;
+ LL_WARNS() << "Couldn't create file to be received!" << LL_ENDL;
retval = -1;
}
@@ -223,7 +223,7 @@ S32 LLXfer_File::startSend (U64 xfer_id, const LLHost &remote_host)
}
else
{
- llinfos << "Warning: " << mLocalFilename << " not found." << llendl;
+ LL_INFOS() << "Warning: " << mLocalFilename << " not found." << LL_ENDL;
return (LL_ERR_FILE_NOT_FOUND);
}
@@ -279,7 +279,7 @@ S32 LLXfer_File::flush()
{
if (mFp)
{
- llerrs << "Overwriting open file pointer!" << llendl;
+ LL_ERRS() << "Overwriting open file pointer!" << LL_ENDL;
}
mFp = LLFile::fopen(mTempFilename,"a+b"); /* Flawfinder : ignore */
@@ -287,10 +287,10 @@ S32 LLXfer_File::flush()
{
if (fwrite(mBuffer,1,mBufferLength,mFp) != mBufferLength)
{
- llwarns << "Short write" << llendl;
+ LL_WARNS() << "Short write" << LL_ENDL;
}
-// llinfos << "******* wrote " << mBufferLength << " bytes of file xfer" << llendl;
+// LL_INFOS() << "******* wrote " << mBufferLength << " bytes of file xfer" << LL_ENDL;
fclose(mFp);
mFp = NULL;
@@ -298,7 +298,7 @@ S32 LLXfer_File::flush()
}
else
{
- llwarns << "LLXfer_File::flush() unable to open " << mTempFilename << " for writing!" << llendl;
+ LL_WARNS() << "LLXfer_File::flush() unable to open " << mTempFilename << " for writing!" << LL_ENDL;
retval = LL_ERR_CANNOT_OPEN_FILE;
}
}
@@ -329,37 +329,37 @@ S32 LLXfer_File::processEOF()
{
#if !LL_WINDOWS
S32 error_number = errno;
- llinfos << "Rename failure (" << error_number << ") - "
- << mTempFilename << " to " << mLocalFilename << llendl;
+ LL_INFOS() << "Rename failure (" << error_number << ") - "
+ << mTempFilename << " to " << mLocalFilename << LL_ENDL;
if(EXDEV == error_number)
{
if(copy_file(mTempFilename, mLocalFilename) == 0)
{
- llinfos << "Rename across mounts; copying+unlinking the file instead." << llendl;
+ LL_INFOS() << "Rename across mounts; copying+unlinking the file instead." << LL_ENDL;
unlink(mTempFilename.c_str());
}
else
{
- llwarns << "Copy failure - " << mTempFilename << " to "
- << mLocalFilename << llendl;
+ LL_WARNS() << "Copy failure - " << mTempFilename << " to "
+ << mLocalFilename << LL_ENDL;
}
}
else
{
//LLFILE* fp = LLFile::fopen(mTempFilename, "r");
- //llwarns << "File " << mTempFilename << " does "
- // << (!fp ? "not" : "" ) << " exit." << llendl;
+ //LL_WARNS() << "File " << mTempFilename << " does "
+ // << (!fp ? "not" : "" ) << " exit." << LL_ENDL;
//if(fp) fclose(fp);
//fp = LLFile::fopen(mLocalFilename, "r");
- //llwarns << "File " << mLocalFilename << " does "
- // << (!fp ? "not" : "" ) << " exit." << llendl;
+ //LL_WARNS() << "File " << mLocalFilename << " does "
+ // << (!fp ? "not" : "" ) << " exit." << LL_ENDL;
//if(fp) fclose(fp);
- llwarns << "Rename fatally failed, can only handle EXDEV ("
- << EXDEV << ")" << llendl;
+ LL_WARNS() << "Rename fatally failed, can only handle EXDEV ("
+ << EXDEV << ")" << LL_ENDL;
}
#else
- llwarns << "Rename failure - " << mTempFilename << " to "
- << mLocalFilename << llendl;
+ LL_WARNS() << "Rename failure - " << mTempFilename << " to "
+ << mLocalFilename << LL_ENDL;
#endif
}
}
diff --git a/indra/llmessage/llxfer_mem.cpp b/indra/llmessage/llxfer_mem.cpp
index 4c7e83c33d..3bea08f2e5 100755
--- a/indra/llmessage/llxfer_mem.cpp
+++ b/indra/llmessage/llxfer_mem.cpp
@@ -130,7 +130,7 @@ S32 LLXfer_Mem::processEOF()
mStatus = e_LL_XFER_COMPLETE;
- llinfos << "xfer complete: " << getFileName() << llendl;
+ LL_INFOS() << "xfer complete: " << getFileName() << LL_ENDL;
if (mCallback)
{
@@ -164,7 +164,7 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id,
mRemotePath = remote_path;
mDeleteRemoteOnCompletion = delete_remote_on_completion;
- llinfos << "Requesting file: " << remote_filename << llendl;
+ LL_INFOS() << "Requesting file: " << remote_filename << LL_ENDL;
delete [] mBuffer;
mBuffer = NULL;
diff --git a/indra/llmessage/llxfer_vfile.cpp b/indra/llmessage/llxfer_vfile.cpp
index 751a69518c..4a378d1d34 100755
--- a/indra/llmessage/llxfer_vfile.cpp
+++ b/indra/llmessage/llxfer_vfile.cpp
@@ -118,7 +118,7 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id,
mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType));
- llinfos << "Requesting " << mName << llendl;
+ LL_INFOS() << "Requesting " << mName << LL_ENDL;
if (mBuffer)
{
@@ -236,8 +236,8 @@ S32 LLXfer_VFile::suck(S32 start_position)
// grab a buffer from the right place in the file
if (! mVFile->seek(start_position, 0))
{
- llwarns << "VFile Xfer Can't seek to position " << start_position << ", file length " << mVFile->getSize() << llendl;
- llwarns << "While sending file " << mLocalID << llendl;
+ LL_WARNS() << "VFile Xfer Can't seek to position " << start_position << ", file length " << mVFile->getSize() << LL_ENDL;
+ LL_WARNS() << "While sending file " << mLocalID << LL_ENDL;
return -1;
}
@@ -291,7 +291,7 @@ S32 LLXfer_VFile::processEOF()
LLVFile file(mVFS, mTempID, mType, LLVFile::WRITE);
if (! file.rename(mLocalID, mType))
{
- llinfos << "copy from temp file failed: unable to rename to " << mLocalID << llendl;
+ LL_INFOS() << "copy from temp file failed: unable to rename to " << mLocalID << LL_ENDL;
}
}
diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp
index 00b9d81611..b518dd1b72 100755
--- a/indra/llmessage/llxfermanager.cpp
+++ b/indra/llmessage/llxfermanager.cpp
@@ -196,13 +196,13 @@ void LLXferManager::printHostStatus()
LLHostStatus *host_statusp = NULL;
if (!mOutgoingHosts.empty())
{
- llinfos << "Outgoing Xfers:" << llendl;
+ LL_INFOS() << "Outgoing Xfers:" << LL_ENDL;
for (status_list_t::iterator iter = mOutgoingHosts.begin();
iter != mOutgoingHosts.end(); ++iter)
{
host_statusp = *iter;
- llinfos << " " << host_statusp->mHost << " active: " << host_statusp->mNumActive << " pending: " << host_statusp->mNumPending << llendl;
+ LL_INFOS() << " " << host_statusp->mHost << " active: " << host_statusp->mNumActive << " pending: " << host_statusp->mNumPending << LL_ENDL;
}
}
}
@@ -392,7 +392,7 @@ U64 LLXferManager::registerXfer(const void *datap, const S32 length)
}
else
{
- llerrs << "Xfer allocation error" << llendl;
+ LL_ERRS() << "Xfer allocation error" << LL_ENDL;
xfer_id = 0;
}
@@ -455,7 +455,7 @@ void LLXferManager::requestFile(const std::string& local_filename,
}
else
{
- llerrs << "Xfer allocation error" << llendl;
+ LL_ERRS() << "Xfer allocation error" << LL_ENDL;
}
}
@@ -483,7 +483,7 @@ void LLXferManager::requestFile(const std::string& remote_filename,
}
else
{
- llerrs << "Xfer allocation error" << llendl;
+ LL_ERRS() << "Xfer allocation error" << LL_ENDL;
}
}
@@ -528,7 +528,7 @@ void LLXferManager::requestVFile(const LLUUID& local_id,
}
else
{
- llerrs << "Xfer allocation error" << llendl;
+ LL_ERRS() << "Xfer allocation error" << LL_ENDL;
}
}
@@ -570,7 +570,7 @@ void LLXferManager::requestXfer(
}
else
{
- llerrs << "Xfer allcoation error" << llendl;
+ LL_ERRS() << "Xfer allcoation error" << LL_ENDL;
}
}
@@ -589,7 +589,7 @@ void LLXferManager::requestXfer(U64 xfer_id, const LLHost &remote_host, BOOL del
}
else
{
- llerrs << "Xfer allcoation error" << llendl;
+ LL_ERRS() << "Xfer allcoation error" << LL_ENDL;
}
}
*/
@@ -616,9 +616,9 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user
if (!xferp)
{
char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */
- llwarns << "received xfer data from " << mesgsys->getSender()
+ LL_WARNS() << "received xfer data from " << mesgsys->getSender()
<< " for non-existent xfer id: "
- << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << llendl;
+ << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << LL_ENDL;
return;
}
@@ -629,11 +629,11 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user
// confirm it if it was a resend of the last one, since the confirmation might have gotten dropped
if (decodePacketNum(packetnum) == (xferp->mPacketNum - 1))
{
- llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender());
+ LL_INFOS() << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet " << packetnum << LL_ENDL; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender());
}
else
{
- llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl;
+ LL_INFOS() << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << LL_ENDL;
}
return;
}
@@ -677,7 +677,7 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user
ack_info.mID = id;
ack_info.mPacketNum = decodePacketNum(packetnum);
ack_info.mRemoteHost = mesgsys->getSender();
- mXferAckQueue.push(ack_info);
+ mXferAckQueue.push_back(ack_info);
}
if (isLastPacket(packetnum))
@@ -802,8 +802,8 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
mesgsys->getU64Fast(_PREHASH_XferID, _PREHASH_ID, id);
char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */
- llinfos << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF))
- << " to " << mesgsys->getSender() << llendl;
+ LL_INFOS() << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF))
+ << " to " << mesgsys->getSender() << LL_ENDL;
mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, local_filename);
@@ -823,16 +823,16 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
{
if(NULL == LLAssetType::lookup(type))
{
- llwarns << "Invalid type for xfer request: " << uuid << ":"
- << type_s16 << " to " << mesgsys->getSender() << llendl;
+ LL_WARNS() << "Invalid type for xfer request: " << uuid << ":"
+ << type_s16 << " to " << mesgsys->getSender() << LL_ENDL;
return;
}
- llinfos << "starting vfile transfer: " << uuid << "," << LLAssetType::lookup(type) << " to " << mesgsys->getSender() << llendl;
+ LL_INFOS() << "starting vfile transfer: " << uuid << "," << LLAssetType::lookup(type) << " to " << mesgsys->getSender() << LL_ENDL;
if (! mVFS)
{
- llwarns << "Attempt to send VFile w/o available VFS" << llendl;
+ LL_WARNS() << "Attempt to send VFile w/o available VFS" << LL_ENDL;
return;
}
@@ -845,7 +845,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
}
else
{
- llerrs << "Xfer allcoation error" << llendl;
+ LL_ERRS() << "Xfer allcoation error" << LL_ENDL;
}
}
else if (!local_filename.empty())
@@ -868,7 +868,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
case LL_PATH_NONE:
if(!validateFileForTransfer(local_filename))
{
- llwarns << "SECURITY: Unapproved filename '" << local_filename << llendl;
+ LL_WARNS() << "SECURITY: Unapproved filename '" << local_filename << LL_ENDL;
return;
}
break;
@@ -876,13 +876,13 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
case LL_PATH_CACHE:
if(!verify_cache_filename(local_filename))
{
- llwarns << "SECURITY: Illegal cache filename '" << local_filename << llendl;
+ LL_WARNS() << "SECURITY: Illegal cache filename '" << local_filename << LL_ENDL;
return;
}
break;
default:
- llwarns << "SECURITY: Restricted file dir enum: " << (U32)local_path << llendl;
+ LL_WARNS() << "SECURITY: Restricted file dir enum: " << (U32)local_path << LL_ENDL;
return;
}
@@ -897,7 +897,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
{
expanded_filename = local_filename;
}
- llinfos << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << llendl;
+ LL_INFOS() << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << LL_ENDL;
BOOL delete_local_on_completion = FALSE;
mesgsys->getBOOL("XferID", "DeleteOnCompletion", delete_local_on_completion);
@@ -913,15 +913,15 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
}
else
{
- llerrs << "Xfer allcoation error" << llendl;
+ LL_ERRS() << "Xfer allcoation error" << LL_ENDL;
}
}
else
{
char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */
- llinfos << "starting memory transfer: "
+ LL_INFOS() << "starting memory transfer: "
<< U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << " to "
- << mesgsys->getSender() << llendl;
+ << mesgsys->getSender() << LL_ENDL;
xferp = findXfer(id, mSendList);
@@ -931,7 +931,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
}
else
{
- llinfos << "Warning: " << U64_BUF << " not found." << llendl;
+ LL_INFOS() << "Warning: " << U64_BUF << " not found." << LL_ENDL;
result = LL_ERR_FILE_NOT_FOUND;
}
}
@@ -945,7 +945,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
}
else // can happen with a memory transfer not found
{
- llinfos << "Aborting xfer to " << mesgsys->getSender() << " with error: " << result << llendl;
+ LL_INFOS() << "Aborting xfer to " << mesgsys->getSender() << " with error: " << result << LL_ENDL;
mesgsys->newMessageFast(_PREHASH_AbortXfer);
mesgsys->nextBlockFast(_PREHASH_XferID);
@@ -959,18 +959,18 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
{
xferp->sendNextPacket();
changeNumActiveXfers(xferp->mRemoteHost,1);
-// llinfos << "***STARTING XFER IMMEDIATELY***" << llendl;
+// LL_INFOS() << "***STARTING XFER IMMEDIATELY***" << LL_ENDL;
}
else
{
if(xferp)
{
- llinfos << " queueing xfer request, " << numPendingXfers(xferp->mRemoteHost) << " ahead of this one" << llendl;
+ LL_INFOS() << " queueing xfer request, " << numPendingXfers(xferp->mRemoteHost) << " ahead of this one" << LL_ENDL;
}
else
{
- llwarns << "LLXferManager::processFileRequest() - no xfer found!"
- << llendl;
+ LL_WARNS() << "LLXferManager::processFileRequest() - no xfer found!"
+ << LL_ENDL;
}
}
}
@@ -1016,7 +1016,7 @@ void LLXferManager::retransmitUnackedPackets ()
// if the circuit dies, abort
if (! gMessageSystem->mCircuitInfo.isCircuitAlive( xferp->mRemoteHost ))
{
- llinfos << "Xfer found in progress on dead circuit, aborting" << llendl;
+ LL_INFOS() << "Xfer found in progress on dead circuit, aborting" << LL_ENDL;
xferp->mCallbackResult = LL_ERR_CIRCUIT_GONE;
xferp->processEOF();
delp = xferp;
@@ -1038,7 +1038,7 @@ void LLXferManager::retransmitUnackedPackets ()
{
if (xferp->mRetries > LL_PACKET_RETRY_LIMIT)
{
- llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet retransmit limit exceeded, xfer dropped" << llendl;
+ LL_INFOS() << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet retransmit limit exceeded, xfer dropped" << LL_ENDL;
xferp->abort(LL_ERR_TCP_TIMEOUT);
delp = xferp;
xferp = xferp->mNext;
@@ -1046,14 +1046,14 @@ void LLXferManager::retransmitUnackedPackets ()
}
else
{
- llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl;
+ LL_INFOS() << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << LL_ENDL;
xferp->resendLastPacket();
xferp = xferp->mNext;
}
}
else if ((xferp->mStatus == e_LL_XFER_REGISTERED) && ( (et = xferp->ACKTimer.getElapsedTimeF32()) > LL_XFER_REGISTRATION_TIMEOUT))
{
- llinfos << "registered xfer never requested, xfer dropped" << llendl;
+ LL_INFOS() << "registered xfer never requested, xfer dropped" << LL_ENDL;
xferp->abort(LL_ERR_TCP_TIMEOUT);
delp = xferp;
xferp = xferp->mNext;
@@ -1061,17 +1061,17 @@ void LLXferManager::retransmitUnackedPackets ()
}
else if (xferp->mStatus == e_LL_XFER_ABORTED)
{
- llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << llendl;
+ LL_WARNS() << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << LL_ENDL;
delp = xferp;
xferp = xferp->mNext;
removeXfer(delp,&mSendList);
}
else if (xferp->mStatus == e_LL_XFER_PENDING)
{
-// llinfos << "*** numActiveXfers = " << numActiveXfers(xferp->mRemoteHost) << " mMaxOutgoingXfersPerCircuit = " << mMaxOutgoingXfersPerCircuit << llendl;
+// LL_INFOS() << "*** numActiveXfers = " << numActiveXfers(xferp->mRemoteHost) << " mMaxOutgoingXfersPerCircuit = " << mMaxOutgoingXfersPerCircuit << LL_ENDL;
if (numActiveXfers(xferp->mRemoteHost) < mMaxOutgoingXfersPerCircuit)
{
-// llinfos << "bumping pending xfer to active" << llendl;
+// LL_INFOS() << "bumping pending xfer to active" << LL_ENDL;
xferp->sendNextPacket();
changeNumActiveXfers(xferp->mRemoteHost,1);
}
@@ -1088,16 +1088,16 @@ void LLXferManager::retransmitUnackedPackets ()
// so we don't blow through bandwidth.
//
- while (mXferAckQueue.getLength())
+ while (mXferAckQueue.size())
{
if (mAckThrottle.checkOverflow(1000.0f*8.0f))
{
break;
}
- //llinfos << "Confirm packet queue length:" << mXferAckQueue.getLength() << llendl;
- LLXferAckInfo ack_info;
- mXferAckQueue.pop(ack_info);
- //llinfos << "Sending confirm packet" << llendl;
+ //LL_INFOS() << "Confirm packet queue length:" << mXferAckQueue.size() << LL_ENDL;
+ LLXferAckInfo ack_info = mXferAckQueue.front();
+ mXferAckQueue.pop_front();
+ //LL_INFOS() << "Sending confirm packet" << LL_ENDL;
sendConfirmPacket(gMessageSystem, ack_info.mID, ack_info.mPacketNum, ack_info.mRemoteHost);
mAckThrottle.throttleOverflow(1000.f*8.f); // Assume 1000 bytes/packet
}
@@ -1156,9 +1156,9 @@ void LLXferManager::startPendingDownloads()
S32 start_count = mMaxIncomingXfers - download_count;
- lldebugs << "LLXferManager::startPendingDownloads() - XFER_IN_PROGRESS: "
+ LL_DEBUGS() << "LLXferManager::startPendingDownloads() - XFER_IN_PROGRESS: "
<< download_count << " XFER_PENDING: " << pending_count
- << " startring " << llmin(start_count, pending_count) << llendl;
+ << " startring " << llmin(start_count, pending_count) << LL_ENDL;
if((start_count > 0) && (pending_count > 0))
{
diff --git a/indra/llmessage/llxfermanager.h b/indra/llmessage/llxfermanager.h
index b84bccb5b7..b3d110e7a1 100755
--- a/indra/llmessage/llxfermanager.h
+++ b/indra/llmessage/llxfermanager.h
@@ -41,7 +41,7 @@ class LLVFS;
#include "message.h"
#include "llassetstorage.h"
#include "lldir.h"
-#include "lllinkedqueue.h"
+#include <deque>
#include "llthrottle.h"
class LLHostStatus
@@ -80,7 +80,7 @@ class LLXferManager
S32 mMaxIncomingXfers;
BOOL mUseAckThrottling; // Use ack throttling to cap file xfer bandwidth
- LLLinkedQueue<LLXferAckInfo> mXferAckQueue;
+ std::deque<LLXferAckInfo> mXferAckQueue;
LLThrottle mAckThrottle;
public:
diff --git a/indra/llmessage/machine.cpp b/indra/llmessage/machine.cpp
index 8d2f512037..1e9c9c3c9a 100755
--- a/indra/llmessage/machine.cpp
+++ b/indra/llmessage/machine.cpp
@@ -33,7 +33,7 @@ void LLMachine::setMachinePort(S32 port)
{
if (port < 0)
{
- llinfos << "Can't assign a negative number to LLMachine::mPort" << llendl;
+ LL_INFOS() << "Can't assign a negative number to LLMachine::mPort" << LL_ENDL;
mHost.setPort(0);
}
else
@@ -46,7 +46,7 @@ void LLMachine::setControlPort( S32 port )
{
if (port < 0)
{
- llinfos << "Can't assign a negative number to LLMachine::mControlPort" << llendl;
+ LL_INFOS() << "Can't assign a negative number to LLMachine::mControlPort" << LL_ENDL;
mControlPort = 0;
}
else
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index c3642ccbe8..cc2d5d66ad 100755
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -47,10 +47,8 @@
// linden library headers
#include "indra_constants.h"
-#include "lldarray.h"
#include "lldir.h"
#include "llerror.h"
-#include "llerrorlegacy.h"
#include "llfasttimer.h"
#include "llhttpclient.h"
#include "llhttpnodeadapter.h"
@@ -73,7 +71,6 @@
#include "lltransfermanager.h"
#include "lluuid.h"
#include "llxfermanager.h"
-#include "timing.h"
#include "llquaternion.h"
#include "u64.h"
#include "v3dmath.h"
@@ -83,7 +80,7 @@
// Constants
//const char* MESSAGE_LOG_FILENAME = "message.log";
-static const F32 CIRCUIT_DUMP_TIMEOUT = 30.f;
+static const F32Seconds CIRCUIT_DUMP_TIMEOUT(30.f);
static const S32 TRUST_TIME_WINDOW = 3;
// *NOTE: This needs to be moved into a seperate file so that it never gets
@@ -113,20 +110,20 @@ namespace
{
}
- virtual void error(U32 status, const std::string& reason)
+ protected:
+ virtual void httpFailure()
{
// don't spam when agent communication disconnected already
- if (status != 410)
+ if (HTTP_GONE != getStatus())
{
- LL_WARNS("Messaging") << "error status " << status
- << " for message " << mMessageName
- << " reason " << reason << llendl;
+ LL_WARNS("Messaging") << "error for message " << mMessageName
+ << " " << dumpResponse() << LL_ENDL;
}
// TODO: Map status in to useful error code.
if(NULL != mCallback) mCallback(mCallbackData, LL_ERR_TCP_TIMEOUT);
}
- virtual void result(const LLSD& content)
+ virtual void httpSuccess()
{
if(NULL != mCallback) mCallback(mCallbackData, LL_ERR_NOERR);
}
@@ -152,10 +149,10 @@ class LLMessageHandlerBridge : public LLHTTPNode
void LLMessageHandlerBridge::post(LLHTTPNode::ResponsePtr response,
const LLSD& context, const LLSD& input) const
{
- std::string name = context["request"]["wildcard"]["message-name"];
+ std::string name = context[CONTEXT_REQUEST][CONTEXT_WILDCARD]["message-name"];
char* namePtr = LLMessageStringTable::getInstance()->getString(name.c_str());
- lldebugs << "Setting mLastSender " << input["sender"].asString() << llendl;
+ LL_DEBUGS() << "Setting mLastSender " << input["sender"].asString() << LL_ENDL;
gMessageSystem->mLastSender = LLHost(input["sender"].asString());
gMessageSystem->mPacketsIn += 1;
gMessageSystem->mLLSDMessageReader->setMessage(namePtr, input["body"]);
@@ -241,7 +238,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
S32 version_patch,
bool failure_is_fatal,
const F32 circuit_heartbeat_interval, const F32 circuit_timeout) :
- mCircuitInfo(circuit_heartbeat_interval, circuit_timeout),
+ mCircuitInfo(F32Seconds(circuit_heartbeat_interval), F32Seconds(circuit_timeout)),
mLastMessageFromTrustedMessageService(false)
{
init();
@@ -262,7 +259,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
mSendPacketFailureCount = 0;
- mCircuitPrintFreq = 60.f; // seconds
+ mCircuitPrintFreq = F32Seconds(60.f);
loadTemplateFile(filename, failure_is_fatal);
@@ -284,14 +281,14 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
mbError = TRUE;
mErrorCode = error;
}
-// LL_DEBUGS("Messaging") << << "*** port: " << mPort << llendl;
+// LL_DEBUGS("Messaging") << << "*** port: " << mPort << LL_ENDL;
//
// Create the data structure that we can poll on
//
if (!gAPRPoolp)
{
- LL_ERRS("Messaging") << "No APR pool before message system initialization!" << llendl;
+ LL_ERRS("Messaging") << "No APR pool before message system initialization!" << LL_ENDL;
ll_init_apr();
}
apr_socket_t *aprSocketp = NULL;
@@ -306,20 +303,20 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
mPollInfop->mPollFD.desc.s = aprSocketp;
mPollInfop->mPollFD.client_data = NULL;
- F64 mt_sec = getMessageTimeSeconds();
+ F64Seconds mt_sec = getMessageTimeSeconds();
mResendDumpTime = mt_sec;
mMessageCountTime = mt_sec;
mCircuitPrintTime = mt_sec;
- mCurrentMessageTimeSeconds = mt_sec;
+ mCurrentMessageTime = F64Seconds(mt_sec);
// Constants for dumping output based on message processing time/count
mNumMessageCounts = 0;
mMaxMessageCounts = 200; // >= 0 means dump warnings
- mMaxMessageTime = 1.f;
+ mMaxMessageTime = F32Seconds(1.f);
mTrueReceiveSize = 0;
- mReceiveTime = 0.f;
+ mReceiveTime = F32Seconds(0.f);
}
@@ -329,7 +326,7 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure
{
if(filename.empty())
{
- LL_ERRS("Messaging") << "No template filename specified" << llendl;
+ LL_ERRS("Messaging") << "No template filename specified" << LL_ENDL;
mbError = TRUE;
return;
}
@@ -338,9 +335,9 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure
if(!_read_file_into_string(template_body, filename))
{
if (failure_is_fatal) {
- LL_ERRS("Messaging") << "Failed to open template: " << filename << llendl;
+ LL_ERRS("Messaging") << "Failed to open template: " << filename << LL_ENDL;
} else {
- LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl;
+ LL_WARNS("Messaging") << "Failed to open template: " << filename << LL_ENDL;
}
mbError = TRUE;
return;
@@ -534,7 +531,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
{
// This is the first message being handled after a resetReceiveCounts,
// we must be starting the message processing loop. Reset the timers.
- mCurrentMessageTimeSeconds = totalTime() * SEC_PER_USEC;
+ mCurrentMessageTime = totalTime();
mMessageCountTime = getMessageTimeSeconds();
}
@@ -566,7 +563,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
// Ones that are non-zero but below the minimum packet size are worrisome.
if (receive_size > 0)
{
- LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << llendl;
+ LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << LL_ENDL;
callExceptionFunc(MX_PACKET_TOO_SHORT);
}
// no data in packet receive buffer
@@ -592,7 +589,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
// the next one
LL_WARNS("Messaging") << "Malformed packet received. Packet size "
<< receive_size << " with invalid no. of acks " << acks
- << llendl;
+ << LL_ENDL;
valid_packet = FALSE;
continue;
}
@@ -620,7 +617,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
memcpy(&mem_id, &mTrueReceiveBuffer[true_rcv_size], /* Flawfinder: ignore*/
sizeof(TPACKETID));
packet_id = ntohl(mem_id);
- //LL_INFOS("Messaging") << "got ack: " << packet_id << llendl;
+ //LL_INFOS("Messaging") << "got ack: " << packet_id << LL_ENDL;
cdp->ackReliablePacket(packet_id);
}
if (!cdp->getUnackedPacketCount())
@@ -652,14 +649,14 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
// LL_WARNS("Messaging") << "DISCARDED PACKET HOST MISMATCH! HOST: "
// << host << " CIRCUIT: "
// << mCircuitInfo.mCurrentCircuit->mHost
- // << llendl;
+ // << LL_ENDL;
//}
// ***************************************
//mCircuitInfo.mCurrentCircuit->mAcks.put(mCurrentRecvPacketID);
cdp->collectRAck(mCurrentRecvPacketID);
}
- LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << llendl;
+ LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << LL_ENDL;
if(mVerboseLog)
{
std::ostringstream str;
@@ -671,7 +668,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
<< " resent "
<< ((acks > 0) ? "acks" : "")
<< " DISCARD DUPLICATE";
- LL_INFOS("Messaging") << str.str() << llendl;
+ LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
mPacketsIn++;
valid_packet = FALSE;
@@ -750,7 +747,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
{
if (mbProtected && (!cdp))
{
- LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << llendl;
+ LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << LL_ENDL;
mOffCircuitPackets++;
}
else
@@ -761,7 +758,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
}
} while (!valid_packet && receive_size > 0);
- F64 mt_sec = getMessageTimeSeconds();
+ F64Seconds mt_sec = getMessageTimeSeconds();
// Check to see if we need to print debug info
if ((mt_sec - mCircuitPrintTime) > mCircuitPrintFreq)
{
@@ -792,7 +789,7 @@ S32 LLMessageSystem::getReceiveBytes() const
void LLMessageSystem::processAcks()
{
- F64 mt_sec = getMessageTimeSeconds();
+ F64Seconds mt_sec = getMessageTimeSeconds();
{
gTransferManager.updateTransfers();
@@ -820,7 +817,7 @@ void LLMessageSystem::processAcks()
if (!mDenyTrustedCircuitSet.empty())
{
- LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << llendl;
+ LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << LL_ENDL;
for (host_set_t::iterator hostit = mDenyTrustedCircuitSet.begin(); hostit != mDenyTrustedCircuitSet.end(); ++hostit)
{
reallySendDenyTrustedCircuit(*hostit);
@@ -836,10 +833,10 @@ void LLMessageSystem::processAcks()
}
}
- if (mMaxMessageTime >= 0.f)
+ if (mMaxMessageTime >= F32Seconds(0.f))
{
// This is one of the only places where we're required to get REAL message system time.
- mReceiveTime = (F32)(getMessageTimeSeconds(TRUE) - mMessageCountTime);
+ mReceiveTime = getMessageTimeSeconds(TRUE) - mMessageCountTime;
if (mReceiveTime > mMaxMessageTime)
{
dump = TRUE;
@@ -894,7 +891,7 @@ LLSD LLMessageSystem::getBuiltMessageLLSD() const
else
{
// TODO: implement as below?
- llerrs << "Message not built as LLSD." << llendl;
+ LL_ERRS() << "Message not built as LLSD." << LL_ENDL;
}
return result;
}
@@ -1013,13 +1010,13 @@ S32 LLMessageSystem::sendReliable(const LLHost &host)
S32 LLMessageSystem::sendSemiReliable(const LLHost &host, void (*callback)(void **,S32), void ** callback_data)
{
- F32 timeout;
+ F32Seconds timeout;
LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
if (cdp)
{
timeout = llmax(LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS,
- LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged());
+ F32Seconds(LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged()));
}
else
{
@@ -1035,7 +1032,7 @@ S32 LLMessageSystem::sendSemiReliable(const LLHost &host, void (*callback)(void
S32 LLMessageSystem::sendReliable( const LLHost &host,
S32 retries,
BOOL ping_based_timeout,
- F32 timeout,
+ F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data)
{
@@ -1044,11 +1041,11 @@ S32 LLMessageSystem::sendReliable( const LLHost &host,
LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
if (cdp)
{
- timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, LL_RELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged());
+ timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, F32Seconds(LL_RELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged()));
}
else
{
- timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, LL_RELIABLE_TIMEOUT_FACTOR * LL_AVERAGED_PING_MAX);
+ timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, F32Seconds(LL_RELIABLE_TIMEOUT_FACTOR * LL_AVERAGED_PING_MAX));
}
}
@@ -1080,7 +1077,7 @@ void LLMessageSystem::forwardReliable(const U32 circuit_code)
S32 LLMessageSystem::forwardReliable( const LLHost &host,
S32 retries,
BOOL ping_based_timeout,
- F32 timeout,
+ F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data)
{
@@ -1090,13 +1087,13 @@ S32 LLMessageSystem::forwardReliable( const LLHost &host,
S32 LLMessageSystem::flushSemiReliable(const LLHost &host, void (*callback)(void **,S32), void ** callback_data)
{
- F32 timeout;
+ F32Seconds timeout;
LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
if (cdp)
{
timeout = llmax(LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS,
- LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged());
+ F32Seconds(LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged()));
}
else
{
@@ -1147,7 +1144,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n
// explicitly sent as reliable, so they don't have a callback
// LL_WARNS("Messaging") << "LLMessageSystem::sendMessage: Sending unreliable "
// << mMessageBuilder->getMessageName() << " message via HTTP"
-// << llendl;
+// << LL_ENDL;
return new LLFnPtrResponder(
NULL,
NULL,
@@ -1156,7 +1153,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n
}
// This can be called from signal handlers,
-// so should should not use llinfos.
+// so should should not use LL_INFOS().
S32 LLMessageSystem::sendMessage(const LLHost &host)
{
if (! mMessageBuilder->isBuilt())
@@ -1183,11 +1180,11 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
if(mVerboseLog)
{
LL_INFOS_ONCE("Messaging") << "MSG: -> " << host << "\tUNKNOWN CIRCUIT:\t"
- << mMessageBuilder->getMessageName() << llendl;
+ << mMessageBuilder->getMessageName() << LL_ENDL;
}
LL_WARNS_ONCE("Messaging") << "sendMessage - Trying to send "
<< mMessageBuilder->getMessageName() << " on unknown circuit "
- << host << llendl;
+ << host << LL_ENDL;
return 0;
}
else
@@ -1206,11 +1203,11 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
if(mVerboseLog)
{
LL_INFOS("Messaging") << "MSG: -> " << host << "\tDEAD CIRCUIT\t\t"
- << mMessageBuilder->getMessageName() << llendl;
+ << mMessageBuilder->getMessageName() << LL_ENDL;
}
LL_WARNS("Messaging") << "sendMessage - Trying to send message "
<< mMessageBuilder->getMessageName() << " to dead circuit "
- << host << llendl;
+ << host << LL_ENDL;
return 0;
}
}
@@ -1255,7 +1252,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
LL_WARNS("Messaging") << "sendMessage - Trying to send "
<< ((buffer_length > 4000) ? "EXTRA " : "")
<< "BIG message " << mMessageBuilder->getMessageName() << " - "
- << buffer_length << llendl;
+ << buffer_length << LL_ENDL;
}
}
if (mSendReliable)
@@ -1317,7 +1314,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
// append_acout_count is incorrect or that
// MAX_BUFFER_SIZE has fallen below MTU which is bad
// and probably programmer error.
- LL_ERRS("Messaging") << "Buffer packing failed due to size.." << llendl;
+ LL_ERRS("Messaging") << "Buffer packing failed due to size.." << LL_ENDL;
}
}
@@ -1340,7 +1337,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
else
{
// mCircuitInfo already points to the correct circuit data
- cdp->addBytesOut( buffer_length );
+ cdp->addBytesOut( (S32Bytes)buffer_length );
}
if(mVerboseLog)
@@ -1358,7 +1355,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
std::ostream_iterator<TPACKETID> append(str, " ");
std::copy(acks.begin(), acks.end(), append);
}
- LL_INFOS("Messaging") << str.str() << llendl;
+ LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
@@ -1382,7 +1379,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re
<< nullToEmpty(mMessageReader->getMessageName())
<< (recv_reliable ? " reliable" : "")
<< " REJECTED";
- LL_INFOS("Messaging") << str.str() << llendl;
+ LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
// nope!
// cout << "Rejecting unexpected message " << mCurrentMessageTemplate->mName << " from " << hex << ip << " , " << dec << port << endl;
@@ -1390,7 +1387,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re
// Keep track of rejected messages as well
if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
{
- LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
+ LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << LL_ENDL;
}
else
{
@@ -1409,7 +1406,7 @@ S32 LLMessageSystem::sendMessage(
{
if (!(host.isOk()))
{
- LL_WARNS("Messaging") << "trying to send message to invalid host" << llendl;
+ LL_WARNS("Messaging") << "trying to send message to invalid host" << LL_ENDL;
return 0;
}
@@ -1427,14 +1424,14 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host )
LL_WARNS("Messaging") << "Received trusted message on untrusted circuit. "
<< "Will reply with deny. "
<< "Message: " << nullToEmpty(mMessageReader->getMessageName())
- << " Host: " << host << llendl;
+ << " Host: " << host << LL_ENDL;
}
if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
{
LL_WARNS("Messaging") << "got more than " << MAX_MESSAGE_COUNT_NUM
<< " packets without clearing counts"
- << llendl;
+ << LL_ENDL;
}
else
{
@@ -1452,7 +1449,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
{
if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
{
- LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
+ LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << LL_ENDL;
}
else
{
@@ -1467,7 +1464,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
{
// update circuit packet ID tracking (missing/out of order packets)
cdp->checkPacketInID( mCurrentRecvPacketID, recv_resent );
- cdp->addBytesIn( mTrueReceiveSize );
+ cdp->addBytesIn( (S32Bytes)mTrueReceiveSize );
}
if(mVerboseLog)
@@ -1481,7 +1478,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
<< (recv_reliable ? " reliable" : "")
<< (recv_resent ? " resent" : "")
<< (recv_acks ? " acks" : "");
- LL_INFOS("Messaging") << str.str() << llendl;
+ LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
}
@@ -1491,54 +1488,54 @@ void LLMessageSystem::sanityCheck()
// if (!mCurrentRMessageData)
// {
-// LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << llendl;
+// LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << LL_ENDL;
// }
// if (!mCurrentRMessageTemplate)
// {
-// LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << llendl;
+// LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << LL_ENDL;
// }
// if (!mCurrentRTemplateBlock)
// {
-// LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << llendl;
+// LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << LL_ENDL;
// }
// if (!mCurrentRDataBlock)
// {
-// LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << llendl;
+// LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << LL_ENDL;
// }
// if (!mCurrentSMessageData)
// {
-// LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << llendl;
+// LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << LL_ENDL;
// }
// if (!mCurrentSMessageTemplate)
// {
-// LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << llendl;
+// LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << LL_ENDL;
// }
// if (!mCurrentSTemplateBlock)
// {
-// LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << llendl;
+// LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << LL_ENDL;
// }
// if (!mCurrentSDataBlock)
// {
-// LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << llendl;
+// LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << LL_ENDL;
// }
}
void LLMessageSystem::showCircuitInfo()
{
- LL_INFOS("Messaging") << mCircuitInfo << llendl;
+ LL_INFOS("Messaging") << mCircuitInfo << LL_ENDL;
}
void LLMessageSystem::dumpCircuitInfo()
{
- lldebugst(LLERR_CIRCUIT_INFO) << mCircuitInfo << llendl;
+ LL_DEBUGS("Messaging") << mCircuitInfo << LL_ENDL;
}
/* virtual */
@@ -1582,7 +1579,7 @@ void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted)
void LLMessageSystem::disableCircuit(const LLHost &host)
{
- LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << llendl;
+ LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << LL_ENDL;
U32 code = gMessageSystem->findCircuitCode( host );
// Don't need to do this, as we're removing the circuit info anyway - djs 01/28/03
@@ -1595,7 +1592,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
code_session_map_t::iterator it = mCircuitCodes.find(code);
if(it != mCircuitCodes.end())
{
- LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << llendl;
+ LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << LL_ENDL;
//mCircuitCodes.removeData(code);
mCircuitCodes.erase(it);
}
@@ -1611,7 +1608,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
U32 old_port = (U32)(ip_port & (U64)0xFFFFFFFF);
U32 old_ip = (U32)(ip_port >> 32);
- LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << llendl;
+ LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << LL_ENDL;
gMessageSystem->mIPPortToCircuitCode.erase(ip_port);
}
mCircuitInfo.removeCircuitData(host);
@@ -1621,7 +1618,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
// Sigh, since we can open circuits which don't have circuit
// codes, it's possible for this to happen...
- LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << llendl;
+ LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << LL_ENDL;
}
}
@@ -1652,7 +1649,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit)
if (!host.isOk())
{
- LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << llendl;
+ LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << LL_ENDL;
return TRUE;
}
@@ -1663,7 +1660,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit)
}
else
{
- LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << llendl;
+ LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << LL_ENDL;
return FALSE;
}
}
@@ -1674,7 +1671,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit)
if (!host.isOk())
{
- LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << llendl;
+ LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << LL_ENDL;
return FALSE;
}
@@ -1685,7 +1682,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit)
}
else
{
- LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << llendl;
+ LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << LL_ENDL;
return FALSE;
}
}
@@ -1699,7 +1696,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host)
}
else
{
- LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << llendl;
+ LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << LL_ENDL;
return FALSE;
}
}
@@ -1734,7 +1731,7 @@ LLHost LLMessageSystem::findHost(const U32 circuit_code)
void LLMessageSystem::setMaxMessageTime(const F32 seconds)
{
- mMaxMessageTime = seconds;
+ mMaxMessageTime = F32Seconds(seconds);
}
void LLMessageSystem::setMaxMessageCounts(const S32 num)
@@ -1851,18 +1848,18 @@ void LLMessageSystem::processAssignCircuitCode(LLMessageSystem* msg, void**)
{
LL_WARNS("Messaging") << "AssignCircuitCode, bad session id. Expecting "
<< msg->getMySessionID() << " but got " << session_id
- << llendl;
+ << LL_ENDL;
return;
}
U32 code;
msg->getU32Fast(_PREHASH_CircuitCode, _PREHASH_Code, code);
if (!code)
{
- LL_ERRS("Messaging") << "Assigning circuit code of zero!" << llendl;
+ LL_ERRS("Messaging") << "Assigning circuit code of zero!" << LL_ENDL;
}
msg->mOurCircuitCode = code;
- LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << llendl;
+ LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << LL_ENDL;
}
*/
@@ -1886,20 +1883,20 @@ bool LLMessageSystem::addCircuitCode(U32 code, const LLUUID& session_id)
{
if(!code)
{
- LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << llendl;
+ LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << LL_ENDL;
return false;
}
code_session_map_t::iterator it = mCircuitCodes.find(code);
if(it == mCircuitCodes.end())
{
- LL_INFOS("Messaging") << "New circuit code " << code << " added" << llendl;
+ LL_INFOS("Messaging") << "New circuit code " << code << " added" << LL_ENDL;
//msg->mCircuitCodes[circuit_code] = circuit_code;
mCircuitCodes.insert(code_session_map_t::value_type(code, session_id));
}
else
{
- LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << llendl;
+ LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << LL_ENDL;
}
return true;
}
@@ -1933,7 +1930,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
// Whoah, abort! We don't know anything about this circuit code.
LL_WARNS("Messaging") << "UseCircuitCode for " << circuit_code_in
<< " received without AddCircuitCode message - aborting"
- << llendl;
+ << LL_ENDL;
return;
}
@@ -1945,7 +1942,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
{
LL_WARNS("Messaging") << "UseCircuitCode unmatched session id. Got "
<< session_id << " but expected " << (*it).second
- << llendl;
+ << LL_ENDL;
return;
}
@@ -1958,7 +1955,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
if ((ip_port_old == ip_port_in) && (circuit_code_old == circuit_code_in))
{
// Current information is the same as incoming info, ignore
- LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << llendl;
+ LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << LL_ENDL;
return;
}
@@ -1968,27 +1965,27 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
msg->mIPPortToCircuitCode.erase(ip_port_old);
U32 old_port = (U32)(ip_port_old & (U64)0xFFFFFFFF);
U32 old_ip = (U32)(ip_port_old >> 32);
- LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << llendl;
+ LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << LL_ENDL;
}
if (circuit_code_old)
{
LLHost cur_host(ip, port);
- LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << llendl;
+ LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << LL_ENDL;
msg->disableCircuit(cur_host);
if (circuit_code_old == circuit_code_in)
{
- LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << llendl;
- LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << llendl;
- LL_WARNS("Messaging") << "Permanently disabling circuit" << llendl;
+ LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << LL_ENDL;
+ LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << LL_ENDL;
+ LL_WARNS("Messaging") << "Permanently disabling circuit" << LL_ENDL;
return;
}
else
{
LL_WARNS("Messaging") << "Circuit code changed for " << msg->getSender()
<< " from " << circuit_code_old << " to "
- << circuit_code_in << llendl;
+ << circuit_code_in << LL_ENDL;
}
}
@@ -2030,7 +2027,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
LL_INFOS("Messaging") << "Circuit code " << circuit_code_in << " from "
<< msg->getSender() << " for agent " << id << " in session "
- << session_id << llendl;
+ << session_id << LL_ENDL;
const LLUseCircuitCodeResponder* responder =
(const LLUseCircuitCodeResponder*) user;
@@ -2041,7 +2038,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
}
else
{
- LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << llendl;
+ LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << LL_ENDL;
}
}
@@ -2063,7 +2060,7 @@ void LLMessageSystem::processError(LLMessageSystem* msg, void**)
LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - "
<< error_code << " " << error_token << " " << error_id << " \""
- << error_system << "\" \"" << error_message << "\"" << llendl;
+ << error_system << "\" \"" << error_message << "\"" << LL_ENDL;
}
@@ -2099,7 +2096,7 @@ void LLMessageSystem::dispatch(
gMessageSystem->mMessageTemplates.end()) &&
!LLMessageConfig::isValidMessage(msg_name))
{
- LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << llendl;
+ LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << LL_ENDL;
responsep->notFound("Invalid message name");
return;
}
@@ -2110,12 +2107,12 @@ void LLMessageSystem::dispatch(
if (!handler)
{
LL_WARNS("Messaging") << "LLMessageService::dispatch > no handler for "
- << path << llendl;
+ << path << LL_ENDL;
return;
}
// enable this for output of message names
- //LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << llendl;
- //lldebugs << "data: " << LLSDNotationStreamer(message) << llendl;
+ //LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << LL_ENDL;
+ //LL_DEBUGS() << "data: " << LLSDNotationStreamer(message) << LL_ENDL;
handler->post(responsep, context, message);
}
@@ -2233,7 +2230,7 @@ S32 LLMessageSystem::sendError(
else
{
LL_WARNS("Messaging") << "Data and message were too large -- data removed."
- << llendl;
+ << LL_ENDL;
addBinaryData("Data", NULL, 0);
}
return sendReliable(host);
@@ -2253,7 +2250,7 @@ void process_packet_ack(LLMessageSystem *msgsystem, void** /*user_data*/)
for (S32 i = 0; i < ack_count; i++)
{
msgsystem->getU32Fast(_PREHASH_Packets, _PREHASH_ID, packet_id, i);
-// LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << llendl;
+// LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << LL_ENDL;
cdp->ackReliablePacket(packet_id);
}
if (!cdp->getUnackedPacketCount())
@@ -2274,12 +2271,12 @@ void process_log_messages(LLMessageSystem* msg, void**)
if (log_message)
{
- LL_INFOS("Messaging") << "Starting logging via message" << llendl;
+ LL_INFOS("Messaging") << "Starting logging via message" << LL_ENDL;
msg->startLogging();
}
else
{
- LL_INFOS("Messaging") << "Stopping logging via message" << llendl;
+ LL_INFOS("Messaging") << "Stopping logging via message" << LL_ENDL;
msg->stopLogging();
}
}*/
@@ -2299,7 +2296,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
if (!cdp)
{
LL_WARNS("Messaging") << "Attempt to create trusted circuit without circuit data: "
- << msg->getSender() << llendl;
+ << msg->getSender() << LL_ENDL;
return;
}
@@ -2318,13 +2315,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
if( msg->getBlockUntrustedInterface() )
{
LL_WARNS("Messaging") << "Ignoring CreateTrustedCircuit on public interface from host: "
- << msg->getSender() << llendl;
+ << msg->getSender() << LL_ENDL;
return;
}
else
{
LL_WARNS("Messaging") << "Processing CreateTrustedCircuit on public interface from host: "
- << msg->getSender() << llendl;
+ << msg->getSender() << LL_ENDL;
}
}
@@ -2340,7 +2337,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
if(msg->isMatchingDigestForWindowAndUUIDs(their_digest, TRUST_TIME_WINDOW, local_id, remote_id))
{
cdp->setTrusted(TRUE);
- LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << llendl;
+ LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << LL_ENDL;
return;
}
else if (cdp->getTrusted())
@@ -2350,13 +2347,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
// the message system is being slow. Don't bother sending the deny, as it may continually
// ping-pong back and forth on a very hosed circuit.
LL_WARNS("Messaging") << "Ignoring bad digest from known trusted circuit: " << their_digest
- << " host: " << msg->getSender() << llendl;
+ << " host: " << msg->getSender() << LL_ENDL;
return;
}
else
{
LL_WARNS("Messaging") << "Bad digest from known circuit: " << their_digest
- << " host: " << msg->getSender() << llendl;
+ << " host: " << msg->getSender() << LL_ENDL;
msg->sendDenyTrustedCircuit(msg->getSender());
return;
}
@@ -2392,13 +2389,13 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **)
if( msg->getBlockUntrustedInterface() )
{
LL_WARNS("Messaging") << "Ignoring DenyTrustedCircuit on public interface from host: "
- << msg->getSender() << llendl;
+ << msg->getSender() << LL_ENDL;
return;
}
else
{
LL_WARNS("Messaging") << "Processing DenyTrustedCircuit on public interface from host: "
- << msg->getSender() << llendl;
+ << msg->getSender() << LL_ENDL;
}
}
@@ -2411,7 +2408,7 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **)
// *TODO: probably should keep a count of number of resends
// per circuit, and stop resending after a while.
LL_INFOS("Messaging") << "Got DenyTrustedCircuit. Sending CreateTrustedCircuit to "
- << msg->getSender() << llendl;
+ << msg->getSender() << LL_ENDL;
msg->sendCreateTrustedCircuit(msg->getSender(), local_id, remote_id);
}
@@ -2527,11 +2524,11 @@ bool start_messaging_system(
if (gMessageSystem->mMessageFileVersionNumber != gPrehashVersionNumber)
{
LL_INFOS("AppInit") << "Message template version does not match prehash version number" << LL_ENDL;
- LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << llendl;
+ LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << LL_ENDL;
}
else
{
- LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << llendl;
+ LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << LL_ENDL;
}
}
@@ -2577,7 +2574,7 @@ void LLMessageSystem::startLogging()
str << "\t<-\tincoming message" <<std::endl;
str << "\t->\toutgoing message" << std::endl;
str << " <> host size zero id name";
- LL_INFOS("Messaging") << str.str() << llendl;
+ LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
void LLMessageSystem::stopLogging()
@@ -2585,7 +2582,7 @@ void LLMessageSystem::stopLogging()
if(mVerboseLog)
{
mVerboseLog = FALSE;
- LL_INFOS("Messaging") << "END MESSAGE LOG" << llendl;
+ LL_INFOS("Messaging") << "END MESSAGE LOG" << LL_ENDL;
}
}
@@ -2693,7 +2690,7 @@ void end_messaging_system(bool print_summary)
{
std::ostringstream str;
gMessageSystem->summarizeLogs(str);
- LL_INFOS("Messaging") << str.str().c_str() << llendl;
+ LL_INFOS("Messaging") << str.str().c_str() << LL_ENDL;
}
delete gMessageSystem;
@@ -2746,7 +2743,7 @@ void LLMessageSystem::dumpReceiveCounts()
if(mNumMessageCounts > 0)
{
- LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << llendl;
+ LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << LL_ENDL;
for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(),
end = mMessageTemplates.end();
iter != end; iter++)
@@ -2755,7 +2752,7 @@ void LLMessageSystem::dumpReceiveCounts()
if (mt->mReceiveCount > 0)
{
LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes
- << " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl;
+ << " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime.value()) << "%" << LL_ENDL;
}
}
}
@@ -2872,7 +2869,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
if ((*data_size ) < LL_MINIMUM_VALID_PACKET_SIZE)
{
LL_WARNS("Messaging") << "zeroCodeExpand() called with data_size of " << *data_size
- << llendl;
+ << LL_ENDL;
}
mTotalBytesIn += *data_size;
@@ -2911,7 +2908,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
{
if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-1]))
{
- LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << llendl;
+ LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << LL_ENDL;
callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
outptr = mEncodedRecvBuffer;
break;
@@ -2923,7 +2920,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
*outptr++ = *inptr++;
if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-256]))
{
- LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << llendl;
+ LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << LL_ENDL;
callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
outptr = mEncodedRecvBuffer;
count = -1;
@@ -2942,7 +2939,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
{
if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-(*inptr)]))
{
- LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << llendl;
+ LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << LL_ENDL;
callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
outptr = mEncodedRecvBuffer;
}
@@ -2966,7 +2963,7 @@ void LLMessageSystem::addTemplate(LLMessageTemplate *templatep)
if (mMessageTemplates.count(templatep->mName) > 0)
{
LL_ERRS("Messaging") << templatep->mName << " already used as a template name!"
- << llendl;
+ << LL_ENDL;
}
mMessageTemplates[templatep->mName] = templatep;
mMessageNumbers[templatep->mMessageNumber] = templatep;
@@ -2982,7 +2979,7 @@ void LLMessageSystem::setHandlerFuncFast(const char *name, void (*handler_func)(
}
else
{
- LL_ERRS("Messaging") << name << " is not a known message name!" << llendl;
+ LL_ERRS("Messaging") << name << " is not a known message name!" << LL_ENDL;
}
}
@@ -2995,7 +2992,7 @@ bool LLMessageSystem::callHandler(const char *name,
if(iter == mMessageTemplates.end())
{
LL_WARNS("Messaging") << "LLMessageSystem::callHandler: unknown message "
- << name << llendl;
+ << name << LL_ENDL;
return false;
}
@@ -3006,7 +3003,7 @@ bool LLMessageSystem::callHandler(const char *name,
<< name
<< " from "
<< (trustedSource ? "trusted " : "untrusted ")
- << "source" << llendl;
+ << "source" << LL_ENDL;
return false;
}
@@ -3042,7 +3039,7 @@ BOOL LLMessageSystem::callExceptionFunc(EMessageException exception)
if (!ex_cb)
{
- LL_WARNS("Messaging") << "LLMessageSystem::callExceptionFunc: bad message exception callback." << llendl;
+ LL_WARNS("Messaging") << "LLMessageSystem::callExceptionFunc: bad message exception callback." << LL_ENDL;
return FALSE;
}
@@ -3153,7 +3150,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
- LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
+ LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << LL_ENDL;
}
U32 now = (U32)time(NULL);
@@ -3172,7 +3169,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
- LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << llendl;
+ LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << LL_ENDL;
}
char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
@@ -3219,7 +3216,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
- LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
+ LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << LL_ENDL;
}
U32 now = (U32)time(NULL);
@@ -3238,7 +3235,7 @@ bool LLMessageSystem::isMatchingDigestForWindow(const char* digest, S32 const wi
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
- LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << llendl;
+ LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << LL_ENDL;
}
char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
@@ -3272,12 +3269,12 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID
char digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
if (id1.isNull())
{
- LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << llendl;
+ LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << LL_ENDL;
return;
}
if (id2.isNull())
{
- LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << llendl;
+ LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << LL_ENDL;
return;
}
generateDigestForWindowAndUUIDs(digest, TRUST_TIME_WINDOW, id1, id2);
@@ -3285,7 +3282,7 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID
nextBlockFast(_PREHASH_DataBlock);
addUUIDFast(_PREHASH_EndPointID, id1);
addBinaryDataFast(_PREHASH_Digest, digest, MD5HEX_STR_BYTES);
- LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << llendl;
+ LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << LL_ENDL;
sendMessage(host);
}
@@ -3299,10 +3296,10 @@ void LLMessageSystem::reallySendDenyTrustedCircuit(const LLHost &host)
LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
if (!cdp)
{
- LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << llendl;
+ LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << LL_ENDL;
return;
}
- LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << llendl;
+ LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << LL_ENDL;
newMessageFast(_PREHASH_DenyTrustedCircuit);
nextBlockFast(_PREHASH_DataBlock);
addUUIDFast(_PREHASH_EndPointID, cdp->getLocalEndPointID());
@@ -3323,7 +3320,7 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
- LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << llendl;
+ LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << LL_ENDL;
}
LLTimer timeout;
@@ -3375,8 +3372,8 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_
void LLMessageSystem::dumpPacketToLog()
{
- LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << llendl;
- LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << llendl;
+ LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << LL_ENDL;
+ LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << LL_ENDL;
char line_buffer[256]; /* Flawfinder: ignore */
S32 i;
S32 cur_line_pos = 0;
@@ -3391,27 +3388,27 @@ void LLMessageSystem::dumpPacketToLog()
if (cur_line_pos >= 16)
{
cur_line_pos = 0;
- LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl;
+ LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << LL_ENDL;
cur_line++;
}
}
if (cur_line_pos)
{
- LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl;
+ LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << LL_ENDL;
}
}
//static
-U64 LLMessageSystem::getMessageTimeUsecs(const BOOL update)
+U64Microseconds LLMessageSystem::getMessageTimeUsecs(const BOOL update)
{
if (gMessageSystem)
{
if (update)
{
- gMessageSystem->mCurrentMessageTimeSeconds = totalTime()*SEC_PER_USEC;
+ gMessageSystem->mCurrentMessageTime = totalTime();
}
- return (U64)(gMessageSystem->mCurrentMessageTimeSeconds * USEC_PER_SEC);
+ return gMessageSystem->mCurrentMessageTime;
}
else
{
@@ -3420,19 +3417,19 @@ U64 LLMessageSystem::getMessageTimeUsecs(const BOOL update)
}
//static
-F64 LLMessageSystem::getMessageTimeSeconds(const BOOL update)
+F64Seconds LLMessageSystem::getMessageTimeSeconds(const BOOL update)
{
if (gMessageSystem)
{
if (update)
{
- gMessageSystem->mCurrentMessageTimeSeconds = totalTime()*SEC_PER_USEC;
+ gMessageSystem->mCurrentMessageTime = totalTime();
}
- return gMessageSystem->mCurrentMessageTimeSeconds;
+ return gMessageSystem->mCurrentMessageTime;
}
else
{
- return totalTime()*SEC_PER_USEC;
+ return F64Seconds(totalTime());
}
}
@@ -3941,7 +3938,7 @@ void LLMessageSystem::getStringFast(const char *block, const char *var,
{
if(buffer_size <= 0)
{
- LL_WARNS("Messaging") << "buffer_size <= 0" << llendl;
+ LL_WARNS("Messaging") << "buffer_size <= 0" << LL_ENDL;
}
mMessageReader->getString(block, var, buffer_size, s, blocknum);
}
@@ -4050,7 +4047,7 @@ void LLMessageSystem::banUdpMessage(const std::string& name)
}
else
{
- llwarns << "Attempted to ban an unknown message: " << name << "." << llendl;
+ LL_WARNS() << "Attempted to ban an unknown message: " << name << "." << LL_ENDL;
}
}
const LLHost& LLMessageSystem::getSender() const
diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h
index 1589ea29c1..da06b64506 100755
--- a/indra/llmessage/message.h
+++ b/indra/llmessage/message.h
@@ -45,14 +45,14 @@
#include "llerror.h"
#include "net.h"
-#include "string_table.h"
+#include "llstringtable.h"
#include "llcircuit.h"
#include "lltimer.h"
#include "llpacketring.h"
#include "llhost.h"
-#include "llhttpclient.h"
+#include "llcurl.h"
#include "llhttpnode.h"
-#include "llpacketack.h"
+//#include "llpacketack.h"
#include "llsingleton.h"
#include "message_prehash.h"
#include "llstl.h"
@@ -142,23 +142,18 @@ enum EPacketHeaderLayout
const S32 LL_DEFAULT_RELIABLE_RETRIES = 3;
-const F32 LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS = 1.f;
-const F32 LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS = 1.f;
-const F32 LL_PING_BASED_TIMEOUT_DUMMY = 0.0f;
-
-// *NOTE: Maybe these factors shouldn't include the msec to sec conversion
-// implicitly.
-// However, all units should be MKS.
-const F32 LL_SEMIRELIABLE_TIMEOUT_FACTOR = 5.f / 1000.f; // factor * averaged ping
-const F32 LL_RELIABLE_TIMEOUT_FACTOR = 5.f / 1000.f; // factor * averaged ping
-const F32 LL_FILE_XFER_TIMEOUT_FACTOR = 5.f / 1000.f; // factor * averaged ping
-const F32 LL_LOST_TIMEOUT_FACTOR = 16.f / 1000.f; // factor * averaged ping for marking packets "Lost"
-const F32 LL_MAX_LOST_TIMEOUT = 5.f; // Maximum amount of time before considering something "lost"
+const F32Seconds LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS(1.f);
+const F32Seconds LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS(1.f);
+const F32Seconds LL_PING_BASED_TIMEOUT_DUMMY(0.0f);
+
+const F32 LL_SEMIRELIABLE_TIMEOUT_FACTOR = 5.f; // averaged ping
+const F32 LL_RELIABLE_TIMEOUT_FACTOR = 5.f; // averaged ping
+const F32 LL_LOST_TIMEOUT_FACTOR = 16.f; // averaged ping for marking packets "Lost"
+const F32Seconds LL_MAX_LOST_TIMEOUT(5.f); // Maximum amount of time before considering something "lost"
const S32 MAX_MESSAGE_COUNT_NUM = 1024;
// Forward declarations
-class LLCircuit;
class LLVector3;
class LLVector4;
class LLVector3d;
@@ -214,19 +209,19 @@ class LLMessageSystem : public LLMessageSenderInterface
public:
LLPacketRing mPacketRing;
- LLReliablePacketParams mReliablePacketParams;
+ LLReliablePacketParams mReliablePacketParams;
// Set this flag to TRUE when you want *very* verbose logs.
- BOOL mVerboseLog;
+ BOOL mVerboseLog;
- F32 mMessageFileVersionNumber;
+ F32 mMessageFileVersionNumber;
typedef std::map<const char *, LLMessageTemplate*> message_template_name_map_t;
typedef std::map<U32, LLMessageTemplate*> message_template_number_map_t;
private:
message_template_name_map_t mMessageTemplates;
- message_template_number_map_t mMessageNumbers;
+ message_template_number_map_t mMessageNumbers;
public:
S32 mSystemVersionMajor;
@@ -235,7 +230,7 @@ public:
S32 mSystemVersionServer;
U32 mVersionFlags;
- BOOL mbProtected;
+ BOOL mbProtected;
U32 mNumberHighFreqMessages;
U32 mNumberMediumFreqMessages;
@@ -255,11 +250,11 @@ public:
U32 mReliablePacketsIn; // total reliable packets in
U32 mReliablePacketsOut; // total reliable packets out
- U32 mDroppedPackets; // total dropped packets in
- U32 mResentPackets; // total resent packets out
- U32 mFailedResendPackets; // total resend failure packets out
- U32 mOffCircuitPackets; // total # of off-circuit packets rejected
- U32 mInvalidOnCircuitPackets; // total # of on-circuit but invalid packets rejected
+ U32 mDroppedPackets; // total dropped packets in
+ U32 mResentPackets; // total resent packets out
+ U32 mFailedResendPackets; // total resend failure packets out
+ U32 mOffCircuitPackets; // total # of off-circuit packets rejected
+ U32 mInvalidOnCircuitPackets; // total # of on-circuit but invalid packets rejected
S64 mUncompressedBytesIn; // total uncompressed size of compressed packets in
S64 mUncompressedBytesOut; // total uncompressed size of compressed packets out
@@ -268,14 +263,14 @@ public:
S64 mTotalBytesIn; // total size of all uncompressed packets in
S64 mTotalBytesOut; // total size of all uncompressed packets out
- BOOL mSendReliable; // does the outgoing message require a pos ack?
+ BOOL mSendReliable; // does the outgoing message require a pos ack?
- LLCircuit mCircuitInfo;
- F64 mCircuitPrintTime; // used to print circuit debug info every couple minutes
- F32 mCircuitPrintFreq; // seconds
+ LLCircuit mCircuitInfo;
+ F64Seconds mCircuitPrintTime; // used to print circuit debug info every couple minutes
+ F32Seconds mCircuitPrintFreq;
- std::map<U64, U32> mIPPortToCircuitCode;
- std::map<U32, U64> mCircuitCodeToIPPort;
+ std::map<U64, U32> mIPPortToCircuitCode;
+ std::map<U32, U64> mCircuitCodeToIPPort;
U32 mOurCircuitCode;
S32 mSendPacketFailureCount;
S32 mUnackedListDepth;
@@ -470,7 +465,7 @@ public:
S32 sendReliable( const LLHost &host,
S32 retries,
BOOL ping_based_retries,
- F32 timeout,
+ F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data);
@@ -490,11 +485,11 @@ public:
const LLHost &host,
S32 retries,
BOOL ping_based_timeout,
- F32 timeout,
+ F32Seconds timeout,
void (*callback)(void **,S32),
void ** callback_data);
- LLHTTPClient::ResponderPtr createResponder(const std::string& name);
+ LLCurl::ResponderPtr createResponder(const std::string& name);
S32 sendMessage(const LLHost &host);
S32 sendMessage(const U32 circuit);
private:
@@ -657,8 +652,8 @@ public:
S32 getSize(const char *blockname, S32 blocknum, const char *varname) const;
void resetReceiveCounts(); // resets receive counts for all message types to 0
- void dumpReceiveCounts(); // dumps receive count for each message type to llinfos
- void dumpCircuitInfo(); // Circuit information to llinfos
+ void dumpReceiveCounts(); // dumps receive count for each message type to LL_INFOS()
+ void dumpCircuitInfo(); // Circuit information to LL_INFOS()
BOOL isClear() const; // returns mbSClear;
S32 flush(const LLHost &host);
@@ -684,8 +679,8 @@ public:
void setMaxMessageTime(const F32 seconds); // Max time to process messages before warning and dumping (neg to disable)
void setMaxMessageCounts(const S32 num); // Max number of messages before dumping (neg to disable)
- static U64 getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds
- static F64 getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds
+ static U64Microseconds getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds
+ static F64Seconds getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds
static void setTimeDecodes(BOOL b);
static void setTimeDecodesSpamThreshold(F32 seconds);
@@ -784,16 +779,16 @@ private:
BOOL mbError;
S32 mErrorCode;
- F64 mResendDumpTime; // The last time we dumped resends
+ F64Seconds mResendDumpTime; // The last time we dumped resends
LLMessageCountInfo mMessageCountList[MAX_MESSAGE_COUNT_NUM];
S32 mNumMessageCounts;
- F32 mReceiveTime;
- F32 mMaxMessageTime; // Max number of seconds for processing messages
+ F32Seconds mReceiveTime;
+ F32Seconds mMaxMessageTime; // Max number of seconds for processing messages
S32 mMaxMessageCounts; // Max number of messages to process before dumping.
- F64 mMessageCountTime;
+ F64Seconds mMessageCountTime;
- F64 mCurrentMessageTimeSeconds; // The current "message system time" (updated the first call to checkMessages after a resetReceiveCount
+ F64Seconds mCurrentMessageTime; // The current "message system time" (updated the first call to checkMessages after a resetReceiveCount
// message system exceptions
typedef std::pair<msg_exception_callback, void*> exception_t;
@@ -888,7 +883,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type,
case MVT_S16:
if (n != 2)
{
- llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl;
+ LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL;
}
#ifdef LL_BIG_ENDIAN
*(s + 1) = *(ct);
@@ -903,7 +898,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type,
case MVT_F32:
if (n != 4)
{
- llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl;
+ LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL;
}
#ifdef LL_BIG_ENDIAN
*(s + 3) = *(ct);
@@ -920,7 +915,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type,
case MVT_F64:
if (n != 8)
{
- llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl;
+ LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL;
}
#ifdef LL_BIG_ENDIAN
*(s + 7) = *(ct);
@@ -940,7 +935,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type,
case MVT_LLQuaternion: // We only send x, y, z and infer w (we set x, y, z to ensure that w >= 0)
if (n != 12)
{
- llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl;
+ LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL;
}
#ifdef LL_BIG_ENDIAN
htonmemcpy(s + 8, ct + 8, MVT_F32, 4);
@@ -953,7 +948,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type,
case MVT_LLVector3d:
if (n != 24)
{
- llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl;
+ LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL;
}
#ifdef LL_BIG_ENDIAN
htonmemcpy(s + 16, ct + 16, MVT_F64, 8);
@@ -966,7 +961,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type,
case MVT_LLVector4:
if (n != 16)
{
- llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl;
+ LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL;
}
#ifdef LL_BIG_ENDIAN
htonmemcpy(s + 12, ct + 12, MVT_F32, 4);
@@ -980,7 +975,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type,
case MVT_U16Vec3:
if (n != 6)
{
- llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl;
+ LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL;
}
#ifdef LL_BIG_ENDIAN
htonmemcpy(s + 4, ct + 4, MVT_U16, 2);
@@ -993,7 +988,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type,
case MVT_U16Quat:
if (n != 8)
{
- llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl;
+ LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL;
}
#ifdef LL_BIG_ENDIAN
htonmemcpy(s + 6, ct + 6, MVT_U16, 2);
@@ -1007,7 +1002,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type,
case MVT_S16Array:
if (n % 2)
{
- llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl;
+ LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL;
}
#ifdef LL_BIG_ENDIAN
length = n % 2;
diff --git a/indra/llmessage/message_string_table.cpp b/indra/llmessage/message_string_table.cpp
index dd063fcb83..e4f5fb3a38 100755
--- a/indra/llmessage/message_string_table.cpp
+++ b/indra/llmessage/message_string_table.cpp
@@ -80,10 +80,10 @@ char* LLMessageStringTable::getString(const char *str)
if (mUsed >= MESSAGE_NUMBER_OF_HASH_BUCKETS - 1)
{
U32 i;
- llinfos << "Dumping string table before crashing on HashTable full!" << llendl;
+ LL_INFOS() << "Dumping string table before crashing on HashTable full!" << LL_ENDL;
for (i = 0; i < MESSAGE_NUMBER_OF_HASH_BUCKETS; i++)
{
- llinfos << "Entry #" << i << ": " << mString[i] << llendl;
+ LL_INFOS() << "Entry #" << i << ": " << mString[i] << LL_ENDL;
}
}
return mString[hash_value];
diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp
index 85aef5da00..523bcbb60d 100755
--- a/indra/llmessage/net.cpp
+++ b/indra/llmessage/net.cpp
@@ -26,15 +26,13 @@
#include "linden_common.h"
-#include "net.h"
+//#include "net.h"
// system library includes
#include <stdexcept>
#if LL_WINDOWS
- #define WIN32_LEAN_AND_MEAN
- #include <winsock2.h>
- #include <windows.h>
+#include "llwin32headerslean.h"
#else
#include <sys/types.h>
#include <sys/socket.h>
@@ -175,7 +173,7 @@ U32 ip_string_to_u32(const char* ip_string)
if (ip == INADDR_NONE
&& strncmp(ip_string, BROADCAST_ADDRESS_STRING, MAXADDRSTR) != 0)
{
- llwarns << "ip_string_to_u32() failed, Error: Invalid IP string '" << ip_string << "'" << llendl;
+ LL_WARNS() << "ip_string_to_u32() failed, Error: Invalid IP string '" << ip_string << "'" << LL_ENDL;
return INVALID_HOST_IP_ADDRESS;
}
return ip;
@@ -334,7 +332,7 @@ S32 receive_packet(int hSocket, char * receiveBuffer)
return 0;
if (WSAECONNRESET == WSAGetLastError())
return 0;
- llinfos << "receivePacket() failed, Error: " << WSAGetLastError() << llendl;
+ LL_INFOS() << "receivePacket() failed, Error: " << WSAGetLastError() << LL_ENDL;
}
return nRet;
@@ -368,8 +366,8 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i
{
return TRUE;
}
- llinfos << "sendto() failed to " << u32_to_ip_string(recipient) << ":" << nPort
- << ", Error " << last_error << llendl;
+ LL_INFOS() << "sendto() failed to " << u32_to_ip_string(recipient) << ":" << nPort
+ << ", Error " << last_error << LL_ENDL;
}
}
} while ( (nRet == SOCKET_ERROR)
@@ -397,7 +395,7 @@ S32 start_net(S32& socket_out, int& nPort)
hSocket = socket(AF_INET, SOCK_DGRAM, 0);
if (hSocket < 0)
{
- llwarns << "socket() failed" << llendl;
+ LL_WARNS() << "socket() failed" << LL_ENDL;
return 1;
}
@@ -408,21 +406,21 @@ S32 start_net(S32& socket_out, int& nPort)
stLclAddr.sin_family = AF_INET;
stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY);
stLclAddr.sin_port = htons(0);
- llinfos << "attempting to connect on OS assigned port" << llendl;
+ LL_INFOS() << "attempting to connect on OS assigned port" << LL_ENDL;
nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr));
if (nRet < 0)
{
- llwarns << "Failed to bind on an OS assigned port error: "
- << nRet << llendl;
+ LL_WARNS() << "Failed to bind on an OS assigned port error: "
+ << nRet << LL_ENDL;
}
else
{
sockaddr_in socket_info;
socklen_t len = sizeof(sockaddr_in);
int err = getsockname(hSocket, (sockaddr*)&socket_info, &len);
- llinfos << "Get socket returned: " << err << " length " << len << llendl;
+ LL_INFOS() << "Get socket returned: " << err << " length " << len << LL_ENDL;
nPort = ntohs(socket_info.sin_port);
- llinfos << "Assigned port: " << nPort << llendl;
+ LL_INFOS() << "Assigned port: " << nPort << LL_ENDL;
}
}
@@ -433,7 +431,7 @@ S32 start_net(S32& socket_out, int& nPort)
stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY);
stLclAddr.sin_port = htons(nPort);
U32 attempt_port = nPort;
- llinfos << "attempting to connect on port " << attempt_port << llendl;
+ LL_INFOS() << "attempting to connect on port " << attempt_port << LL_ENDL;
nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr));
if (nRet < 0)
@@ -447,7 +445,7 @@ S32 start_net(S32& socket_out, int& nPort)
attempt_port++)
{
stLclAddr.sin_port = htons(attempt_port);
- llinfos << "trying port " << attempt_port << llendl;
+ LL_INFOS() << "trying port " << attempt_port << LL_ENDL;
nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr));
if (!((nRet < 0) && (errno == EADDRINUSE)))
{
@@ -456,7 +454,7 @@ S32 start_net(S32& socket_out, int& nPort)
}
if (nRet < 0)
{
- llwarns << "startNet() : Couldn't find available network port." << llendl;
+ LL_WARNS() << "startNet() : Couldn't find available network port." << LL_ENDL;
// Fail gracefully in release.
return 3;
}
@@ -464,12 +462,12 @@ S32 start_net(S32& socket_out, int& nPort)
// Some other socket error
else
{
- llwarns << llformat ("bind() port: %d failed, Err: %s\n", nPort, strerror(errno)) << llendl;
+ LL_WARNS() << llformat ("bind() port: %d failed, Err: %s\n", nPort, strerror(errno)) << LL_ENDL;
// Fail gracefully in release.
return 4;
}
}
- llinfos << "connected on port " << attempt_port << llendl;
+ LL_INFOS() << "connected on port " << attempt_port << LL_ENDL;
nPort = attempt_port;
}
// Set socket to be non-blocking
@@ -478,18 +476,18 @@ S32 start_net(S32& socket_out, int& nPort)
nRet = setsockopt(hSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rec_size, buff_size);
if (nRet)
{
- llinfos << "Can't set receive size!" << llendl;
+ LL_INFOS() << "Can't set receive size!" << LL_ENDL;
}
nRet = setsockopt(hSocket, SOL_SOCKET, SO_SNDBUF, (char *)&snd_size, buff_size);
if (nRet)
{
- llinfos << "Can't set send size!" << llendl;
+ LL_INFOS() << "Can't set send size!" << LL_ENDL;
}
getsockopt(hSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rec_size, &buff_size);
getsockopt(hSocket, SOL_SOCKET, SO_SNDBUF, (char *)&snd_size, &buff_size);
- llinfos << "startNet - receive buffer size : " << rec_size << llendl;
- llinfos << "startNet - send buffer size : " << snd_size << llendl;
+ LL_INFOS() << "startNet - receive buffer size : " << rec_size << LL_ENDL;
+ LL_INFOS() << "startNet - send buffer size : " << snd_size << LL_ENDL;
#if LL_LINUX
// Turn on recipient address tracking
@@ -497,11 +495,11 @@ S32 start_net(S32& socket_out, int& nPort)
int use_pktinfo = 1;
if( setsockopt( hSocket, SOL_IP, IP_PKTINFO, &use_pktinfo, sizeof(use_pktinfo) ) == -1 )
{
- llwarns << "No IP_PKTINFO available" << llendl;
+ LL_WARNS() << "No IP_PKTINFO available" << LL_ENDL;
}
else
{
- llinfos << "IP_PKKTINFO enabled" << llendl;
+ LL_INFOS() << "IP_PKKTINFO enabled" << LL_ENDL;
}
}
#endif
@@ -595,7 +593,7 @@ int receive_packet(int hSocket, char * receiveBuffer)
}
// Uncomment for testing if/when implementing for Mac or Windows:
- // llinfos << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << llendl;
+ // LL_INFOS() << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << LL_ENDL;
return nRet;
}
@@ -629,22 +627,22 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient,
if (errno == EAGAIN)
{
// say nothing, just repeat send
- llinfos << "sendto() reported buffer full, resending (attempt " << send_attempts << ")" << llendl;
- llinfos << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << llendl;
+ LL_INFOS() << "sendto() reported buffer full, resending (attempt " << send_attempts << ")" << LL_ENDL;
+ LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL;
resend = TRUE;
}
else if (errno == ECONNREFUSED)
{
// response to ICMP connection refused message on earlier send
- llinfos << "sendto() reported connection refused, resending (attempt " << send_attempts << ")" << llendl;
- llinfos << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << llendl;
+ LL_INFOS() << "sendto() reported connection refused, resending (attempt " << send_attempts << ")" << LL_ENDL;
+ LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL;
resend = TRUE;
}
else
{
// some other error
- llinfos << "sendto() failed: " << errno << ", " << strerror(errno) << llendl;
- llinfos << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << llendl;
+ LL_INFOS() << "sendto() failed: " << errno << ", " << strerror(errno) << LL_ENDL;
+ LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL;
resend = FALSE;
}
}
@@ -653,7 +651,7 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient,
if (send_attempts >= 3)
{
- llinfos << "sendPacket() bailed out of send!" << llendl;
+ LL_INFOS() << "sendPacket() bailed out of send!" << LL_ENDL;
return FALSE;
}
diff --git a/indra/llmessage/net.h b/indra/llmessage/net.h
index 0f2437479d..beb67bae4e 100755
--- a/indra/llmessage/net.h
+++ b/indra/llmessage/net.h
@@ -67,5 +67,8 @@ const S32 ETHERNET_MTU_BYTES = 1500;
const S32 MTUBITS = MTUBYTES*8;
const S32 MTUU32S = MTUBITS/32;
+// For automatic port discovery when running multiple viewers on one host
+const U32 PORT_DISCOVERY_RANGE_MIN = 13000;
+const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50;
#endif
diff --git a/indra/llmessage/partsyspacket.cpp b/indra/llmessage/partsyspacket.cpp
index ad21614258..d87de38aa5 100755
--- a/indra/llmessage/partsyspacket.cpp
+++ b/indra/llmessage/partsyspacket.cpp
@@ -28,7 +28,7 @@
#include "linden_common.h"
#include "partsyspacket.h"
-#include "imageids.h"
+#include "indra_constants.h"
// this function is global
void gSetInitDataDefaults(LLPartInitData *setMe)
@@ -1272,7 +1272,7 @@ BOOL LLPartSysCompressedPacket::fromUnsignedBytes(U8 *in, U32 bytesUsed)
}
else
{
- llerrs << "NULL input data or number of bytes exceed mData size" << llendl;
+ LL_ERRS() << "NULL input data or number of bytes exceed mData size" << LL_ENDL;
return FALSE;
}
}
diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp
index e5d7f19448..32f8d80782 100755
--- a/indra/llmessage/patch_code.cpp
+++ b/indra/llmessage/patch_code.cpp
@@ -31,7 +31,7 @@
#include "v3math.h"
#include "patch_dct.h"
#include "patch_code.h"
-#include "bitpack.h"
+#include "llbitpack.h"
U32 gPatchSize, gWordBits;
@@ -88,7 +88,7 @@ void code_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, S32 *patch)
if ( (wbits > 17)
||(wbits < 2))
{
- llerrs << "Bits needed per word in code_patch_header out of legal range. Adjust compression quatization." << llendl;
+ LL_ERRS() << "Bits needed per word in code_patch_header out of legal range. Adjust compression quatization." << LL_ENDL;
}
ph->quant_wbits |= (wbits - 2);
@@ -135,7 +135,7 @@ void code_patch(LLBitPack &bitpack, S32 *patch, S32 postquant)
if ( (postquant > patch_size*patch_size)
||(postquant < 0))
{
- llerrs << "Bad postquant in code_patch!" << llendl;
+ LL_ERRS() << "Bad postquant in code_patch!" << LL_ENDL;
}
if (postquant)
diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp
index 60c91e12cf..c04696c86b 100755
--- a/indra/llmessage/tests/llareslistener_test.cpp
+++ b/indra/llmessage/tests/llareslistener_test.cpp
@@ -135,7 +135,7 @@ namespace tut
void object::test<2>()
{
set_test_name("bad op");
- WrapLL_ERRS capture;
+ WrapLLErrs capture;
LLSD request;
request["op"] = "foo";
std::string threw;
@@ -143,7 +143,7 @@ namespace tut
{
LLEventPumps::instance().obtain("LLAres").post(request);
}
- catch (const WrapLL_ERRS::FatalException& e)
+ catch (const WrapLLErrs::FatalException& e)
{
threw = e.what();
}
@@ -154,7 +154,7 @@ namespace tut
void object::test<3>()
{
set_test_name("bad rewriteURI request");
- WrapLL_ERRS capture;
+ WrapLLErrs capture;
LLSD request;
request["op"] = "rewriteURI";
std::string threw;
@@ -162,7 +162,7 @@ namespace tut
{
LLEventPumps::instance().obtain("LLAres").post(request);
}
- catch (const WrapLL_ERRS::FatalException& e)
+ catch (const WrapLLErrs::FatalException& e)
{
threw = e.what();
}
@@ -175,7 +175,7 @@ namespace tut
void object::test<4>()
{
set_test_name("bad rewriteURI request");
- WrapLL_ERRS capture;
+ WrapLLErrs capture;
LLSD request;
request["op"] = "rewriteURI";
request["reply"] = "nonexistent";
@@ -184,7 +184,7 @@ namespace tut
{
LLEventPumps::instance().obtain("LLAres").post(request);
}
- catch (const WrapLL_ERRS::FatalException& e)
+ catch (const WrapLLErrs::FatalException& e)
{
threw = e.what();
}
@@ -197,7 +197,7 @@ namespace tut
void object::test<5>()
{
set_test_name("bad rewriteURI request");
- WrapLL_ERRS capture;
+ WrapLLErrs capture;
LLSD request;
request["op"] = "rewriteURI";
request["uri"] = "foo.bar.com";
@@ -206,7 +206,7 @@ namespace tut
{
LLEventPumps::instance().obtain("LLAres").post(request);
}
- catch (const WrapLL_ERRS::FatalException& e)
+ catch (const WrapLLErrs::FatalException& e)
{
threw = e.what();
}
diff --git a/indra/llmessage/tests/llcurl_stub.cpp b/indra/llmessage/tests/llcurl_stub.cpp
index 9b298d0c04..b7fdf4f437 100755
--- a/indra/llmessage/tests/llcurl_stub.cpp
+++ b/indra/llmessage/tests/llcurl_stub.cpp
@@ -24,55 +24,76 @@
* $/LicenseInfo$
*/
+#ifndef LL_CURL_STUB_CPP
+#define LL_CURL_STUB_CPP
+
+
#include "linden_common.h"
#include "llcurl.h"
+#include "llhttpconstants.cpp"
LLCurl::Responder::Responder()
{
}
-void LLCurl::Responder::completed(U32 status, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const &reason,
- LLSD const& mContent)
+void LLCurl::Responder::httpCompleted()
{
- if (isGoodStatus(status))
+ if (isGoodStatus())
{
- result(mContent);
+ httpSuccess();
}
else
{
- errorWithContent(status, reason, mContent);
+ httpFailure();
}
}
-void LLCurl::Responder::completedHeader(unsigned,
- std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
- LLSD const&)
+void LLCurl::Responder::completedRaw(LLChannelDescriptors const&,
+ boost::shared_ptr<LLBufferArray> const&)
{
}
-void LLCurl::Responder::completedRaw(unsigned,
- std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
- LLChannelDescriptors const&,
- boost::shared_ptr<LLBufferArray> const&)
+void LLCurl::Responder::httpFailure()
{
}
-void LLCurl::Responder::errorWithContent(unsigned,
- std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
- LLSD const&)
+LLCurl::Responder::~Responder ()
{
}
-LLCurl::Responder::~Responder ()
+void LLCurl::Responder::httpSuccess()
+{
+}
+
+std::string LLCurl::Responder::dumpResponse() const
+{
+ return "dumpResponse()";
+}
+
+void LLCurl::Responder::successResult(const LLSD& content)
{
+ setResult(HTTP_OK, "", content);
+ httpSuccess();
}
-void LLCurl::Responder::error(unsigned,
- std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
+void LLCurl::Responder::failureResult(S32 status, const std::string& reason, const LLSD& content)
+{
+ setResult(status, reason, content);
+ httpFailure();
+}
+
+
+void LLCurl::Responder::completeResult(S32 status, const std::string& reason, const LLSD& content)
{
+ setResult(status, reason, content);
+ httpCompleted();
}
-void LLCurl::Responder::result(LLSD const&)
+void LLCurl::Responder::setResult(S32 status, const std::string& reason, const LLSD& content /* = LLSD() */)
{
+ mStatus = status;
+ mReason = reason;
+ mContent = content;
}
+#endif
diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp
index 559001d079..a32bfa59ce 100755
--- a/indra/llmessage/tests/llhttpclient_test.cpp
+++ b/indra/llmessage/tests/llhttpclient_test.cpp
@@ -40,8 +40,6 @@
#include "llproxy.h"
#include "llpumpio.h"
-#include "llsdhttpserver.h"
-#include "lliohttpserver.h"
#include "lliosocket.h"
#include "stringize.h"
@@ -101,7 +99,7 @@ namespace tut
if (mSawError)
{
std::string msg =
- llformat("error() called when not expected, status %d",
+ llformat("httpFailure() called when not expected, status %d",
mStatus);
fail(msg);
}
@@ -111,7 +109,7 @@ namespace tut
{
if (!mSawError)
{
- fail("error() wasn't called");
+ fail("httpFailure() wasn't called");
}
}
@@ -153,33 +151,26 @@ namespace tut
mClient.mResultDeleted = true;
}
- virtual void error(U32 status, const std::string& reason)
+ protected:
+ virtual void httpFailure()
{
mClient.mSawError = true;
- mClient.mStatus = status;
- mClient.mReason = reason;
+ mClient.mStatus = getStatus();
+ mClient.mReason = getReason();
}
- virtual void result(const LLSD& content)
+ virtual void httpSuccess()
{
- mClient.mResult = content;
+ mClient.mResult = getContent();
}
- virtual void completed(
- U32 status, const std::string& reason,
- const LLSD& content)
+ virtual void httpCompleted()
{
- LLHTTPClient::Responder::completed(status, reason, content);
-
+ LLHTTPClient::Responder::httpCompleted();
+
mClient.mSawCompleted = true;
- }
-
- virtual void completedHeader(
- U32 status, const std::string& reason,
- const LLSD& content)
- {
- mClient.mHeader = content;
mClient.mSawCompletedHeader = true;
+ mClient.mHeader = getResponseHeaders();
}
private:
diff --git a/indra/llmessage/tests/llhttpclientadapter_test.cpp b/indra/llmessage/tests/llhttpclientadapter_test.cpp
index 13ce0a0edd..e9ce116bb3 100755
--- a/indra/llmessage/tests/llhttpclientadapter_test.cpp
+++ b/indra/llmessage/tests/llhttpclientadapter_test.cpp
@@ -1,6 +1,6 @@
/**
- * @file
- * @brief
+ * @file llhttpclientadapter_test.cpp
+ * @brief Tests for LLHTTPClientAdapter
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -33,8 +33,8 @@
float const HTTP_REQUEST_EXPIRY_SECS = 1.0F;
std::vector<std::string> get_urls;
-std::vector<boost::intrusive_ptr<LLCurl::Responder> > get_responders;
-void LLHTTPClient::get(const std::string& url, boost::intrusive_ptr<LLCurl::Responder> responder, const LLSD& headers, const F32 timeout)
+std::vector< LLCurl::ResponderPtr > get_responders;
+void LLHTTPClient::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers, const F32 timeout, bool follow_redirects)
{
get_urls.push_back(url);
get_responders.push_back(responder);
@@ -42,16 +42,30 @@ void LLHTTPClient::get(const std::string& url, boost::intrusive_ptr<LLCurl::Resp
std::vector<std::string> put_urls;
std::vector<LLSD> put_body;
-std::vector<boost::intrusive_ptr<LLCurl::Responder> > put_responders;
+std::vector<LLSD> put_headers;
+std::vector<LLCurl::ResponderPtr> put_responders;
-void LLHTTPClient::put(const std::string& url, const LLSD& body, boost::intrusive_ptr<LLCurl::Responder> responder, const LLSD& headers, const F32 timeout)
+void LLHTTPClient::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder, const LLSD& headers, const F32 timeout)
{
put_urls.push_back(url);
put_responders.push_back(responder);
put_body.push_back(body);
+ put_headers.push_back(headers);
}
+std::vector<std::string> delete_urls;
+std::vector<LLCurl::ResponderPtr> delete_responders;
+
+void LLHTTPClient::del(
+ const std::string& url,
+ LLCurl::ResponderPtr responder,
+ const LLSD& headers,
+ const F32 timeout)
+{
+ delete_urls.push_back(url);
+ delete_responders.push_back(responder);
+}
namespace tut
{
@@ -64,6 +78,9 @@ namespace tut
put_urls.clear();
put_responders.clear();
put_body.clear();
+ put_headers.clear();
+ delete_urls.clear();
+ delete_responders.clear();
}
};
@@ -73,7 +90,7 @@ namespace tut
namespace
{
- tut::factory tf("LLHTTPClientAdapterData test");
+ tut::factory tf("LLHTTPClientAdapterData");
}
namespace tut
@@ -91,7 +108,7 @@ namespace tut
{
LLHTTPClientAdapter adapter;
- boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder();
+ LLCurl::ResponderPtr responder = new LLCurl::Responder();
adapter.get("Made up URL", responder);
ensure_equals(get_urls.size(), 1);
@@ -103,7 +120,7 @@ namespace tut
void object::test<3>()
{
LLHTTPClientAdapter adapter;
- boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder();
+ LLCurl::ResponderPtr responder = new LLCurl::Responder();
adapter.get("Made up URL", responder);
@@ -117,7 +134,7 @@ namespace tut
{
LLHTTPClientAdapter adapter;
- boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder();
+ LLCurl::ResponderPtr responder = new LLCurl::Responder();
LLSD body;
body["TestBody"] = "Foobar";
@@ -133,7 +150,7 @@ namespace tut
{
LLHTTPClientAdapter adapter;
- boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder();
+ LLCurl::ResponderPtr responder = new LLCurl::Responder();
LLSD body;
body["TestBody"] = "Foobar";
@@ -150,7 +167,7 @@ namespace tut
{
LLHTTPClientAdapter adapter;
- boost::intrusive_ptr<LLCurl::Responder> responder = new LLCurl::Responder();
+ LLCurl::ResponderPtr responder = new LLCurl::Responder();
LLSD body;
body["TestBody"] = "Foobar";
@@ -160,5 +177,45 @@ namespace tut
ensure_equals(put_body.size(), 1);
ensure_equals(put_body[0]["TestBody"].asString(), "Foobar");
}
+
+ // Ensure that headers are passed through put properly
+ template<> template<>
+ void object::test<7>()
+ {
+ LLHTTPClientAdapter adapter;
+
+ LLCurl::ResponderPtr responder = new LLCurl::Responder();
+
+ LLSD body = LLSD::emptyMap();
+ body["TestBody"] = "Foobar";
+
+ LLSD headers = LLSD::emptyMap();
+ headers["booger"] = "omg";
+
+ adapter.put("Made up URL", body, responder, headers);
+
+ ensure_equals("Header count", put_headers.size(), 1);
+ ensure_equals(
+ "First header",
+ put_headers[0]["booger"].asString(),
+ "omg");
+ }
+
+ // Ensure that del() passes appropriate arguments to the LLHTTPClient
+ template<> template<>
+ void object::test<8>()
+ {
+ LLHTTPClientAdapter adapter;
+
+ LLCurl::ResponderPtr responder = new LLCurl::Responder();
+
+ adapter.del("Made up URL", responder);
+
+ ensure_equals("URL count", delete_urls.size(), 1);
+ ensure_equals("Received URL", delete_urls[0], "Made up URL");
+
+ ensure_equals("Responder count", delete_responders.size(), 1);
+ //ensure_equals("Responder", delete_responders[0], responder);
+ }
}
diff --git a/indra/llmessage/tests/llhttpnode_stub.cpp b/indra/llmessage/tests/llhttpnode_stub.cpp
new file mode 100755
index 0000000000..479a256bdd
--- /dev/null
+++ b/indra/llmessage/tests/llhttpnode_stub.cpp
@@ -0,0 +1,107 @@
+/**
+ * @file llhttpnode_stub.cpp
+ * @brief STUB Implementation of classes for generic HTTP/LSL/REST handling.
+ *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
+ *
+ * Second Life Viewer Source Code
+ * Copyright (c) 2006-2009, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+#include "llhttpnode.h"
+
+const std::string CONTEXT_VERB("verb");
+const std::string CONTEXT_REQUEST("request");
+const std::string CONTEXT_WILDCARD("wildcard");
+const std::string CONTEXT_PATH("path");
+const std::string CONTEXT_QUERY_STRING("query-string");
+const std::string CONTEXT_REMOTE_HOST("remote-host");
+const std::string CONTEXT_REMOTE_PORT("remote-port");
+const std::string CONTEXT_HEADERS("headers");
+const std::string CONTEXT_RESPONSE("response");
+
+/**
+ * LLHTTPNode
+ */
+class LLHTTPNode::Impl
+{
+ // dummy
+};
+
+LLHTTPNode::LLHTTPNode(): impl(*new Impl) {}
+LLHTTPNode::~LLHTTPNode() {}
+LLSD LLHTTPNode::simpleGet() const { return LLSD(); }
+LLSD LLHTTPNode::simplePut(const LLSD& input) const { return LLSD(); }
+LLSD LLHTTPNode::simplePost(const LLSD& input) const { return LLSD(); }
+LLSD LLHTTPNode::simpleDel(const LLSD&) const { return LLSD(); }
+void LLHTTPNode::get(LLHTTPNode::ResponsePtr response, const LLSD& context) const {}
+void LLHTTPNode::put(LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const {}
+void LLHTTPNode::post(LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const {}
+void LLHTTPNode::del(LLHTTPNode::ResponsePtr response, const LLSD& context) const {}
+void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const {}
+LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const { return NULL; }
+bool LLHTTPNode::handles(const LLSD& remainder, LLSD& context) const { return false; }
+bool LLHTTPNode::validate(const std::string& name, LLSD& context) const { return false; }
+const LLHTTPNode* LLHTTPNode::traverse(const std::string& path, LLSD& context) const { return NULL; }
+void LLHTTPNode::addNode(const std::string& path, LLHTTPNode* nodeToAdd) { }
+LLSD LLHTTPNode::allNodePaths() const { return LLSD(); }
+const LLHTTPNode* LLHTTPNode::rootNode() const { return NULL; }
+const LLHTTPNode* LLHTTPNode::findNode(const std::string& name) const { return NULL; }
+
+LLHTTPNode::Response::~Response(){}
+void LLHTTPNode::Response::notFound(const std::string& message)
+{
+ status(404, message);
+}
+void LLHTTPNode::Response::notFound()
+{
+ status(404, "Not Found");
+}
+void LLHTTPNode::Response::methodNotAllowed()
+{
+ status(405, "Method Not Allowed");
+}
+void LLHTTPNode::Response::statusUnknownError(S32 code)
+{
+ status(code, "Unknown Error");
+}
+
+void LLHTTPNode::Response::status(S32 code, const std::string& message)
+{
+}
+
+void LLHTTPNode::Response::addHeader(const std::string& name,const std::string& value)
+{
+ mHeaders[name] = value;
+}
+void LLHTTPNode::describe(Description& desc) const { }
+
+
+const LLChainIOFactory* LLHTTPNode::getProtocolHandler() const { return NULL; }
+
+
+LLHTTPRegistrar::NodeFactory::~NodeFactory() { }
+
+void LLHTTPRegistrar::registerFactory(
+ const std::string& path, NodeFactory& factory) {}
+void LLHTTPRegistrar::buildAllServices(LLHTTPNode& root) {}
+
+
diff --git a/indra/llmessage/tests/llmime_test.cpp b/indra/llmessage/tests/llmime_test.cpp
deleted file mode 100755
index aed5c4589c..0000000000
--- a/indra/llmessage/tests/llmime_test.cpp
+++ /dev/null
@@ -1,445 +0,0 @@
-/**
- * @file llmime_test.cpp
- * @author Phoenix
- * @date 2006-12-24
- * @brief BRIEF_DESC of llmime_test.cpp
- *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-#include "llsdserialize.h"
-
-#include "../llmime.h"
-
-#include "../test/lltut.h"
-
-namespace tut
-{
- struct mime_index
- {
- };
- typedef test_group<mime_index> mime_index_t;
- typedef mime_index_t::object mime_index_object_t;
- tut::mime_index_t tut_mime_index("LLMime");
-
- template<> template<>
- void mime_index_object_t::test<1>()
- {
- LLMimeIndex mime;
- ensure("no headers", mime.headers().isUndefined());
- ensure_equals("invalid offset", mime.offset(), -1);
- ensure_equals("invalid content length", mime.contentLength(), -1);
- ensure("no content type", mime.contentType().empty());
- ensure("not multipart", !mime.isMultipart());
- ensure_equals("no attachments", mime.subPartCount(), 0);
- }
-
- template<> template<>
- void mime_index_object_t::test<2>()
- {
- const S32 CONTENT_LENGTH = 6000;
- const S32 CONTENT_OFFSET = 100;
- const std::string CONTENT_TYPE = std::string("image/j2c");
- LLSD headers;
- headers["Content-Length"] = CONTENT_LENGTH;
- headers["Content-Type"] = CONTENT_TYPE;
- LLMimeIndex mime(headers, CONTENT_OFFSET);
- ensure("headers are map", mime.headers().isMap());
- ensure_equals("offset", mime.offset(), CONTENT_OFFSET);
- ensure_equals("content length", mime.contentLength(), CONTENT_LENGTH);
- ensure_equals("type is image/j2c", mime.contentType(), CONTENT_TYPE);
- ensure("not multipart", !mime.isMultipart());
- ensure_equals("no attachments", mime.subPartCount(), 0);
- }
-
- template<> template<>
- void mime_index_object_t::test<3>()
- {
- const S32 MULTI_CONTENT_LENGTH = 8000;
- const S32 MULTI_CONTENT_OFFSET = 100;
- const std::string MULTI_CONTENT_TYPE = std::string("multipart/mixed");
- LLSD headers;
- headers["Content-Length"] = MULTI_CONTENT_LENGTH;
- headers["Content-Type"] = MULTI_CONTENT_TYPE;
- LLMimeIndex mime(headers, MULTI_CONTENT_OFFSET);
- llinfos << "headers: " << LLSDOStreamer<LLSDNotationFormatter>(headers)
- << llendl;
-
-
- const S32 META_CONTENT_LENGTH = 700;
- const S32 META_CONTENT_OFFSET = 69;
- const std::string META_CONTENT_TYPE = std::string(
- "text/llsd+xml");
- headers = LLSD::emptyMap();
- headers["Content-Length"] = META_CONTENT_LENGTH;
- headers["Content-Type"] = META_CONTENT_TYPE;
- LLMimeIndex meta(headers, META_CONTENT_OFFSET);
- mime.attachSubPart(meta);
-
- const S32 IMAGE_CONTENT_LENGTH = 6000;
- const S32 IMAGE_CONTENT_OFFSET = 200;
- const std::string IMAGE_CONTENT_TYPE = std::string("image/j2c");
- headers = LLSD::emptyMap();
- headers["Content-Length"] = IMAGE_CONTENT_LENGTH;
- headers["Content-Type"] = IMAGE_CONTENT_TYPE;
- LLMimeIndex image(headers, IMAGE_CONTENT_OFFSET);
- mime.attachSubPart(image);
-
- // make sure we have a valid multi-part
- ensure("is multipart", mime.isMultipart());
- ensure_equals("multi offset", mime.offset(), MULTI_CONTENT_OFFSET);
- ensure_equals(
- "multi content length",
- mime.contentLength(),
- MULTI_CONTENT_LENGTH);
- ensure_equals("two attachments", mime.subPartCount(), 2);
-
- // make sure ranged gets do the right thing with out of bounds
- // sub-parts.
- LLMimeIndex invalid_child(mime.subPart(-1));
- ensure("no headers", invalid_child.headers().isUndefined());
- ensure_equals("invalid offset", invalid_child.offset(), -1);
- ensure_equals(
- "invalid content length", invalid_child.contentLength(), -1);
- ensure("no content type", invalid_child.contentType().empty());
- ensure("not multipart", !invalid_child.isMultipart());
- ensure_equals("no attachments", invalid_child.subPartCount(), 0);
-
- invalid_child = mime.subPart(2);
- ensure("no headers", invalid_child.headers().isUndefined());
- ensure_equals("invalid offset", invalid_child.offset(), -1);
- ensure_equals(
- "invalid content length", invalid_child.contentLength(), -1);
- ensure("no content type", invalid_child.contentType().empty());
- ensure("not multipart", !invalid_child.isMultipart());
- ensure_equals("no attachments", invalid_child.subPartCount(), 0);
- }
-
- template<> template<>
- void mime_index_object_t::test<4>()
- {
- const S32 MULTI_CONTENT_LENGTH = 8000;
- const S32 MULTI_CONTENT_OFFSET = 100;
- const std::string MULTI_CONTENT_TYPE = std::string("multipart/mixed");
- LLSD headers;
- headers["Content-Length"] = MULTI_CONTENT_LENGTH;
- headers["Content-Type"] = MULTI_CONTENT_TYPE;
- LLMimeIndex mime(headers, MULTI_CONTENT_OFFSET);
-
- const S32 META_CONTENT_LENGTH = 700;
- const S32 META_CONTENT_OFFSET = 69;
- const std::string META_CONTENT_TYPE = std::string(
- "application/llsd+xml");
- headers = LLSD::emptyMap();
- headers["Content-Length"] = META_CONTENT_LENGTH;
- headers["Content-Type"] = META_CONTENT_TYPE;
- LLMimeIndex meta(headers, META_CONTENT_OFFSET);
- mime.attachSubPart(meta);
-
- const S32 IMAGE_CONTENT_LENGTH = 6000;
- const S32 IMAGE_CONTENT_OFFSET = 200;
- const std::string IMAGE_CONTENT_TYPE = std::string("image/j2c");
- headers = LLSD::emptyMap();
- headers["Content-Length"] = IMAGE_CONTENT_LENGTH;
- headers["Content-Type"] = IMAGE_CONTENT_TYPE;
- LLMimeIndex image(headers, IMAGE_CONTENT_OFFSET);
- mime.attachSubPart(image);
-
- // check what we have
- ensure("is multipart", mime.isMultipart());
- ensure_equals("multi offset", mime.offset(), MULTI_CONTENT_OFFSET);
- ensure_equals(
- "multi content length",
- mime.contentLength(),
- MULTI_CONTENT_LENGTH);
- ensure_equals("two attachments", mime.subPartCount(), 2);
-
- LLMimeIndex actual_meta = mime.subPart(0);
- ensure_equals(
- "meta type", actual_meta.contentType(), META_CONTENT_TYPE);
- ensure_equals(
- "meta offset", actual_meta.offset(), META_CONTENT_OFFSET);
- ensure_equals(
- "meta content length",
- actual_meta.contentLength(),
- META_CONTENT_LENGTH);
-
- LLMimeIndex actual_image = mime.subPart(1);
- ensure_equals(
- "image type", actual_image.contentType(), IMAGE_CONTENT_TYPE);
- ensure_equals(
- "image offset", actual_image.offset(), IMAGE_CONTENT_OFFSET);
- ensure_equals(
- "image content length",
- actual_image.contentLength(),
- IMAGE_CONTENT_LENGTH);
- }
-
-/*
- template<> template<>
- void mime_index_object_t::test<5>()
- {
- }
- template<> template<>
- void mime_index_object_t::test<6>()
- {
- }
- template<> template<>
- void mime_index_object_t::test<7>()
- {
- }
- template<> template<>
- void mime_index_object_t::test<8>()
- {
- }
- template<> template<>
- void mime_index_object_t::test<>()
- {
- }
-*/
-}
-
-
-namespace tut
-{
- struct mime_parse
- {
- };
- typedef test_group<mime_parse> mime_parse_t;
- typedef mime_parse_t::object mime_parse_object_t;
- tut::mime_parse_t tut_mime_parse("LLMimeParse");
-
- template<> template<>
- void mime_parse_object_t::test<1>()
- {
- // parse one mime object
- const std::string SERIALIZED_MIME("Content-Length: 200\r\nContent-Type: text/plain\r\n\r\naaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccc\r\n");
- std::stringstream istr;
- istr.str(SERIALIZED_MIME);
- LLMimeIndex mime;
- LLMimeParser parser;
- bool ok = parser.parseIndex(istr, mime);
- ensure("Parse successful.", ok);
- ensure_equals("content type", mime.contentType(), "text/plain");
- ensure_equals("content length", mime.contentLength(), 200);
- ensure_equals("offset", mime.offset(), 49);
- }
-
- template<> template<>
- void mime_parse_object_t::test<2>()
- {
- // make sure we only parse one.
- const std::string SERIALIZED_MIME("Content-Length: 200\r\nContent-Type: text/plain\r\n\r\naaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccc\r\n\r\nContent-Length: 200\r\nContent-Type: text/plain\r\n\r\naaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccc\r\n\r\n");
- std::stringstream istr;
- istr.str(SERIALIZED_MIME);
- LLMimeIndex mime;
- LLMimeParser parser;
- bool ok = parser.parseIndex(istr, mime);
- ensure("Parse successful.", ok);
- ensure("not multipart.", !mime.isMultipart());
- ensure_equals("content type", mime.contentType(), "text/plain");
- ensure_equals("content length", mime.contentLength(), 200);
- ensure_equals("offset", mime.offset(), 49);
- }
-
- template<> template<>
- void mime_parse_object_t::test<3>()
- {
- // test multi-part and lack of content length for some of it.
- /*
-Content-Type: multipart/mixed; boundary="segment"rnContent-Length: 148rnrn--segmentrnContent-Type: text/plainrnrnsome datarnrn--segmentrnContent-Type: text/xml; charset=UTF-8rnContent-Length: 22rnrn<llsd><undef /></llsd>rnrn
- */
- const std::string SERIALIZED_MIME("Content-Type: multipart/mixed; boundary=\"segment\"\r\nContent-Length: 150\r\n\r\n--segment\r\nContent-Type: text/plain\r\n\r\nsome data\r\n\r\n--segment\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Length: 22\r\n\r\n<llsd><undef /></llsd>\r\n\r\n");
- std::stringstream istr;
- istr.str(SERIALIZED_MIME);
- LLMimeIndex mime;
- LLMimeParser parser;
- bool ok = parser.parseIndex(istr, mime);
- ensure("Parse successful.", ok);
- ensure("is multipart.", mime.isMultipart());
- ensure_equals("sub-part count", mime.subPartCount(), 2);
- ensure_equals("content length", mime.contentLength(), 150);
- ensure_equals("data offset for multipart", mime.offset(), 74);
-
- LLMimeIndex mime_plain(mime.subPart(0));
- ensure_equals(
- "first part type",
- mime_plain.contentType(),
- "text/plain");
- ensure_equals(
- "first part content length not known.",
- mime_plain.contentLength(),
- -1);
- ensure_equals("first part offset", mime_plain.offset(), 113);
-
- LLMimeIndex mime_xml(mime.subPart(1));
- ensure_equals(
- "second part type",
- mime_xml.contentType(),
- "text/xml; charset=UTF-8");
- ensure_equals(
- "second part content length",
- mime_xml.contentLength(),
- 22);
- ensure_equals("second part offset", mime_xml.offset(), 198);
- }
-
- template<> template<>
- void mime_parse_object_t::test<4>()
- {
- // test multi-part, unquoted separator, and premature eof conditions
- /*
-Content-Type: multipart/mixed; boundary=segmentrnContent-Length: 220rnrn--segmentrnContent-Type: text/plainrnContent-Length: 55rnrnhow are you today?rnI do not know. I guess I am:n'fine'rnrn--segmentrnContent-Type: text/xml; charset=UTF-8rnContent-Length: 22rnrn<llsd><undef /></llsd>rnrn */
- const std::string SERIALIZED_MIME("Content-Type: multipart/mixed; boundary=segment\r\nContent-Length: 220\r\n\r\n--segment\r\nContent-Type: text/plain\r\nContent-Length: 55\r\n\r\nhow are you today?\r\nI do not know. I guess I am:\n'fine'\r\n\r\n--segment\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Length: 22\r\n\r\n<llsd><undef /></llsd>\r\n\r\n");
- std::stringstream istr;
- istr.str(SERIALIZED_MIME);
- LLMimeIndex mime;
- LLMimeParser parser;
- bool ok = parser.parseIndex(istr, mime);
- ensure("Parse successful.", ok);
- ensure("is multipart.", mime.isMultipart());
- ensure_equals("sub-part count", mime.subPartCount(), 2);
- ensure_equals("content length", mime.contentLength(), 220);
- ensure_equals("data offset for multipart", mime.offset(), 72);
-
- LLMimeIndex mime_plain(mime.subPart(0));
- ensure_equals(
- "first part type",
- mime_plain.contentType(),
- "text/plain");
- ensure_equals(
- "first part content length",
- mime_plain.contentLength(),
- 55);
- ensure_equals("first part offset", mime_plain.offset(), 131);
-
- LLMimeIndex mime_xml(mime.subPart(1));
- ensure_equals(
- "second part type",
- mime_xml.contentType(),
- "text/xml; charset=UTF-8");
- ensure_equals(
- "second part content length",
- mime_xml.contentLength(),
- 22);
- ensure_equals("second part offset", mime_xml.offset(), 262);
- }
-
- template<> template<>
- void mime_parse_object_t::test<5>()
- {
- // test multi-part with multiple params
- const std::string SERIALIZED_MIME("Content-Type: multipart/mixed; boundary=segment; comment=\"testing multiple params.\"\r\nContent-Length: 220\r\n\r\n--segment\r\nContent-Type: text/plain\r\nContent-Length: 55\r\n\r\nhow are you today?\r\nI do not know. I guess I am:\n'fine'\r\n\r\n--segment\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Length: 22\r\n\r\n<llsd><undef /></llsd>\r\n\r\n");
- std::stringstream istr;
- istr.str(SERIALIZED_MIME);
- LLMimeIndex mime;
- LLMimeParser parser;
- bool ok = parser.parseIndex(istr, mime);
- ensure("Parse successful.", ok);
- ensure("is multipart.", mime.isMultipart());
- ensure_equals("sub-part count", mime.subPartCount(), 2);
- ensure_equals("content length", mime.contentLength(), 220);
-
- LLMimeIndex mime_plain(mime.subPart(0));
- ensure_equals(
- "first part type",
- mime_plain.contentType(),
- "text/plain");
- ensure_equals(
- "first part content length",
- mime_plain.contentLength(),
- 55);
-
- LLMimeIndex mime_xml(mime.subPart(1));
- ensure_equals(
- "second part type",
- mime_xml.contentType(),
- "text/xml; charset=UTF-8");
- ensure_equals(
- "second part content length",
- mime_xml.contentLength(),
- 22);
- }
-
- template<> template<>
- void mime_parse_object_t::test<6>()
- {
- // test multi-part with no specified boundary and eof
-/*
-Content-Type: multipart/relatedrnContent-Length: 220rnrn--rnContent-Type: text/plainrnContent-Length: 55rnrnhow are you today?rnI do not know. I guess I am:n'fine'rnrn--rnContent-Type: text/xml; charset=UTF-8rnContent-Length: 22rnrn<llsd><undef /></llsd>rnrn
-*/
- const std::string SERIALIZED_MIME("Content-Type: multipart/related\r\nContent-Length: 500\r\n\r\n--\r\nContent-Type: text/plain\r\nContent-Length: 55\r\n\r\nhow are you today?\r\nI do not know. I guess I am:\n'fine'\r\n\r\n--\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Length: 22\r\n\r\n<llsd><undef /></llsd>\r\n\r\n");
- std::stringstream istr;
- istr.str(SERIALIZED_MIME);
- LLMimeIndex mime;
- LLMimeParser parser;
- bool ok = parser.parseIndex(istr, mime);
- ensure("Parse successful.", ok);
- ensure("is multipart.", mime.isMultipart());
- ensure_equals("sub-part count", mime.subPartCount(), 2);
- ensure_equals("content length", mime.contentLength(), 500);
- ensure_equals("data offset for multipart", mime.offset(), 56);
-
- LLMimeIndex mime_plain(mime.subPart(0));
- ensure_equals(
- "first part type",
- mime_plain.contentType(),
- "text/plain");
- ensure_equals(
- "first part content length",
- mime_plain.contentLength(),
- 55);
- ensure_equals("first part offset", mime_plain.offset(), 108);
-
- LLMimeIndex mime_xml(mime.subPart(1));
- ensure_equals(
- "second part type",
- mime_xml.contentType(),
- "text/xml; charset=UTF-8");
- ensure_equals(
- "second part content length",
- mime_xml.contentLength(),
- 22);
- ensure_equals("second part offset", mime_xml.offset(), 232);
- }
-
-/*
- template<> template<>
- void mime_parse_object_t::test<>()
- {
- }
- template<> template<>
- void mime_parse_object_t::test<>()
- {
- }
- template<> template<>
- void mime_parse_object_t::test<>()
- {
- }
- template<> template<>
- void mime_parse_object_t::test<>()
- {
- }
-*/
-}
diff --git a/indra/llmessage/tests/llregionpresenceverifier_test.cpp b/indra/llmessage/tests/llregionpresenceverifier_test.cpp
deleted file mode 100755
index 5b89f2a8c6..0000000000
--- a/indra/llmessage/tests/llregionpresenceverifier_test.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * @file
- * @brief
- *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-#include "../test/lltut.h"
-#include "llregionpresenceverifier.h"
-#include "llcurl_stub.cpp"
-#include "llhost.cpp"
-#include "net.cpp"
-#include "lltesthttpclientadapter.cpp"
-
-class LLTestResponse : public LLRegionPresenceVerifier::Response
-{
-public:
-
- virtual bool checkValidity(const LLSD& content) const
- {
- return true;
- }
-
- virtual void onRegionVerified(const LLSD& region_details)
- {
- }
-
- virtual void onRegionVerificationFailed()
- {
- }
-
- virtual LLHTTPClientInterface& getHttpClient()
- {
- return mHttpInterface;
- }
-
- LLTestHTTPClientAdapter mHttpInterface;
-};
-
-namespace tut
-{
- struct LLRegionPresenceVerifierData
- {
- LLRegionPresenceVerifierData() :
- mResponse(new LLTestResponse()),
- mResponder("", LLRegionPresenceVerifier::ResponsePtr(mResponse),
- LLSD(), 3)
- {
- }
-
- LLTestResponse* mResponse;
- LLRegionPresenceVerifier::VerifiedDestinationResponder mResponder;
- };
-
- typedef test_group<LLRegionPresenceVerifierData> factory;
- typedef factory::object object;
-}
-
-namespace
-{
- tut::factory tf("LLRegionPresenceVerifier");
-}
-
-namespace tut
-{
- // Test that VerifiedDestinationResponder does retry
- // on error when shouldRetry returns true.
- template<> template<>
- void object::test<1>()
- {
- mResponder.error(500, "Internal server error");
- ensure_equals(mResponse->mHttpInterface.mGetUrl.size(), 1);
- }
-
- // Test that VerifiedDestinationResponder only retries
- // on error until shouldRetry returns false.
- template<> template<>
- void object::test<2>()
- {
- mResponder.error(500, "Internal server error");
- mResponder.error(500, "Internal server error");
- mResponder.error(500, "Internal server error");
- mResponder.error(500, "Internal server error");
- ensure_equals(mResponse->mHttpInterface.mGetUrl.size(), 3);
- }
-}
-
diff --git a/indra/llmessage/tests/lltrustedmessageservice_test.cpp b/indra/llmessage/tests/lltrustedmessageservice_test.cpp
index b287a29841..55748ad27e 100755
--- a/indra/llmessage/tests/lltrustedmessageservice_test.cpp
+++ b/indra/llmessage/tests/lltrustedmessageservice_test.cpp
@@ -32,6 +32,7 @@
#include "message.h"
#include "llmessageconfig.h"
+#include "llhttpnode_stub.cpp"
LLMessageSystem* gMessageSystem = NULL;