aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmessage')
-rw-r--r--linden/indra/llmessage/CMakeLists.txt8
-rw-r--r--linden/indra/llmessage/llcachename.cpp221
-rw-r--r--linden/indra/llmessage/llcachename.h14
-rw-r--r--linden/indra/llmessage/llcircuit.cpp11
-rw-r--r--linden/indra/llmessage/llcircuit.h7
-rw-r--r--linden/indra/llmessage/llcurl.cpp6
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.cpp4
-rw-r--r--linden/indra/llmessage/llhttpclient.cpp36
-rw-r--r--linden/indra/llmessage/lliohttpserver.cpp7
-rw-r--r--linden/indra/llmessage/lliosocket.cpp3
-rw-r--r--linden/indra/llmessage/llmail.cpp36
-rw-r--r--linden/indra/llmessage/llmail.h61
-rw-r--r--linden/indra/llmessage/llmessagetemplate.cpp22
-rw-r--r--linden/indra/llmessage/llmessagetemplate.h12
-rw-r--r--linden/indra/llmessage/llnamevalue.cpp4
-rw-r--r--linden/indra/llmessage/llnamevalue.h4
-rw-r--r--linden/indra/llmessage/llpartdata.h1
-rw-r--r--linden/indra/llmessage/llpumpio.cpp30
-rw-r--r--linden/indra/llmessage/llpumpio.h9
-rw-r--r--linden/indra/llmessage/llqueryflags.h2
-rw-r--r--linden/indra/llmessage/llurlrequest.cpp23
-rw-r--r--linden/indra/llmessage/message.cpp34
-rw-r--r--linden/indra/llmessage/message.h16
23 files changed, 498 insertions, 73 deletions
diff --git a/linden/indra/llmessage/CMakeLists.txt b/linden/indra/llmessage/CMakeLists.txt
index ba17265..fd22de9 100644
--- a/linden/indra/llmessage/CMakeLists.txt
+++ b/linden/indra/llmessage/CMakeLists.txt
@@ -189,3 +189,11 @@ set_source_files_properties(${llmessage_HEADER_FILES}
189list(APPEND llmessage_SOURCE_FILES ${llmessage_HEADER_FILES}) 189list(APPEND llmessage_SOURCE_FILES ${llmessage_HEADER_FILES})
190 190
191add_library (llmessage ${llmessage_SOURCE_FILES}) 191add_library (llmessage ${llmessage_SOURCE_FILES})
192target_link_libraries(
193 llmessage
194 ${CURL_LIBRARIES}
195 ${CARES_LIBRARIES}
196 ${OPENSSL_LIBRARIES}
197 ${CRYPTO_LIBRARIES}
198 ${XMLRPCEPI_LIBRARIES}
199 )
diff --git a/linden/indra/llmessage/llcachename.cpp b/linden/indra/llmessage/llcachename.cpp
index 70e1ccf..8f02358 100644
--- a/linden/indra/llmessage/llcachename.cpp
+++ b/linden/indra/llmessage/llcachename.cpp
@@ -41,7 +41,8 @@
41#include "llsdserialize.h" 41#include "llsdserialize.h"
42#include "lluuid.h" 42#include "lluuid.h"
43#include "message.h" 43#include "message.h"
44 44#include "llservicebuilder.h"
45#include "llframetimer.h"
45// Constants 46// Constants
46static const std::string CN_WAITING("(Loading...)"); // *TODO: translate 47static const std::string CN_WAITING("(Loading...)"); // *TODO: translate
47static const std::string CN_NOBODY("(nobody)"); // *TODO: translate 48static const std::string CN_NOBODY("(nobody)"); // *TODO: translate
@@ -196,6 +197,8 @@ class LLCacheName::Impl
196public: 197public:
197 LLMessageSystem* mMsg; 198 LLMessageSystem* mMsg;
198 LLHost mUpstreamHost; 199 LLHost mUpstreamHost;
200 std::string mGroupNameURL;
201 std::string mAgentNameURL;
199 202
200 Cache mCache; 203 Cache mCache;
201 // the map of UUIDs to names 204 // the map of UUIDs to names
@@ -221,6 +224,8 @@ public:
221 void processPendingReplies(); 224 void processPendingReplies();
222 void sendRequest(const char* msg_name, const AskQueue& queue); 225 void sendRequest(const char* msg_name, const AskQueue& queue);
223 bool isRequestPending(const LLUUID& id); 226 bool isRequestPending(const LLUUID& id);
227 void getAgentName(const AskQueue&);
228 void getGroupName(const AskQueue&);
224 229
225 // Message system callbacks. 230 // Message system callbacks.
226 void processUUIDRequest(LLMessageSystem* msg, bool isGroup); 231 void processUUIDRequest(LLMessageSystem* msg, bool isGroup);
@@ -234,6 +239,35 @@ public:
234 void notifyObservers(const LLUUID& id, const std::string& first, const std::string& last, BOOL group); 239 void notifyObservers(const LLUUID& id, const std::string& first, const std::string& last, BOOL group);
235}; 240};
236 241
242class LLHTTPAgentNamesResponse : public LLHTTPClient::Responder
243{
244public:
245 LLHTTPAgentNamesResponse(const LLSD& agent_ids)
246 : mAgentIDs(agent_ids)
247 { }
248 void result(const LLSD& content);
249private:
250 LLHost mSender;
251 LLSD mAgentIDs;
252
253};
254
255class LLHTTPGroupNamesResponse : public LLHTTPClient::Responder
256{
257public:
258 LLHTTPGroupNamesResponse(const LLSD& group_ids)
259 : mGroupIDs(group_ids)
260 { };
261
262 void result(const LLSD& content);
263private:
264 LLHost mSender;
265 LLSD mGroupIDs;
266
267};
268
269
270
237 271
238/// -------------------------------------------------------------------------- 272/// --------------------------------------------------------------------------
239/// class LLCacheName 273/// class LLCacheName
@@ -319,6 +353,57 @@ void LLCacheName::cancelCallback(const LLUUID& id, LLCacheNameCallback callback,
319 } 353 }
320} 354}
321 355
356void LLCacheName::sendAgentNames(const LLUUID& id, std::string& first, std::string& last)
357{
358
359 LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id);
360 if (!entry)
361 {
362 entry = new LLCacheNameEntry;
363 impl.mCache[id] = entry;
364
365 }
366 entry->mIsGroup = false;
367 entry->mCreateTime = (U32)LLFrameTimer::getTotalSeconds();
368 //entry->mFirstName = first;
369 //entry->mLastName = last;
370 //LLStringUtil::truncate(entry->mFirstName, DB_FIRST_NAME_BUF_SIZE);
371 //LLStringUtil::truncate(entry->mLastName, DB_LAST_NAME_BUF_SIZE);
372 entry->mFirstName = std::string(first, DB_FIRST_NAME_BUF_SIZE);
373 entry->mLastName = std::string(last, DB_LAST_NAME_BUF_SIZE);
374
375 impl.mPendingQueue.erase(id);
376 impl.notifyObservers(id,
377 entry->mFirstName, entry->mLastName,
378 FALSE);
379
380}
381
382void LLCacheName::sendGroupNames(const LLUUID& id, std::string& name)
383{
384
385 LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id);
386 if (!entry)
387 {
388 entry = new LLCacheNameEntry;
389 impl.mCache[id] = entry;
390
391 }
392
393 entry->mIsGroup = true;
394 entry->mCreateTime = (U32)time(NULL);
395
396 entry->mGroupName = std::string(name, DB_GROUP_NAME_BUF_SIZE);
397
398 impl.mPendingQueue.erase(id);
399
400 impl.notifyObservers(id,
401 entry->mFirstName, entry->mLastName,
402 FALSE);
403
404
405}
406
322void LLCacheName::importFile(LLFILE* fp) 407void LLCacheName::importFile(LLFILE* fp)
323{ 408{
324 S32 count = 0; 409 S32 count = 0;
@@ -524,6 +609,16 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname)
524 return res; 609 return res;
525} 610}
526 611
612void LLCacheName::setGroupURL(const std::string& group_url)
613{
614 impl.mGroupNameURL = group_url;
615}
616
617void LLCacheName::setAgentURL(const std::string& agent_url)
618{
619 impl.mAgentNameURL = agent_url;
620}
621
527BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) 622BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
528{ 623{
529 if(id.isNull()) 624 if(id.isNull())
@@ -558,6 +653,111 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
558 } 653 }
559} 654}
560 655
656void LLCacheName::Impl::getAgentName(const AskQueue &queue)
657{
658
659 // get the names from backbone module
660 if(queue.empty())
661 {
662 return;
663 }
664
665 LLSD request;
666 request["action"] = "GET";
667 LLSD id_block = LLSD::emptyArray();
668 AskQueue::const_iterator it = queue.begin();
669 AskQueue::const_iterator end = queue.end();
670 for(;it!=end;++it)
671 {
672 id_block.append(*it);
673 }
674 lldebugs<<LLSDOStreamer<LLSDNotationFormatter>(id_block) <<llendl;
675
676 request["agents"] = id_block;
677
678 LLHTTPClient::post(
679 mAgentNameURL,
680 request,
681 new LLHTTPAgentNamesResponse(id_block));
682
683
684 lldebugs<<"Service builder call to agent-name "<<mAgentNameURL<<llendl;
685
686}
687
688void LLHTTPAgentNamesResponse::result(const LLSD& content)
689{
690 LLUUID id;
691 lldebugs<<LLSDOStreamer<LLSDNotationFormatter>(content) <<llendl;
692
693 LLSD::map_const_iterator iter = content.beginMap();
694 for ( ; iter != content.endMap(); ++iter)
695 {
696 id.set((*iter).first);
697 LLSD name = (*iter).second;
698 LLCacheNameEntry* entry = new LLCacheNameEntry;
699 entry->mIsGroup = FALSE;
700 entry->mCreateTime = (U32)LLFrameTimer::getTotalSeconds();
701 std::string first = name["first"];
702 std::string last = name["last"];
703 entry->mFirstName = std::string(first, DB_FIRST_NAME_BUF_SIZE);
704 entry->mLastName = std::string(last, DB_LAST_NAME_BUF_SIZE);
705
706 gCacheName->sendAgentNames(id,first,last);
707 }
708}
709
710
711void LLCacheName::Impl::getGroupName(const AskQueue &queue)
712{
713 // get the group names from backbone module
714 if(queue.empty())
715 {
716 return;
717 }
718
719 LLSD request;
720 request["action"] = "GET";
721 LLSD id_block = LLSD::emptyArray();
722 AskQueue::const_iterator it = queue.begin();
723 AskQueue::const_iterator end = queue.end();
724 for(;it!=end;++it)
725 {
726 id_block.append(*it);
727 }
728
729 request["groups"] = id_block;
730
731 if(!mGroupNameURL.empty())
732 {
733 LLHTTPClient::post(
734 mGroupNameURL,
735 request,
736 new LLHTTPGroupNamesResponse(id_block));
737 }
738 lldebugs<<"Service builder call to group-name "<< mGroupNameURL<<llendl;
739}
740
741void LLHTTPGroupNamesResponse::result(const LLSD& content)
742{
743 lldebugs<<"Result"<<LLSDOStreamer<LLSDNotationFormatter>(content) << llendl;
744 LLUUID id;
745
746 LLSD::map_const_iterator iter = content.beginMap();
747 for ( ; iter != content.endMap(); ++iter)
748 {
749
750 id.set((*iter).first);
751 std::string name = (*iter).second.asString();
752 LLCacheNameEntry* entry = new LLCacheNameEntry;
753 entry->mIsGroup = TRUE;
754 entry->mCreateTime = (U32)time(NULL);
755 entry->mGroupName = std::string(name, DB_GROUP_NAME_BUF_SIZE);
756 lldebugs<<"Group Name"<<name<<llendl;
757 gCacheName->sendGroupNames(id,name);
758 }
759}
760
561// TODO: Make the cache name callback take a SINGLE std::string, 761// TODO: Make the cache name callback take a SINGLE std::string,
562// not a separate first and last name. 762// not a separate first and last name.
563void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data) 763void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data)
@@ -606,12 +806,14 @@ void LLCacheName::processPending()
606 return; 806 return;
607 } 807 }
608 808
809 /*
609 if(!impl.mUpstreamHost.isOk()) 810 if(!impl.mUpstreamHost.isOk())
610 { 811 {
611 lldebugs << "LLCacheName::processPending() - bad upstream host." 812 lldebugs << "LLCacheName::processPending() - bad upstream host."
612 << llendl; 813 << llendl;
613 return; 814 return;
614 } 815 }
816 */
615 817
616 impl.processPendingAsks(); 818 impl.processPendingAsks();
617 impl.processPendingReplies(); 819 impl.processPendingReplies();
@@ -693,8 +895,16 @@ std::string LLCacheName::getDefaultName()
693 895
694void LLCacheName::Impl::processPendingAsks() 896void LLCacheName::Impl::processPendingAsks()
695{ 897{
696 sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue); 898 if (mUpstreamHost.isOk()) //its the vuewer asking for names send request to simulator
697 sendRequest(_PREHASH_UUIDGroupNameRequest, mAskGroupQueue); 899 {
900 sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue);
901 sendRequest(_PREHASH_UUIDGroupNameRequest, mAskGroupQueue);
902 }
903 else //its simulator asking for names ask the backbone
904 {
905 getAgentName(mAskNameQueue);
906 getGroupName(mAskGroupQueue);
907 }
698 mAskNameQueue.clear(); 908 mAskNameQueue.clear();
699 mAskGroupQueue.clear(); 909 mAskGroupQueue.clear();
700} 910}
@@ -815,12 +1025,15 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup)
815{ 1025{
816 // You should only get this message if the cache is at the simulator 1026 // You should only get this message if the cache is at the simulator
817 // level, hence having an upstream provider. 1027 // level, hence having an upstream provider.
1028 // 03/31/2008 Simulator is talking to backbone and not dataserver
1029 // This check was for dataserver
1030 /*
818 if (!mUpstreamHost.isOk()) 1031 if (!mUpstreamHost.isOk())
819 { 1032 {
820 llwarns << "LLCacheName - got UUID name/group request, but no upstream provider!" << llendl; 1033 llwarns << "LLCacheName - got UUID name/group request, but no upstream provider!" << llendl;
821 return; 1034 return;
822 } 1035 }
823 1036 */
824 LLHost fromHost = msg->getSender(); 1037 LLHost fromHost = msg->getSender();
825 ReplySender sender(msg); 1038 ReplySender sender(msg);
826 1039
diff --git a/linden/indra/llmessage/llcachename.h b/linden/indra/llmessage/llcachename.h
index 965b4ba..af644d0 100644
--- a/linden/indra/llmessage/llcachename.h
+++ b/linden/indra/llmessage/llcachename.h
@@ -31,7 +31,9 @@
31 31
32#ifndef LL_LLCACHENAME_H 32#ifndef LL_LLCACHENAME_H
33#define LL_LLCACHENAME_H 33#define LL_LLCACHENAME_H
34 34#include "llhttpclient.h"
35#include "llhost.h"
36#include "lluri.h"
35class LLMessageSystem; 37class LLMessageSystem;
36class LLHost; 38class LLHost;
37class LLUUID; 39class LLUUID;
@@ -97,10 +99,15 @@ public:
97 // This method needs to be called from time to time to send out 99 // This method needs to be called from time to time to send out
98 // requests. 100 // requests.
99 void processPending(); 101 void processPending();
100 102 void setAgentURL(const std::string& url);
103 void setGroupURL(const std::string& url);
104
101 // Expire entries created more than "secs" seconds ago. 105 // Expire entries created more than "secs" seconds ago.
102 void deleteEntriesOlderThan(S32 secs); 106 void deleteEntriesOlderThan(S32 secs);
103 107
108 //send the information retrived from backbone
109 void sendAgentNames(const LLUUID& id, std::string& first, std::string& last);
110 void sendGroupNames(const LLUUID& id, std::string& name);
104 // Debugging 111 // Debugging
105 void dump(); // Dumps the contents of the cache 112 void dump(); // Dumps the contents of the cache
106 void dumpStats(); // Dumps the sizes of the cache and associated queues. 113 void dumpStats(); // Dumps the sizes of the cache and associated queues.
@@ -111,9 +118,8 @@ private:
111 118
112 class Impl; 119 class Impl;
113 Impl& impl; 120 Impl& impl;
114};
115
116 121
122};
117 123
118extern LLCacheName* gCacheName; 124extern LLCacheName* gCacheName;
119 125
diff --git a/linden/indra/llmessage/llcircuit.cpp b/linden/indra/llmessage/llcircuit.cpp
index 12a1520..7b2f241 100644
--- a/linden/indra/llmessage/llcircuit.cpp
+++ b/linden/indra/llmessage/llcircuit.cpp
@@ -60,6 +60,7 @@
60#include "llrand.h" 60#include "llrand.h"
61#include "llstl.h" 61#include "llstl.h"
62#include "lltransfermanager.h" 62#include "lltransfermanager.h"
63#include "llmodularmath.h"
63 64
64const F32 PING_INTERVAL = 5.f; // seconds 65const F32 PING_INTERVAL = 5.f; // seconds
65const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked. 66const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked.
@@ -676,6 +677,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
676 mPacketsIn++; 677 mPacketsIn++;
677 setPacketInID((id + 1) % LL_MAX_OUT_PACKET_ID); 678 setPacketInID((id + 1) % LL_MAX_OUT_PACKET_ID);
678 679
680 mLastPacketGap = 0;
681 mOutOfOrderRate.count(0);
679 return; 682 return;
680 } 683 }
681 684
@@ -683,6 +686,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
683 686
684 687
685 // now, check to see if we've got a gap 688 // now, check to see if we've got a gap
689 U32 gap = 0;
686 if ((mPacketsInID == id)) 690 if ((mPacketsInID == id))
687 { 691 {
688 // nope! bump and wrap the counter, then return 692 // nope! bump and wrap the counter, then return
@@ -704,6 +708,11 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
704 // otherwise, walk from mCurrentCircuit->mPacketsInID to id with wrapping, adding the values to the map 708 // otherwise, walk from mCurrentCircuit->mPacketsInID to id with wrapping, adding the values to the map
705 // and setting mPacketsInID to id + 1 % LL_MAX_OUT_PACKET_ID 709 // and setting mPacketsInID to id + 1 % LL_MAX_OUT_PACKET_ID
706 710
711 // babbage: all operands in expression are unsigned, so modular
712 // arithmetic will always find correct gap, regardless of wrap arounds.
713 const U8 width = 24;
714 gap = LLModularMath::subtract<width>(mPacketsInID, id);
715
707 if (mPotentialLostPackets.find(id) != mPotentialLostPackets.end()) 716 if (mPotentialLostPackets.find(id) != mPotentialLostPackets.end())
708 { 717 {
709 if(gMessageSystem->mVerboseLog) 718 if(gMessageSystem->mVerboseLog)
@@ -765,6 +774,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
765 774
766 } 775 }
767 } 776 }
777 mOutOfOrderRate.count(gap);
778 mLastPacketGap = gap;
768} 779}
769 780
770 781
diff --git a/linden/indra/llmessage/llcircuit.h b/linden/indra/llmessage/llcircuit.h
index 552b50f..3b9df02 100644
--- a/linden/indra/llmessage/llcircuit.h
+++ b/linden/indra/llmessage/llcircuit.h
@@ -45,6 +45,7 @@
45#include "llpacketack.h" 45#include "llpacketack.h"
46#include "lluuid.h" 46#include "lluuid.h"
47#include "llthrottle.h" 47#include "llthrottle.h"
48#include "llstat.h"
48 49
49// 50//
50// Constants 51// Constants
@@ -133,6 +134,10 @@ public:
133 S32 getUnackedPacketCount() const { return mUnackedPacketCount; } 134 S32 getUnackedPacketCount() const { return mUnackedPacketCount; }
134 S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; } 135 S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; }
135 F64 getNextPingSendTime() const { return mNextPingSendTime; } 136 F64 getNextPingSendTime() const { return mNextPingSendTime; }
137 F32 getOutOfOrderRate(LLStatAccum::TimeScale scale = LLStatAccum::SCALE_MINUTE)
138 { return mOutOfOrderRate.meanValue(scale); }
139 U32 getLastPacketGap() const { return mLastPacketGap; }
140 LLHost getHost() const { return mHost; }
136 141
137 LLThrottleGroup &getThrottleGroup() { return mThrottles; } 142 LLThrottleGroup &getThrottleGroup() { return mThrottles; }
138 143
@@ -276,6 +281,8 @@ protected:
276 LLTimer mExistenceTimer; // initialized when circuit created, used to track bandwidth numbers 281 LLTimer mExistenceTimer; // initialized when circuit created, used to track bandwidth numbers
277 282
278 S32 mCurrentResendCount; // Number of resent packets since last spam 283 S32 mCurrentResendCount; // Number of resent packets since last spam
284 LLStatRate mOutOfOrderRate; // Rate of out of order packets coming in.
285 U32 mLastPacketGap; // Gap in sequence number of last packet.
279}; 286};
280 287
281 288
diff --git a/linden/indra/llmessage/llcurl.cpp b/linden/indra/llmessage/llcurl.cpp
index 834ec4b..167e237 100644
--- a/linden/indra/llmessage/llcurl.cpp
+++ b/linden/indra/llmessage/llcurl.cpp
@@ -265,6 +265,10 @@ LLCurl::Easy* LLCurl::Easy::getEasy()
265 delete easy; 265 delete easy;
266 return NULL; 266 return NULL;
267 } 267 }
268
269 // set no DMS caching as default for all easy handles. This prevents them adopting a
270 // multi handles cache if they are added to one.
271 curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
268 ++gCurlEasyCount; 272 ++gCurlEasyCount;
269 return easy; 273 return easy;
270} 274}
@@ -747,7 +751,7 @@ bool LLCurlRequest::post(const std::string& url, const LLSD& data, LLCurl::Respo
747 easy->setopt(CURLOPT_POSTFIELDS, (void*)NULL); 751 easy->setopt(CURLOPT_POSTFIELDS, (void*)NULL);
748 easy->setopt(CURLOPT_POSTFIELDSIZE, bytes); 752 easy->setopt(CURLOPT_POSTFIELDSIZE, bytes);
749 753
750 easy->slist_append("Content-Type: application/xml"); 754 easy->slist_append("Content-Type: application/llsd+xml");
751 easy->setHeaders(); 755 easy->setHeaders();
752 756
753 lldebugs << "POSTING: " << bytes << " bytes." << llendl; 757 lldebugs << "POSTING: " << bytes << " bytes." << llendl;
diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp
index fdd521f..6d5a716 100644
--- a/linden/indra/llmessage/llhttpassetstorage.cpp
+++ b/linden/indra/llmessage/llhttpassetstorage.cpp
@@ -256,6 +256,10 @@ void LLHTTPAssetRequest::setupCurlHandle()
256 // disable use of proxy, which can't handle chunked transfers 256 // disable use of proxy, which can't handle chunked transfers
257 } 257 }
258 mHTTPHeaders = curl_slist_append(mHTTPHeaders, "Pragma:"); 258 mHTTPHeaders = curl_slist_append(mHTTPHeaders, "Pragma:");
259
260 // bug in curl causes DNS to be cached for too long a time, 0 sets it to never cache DNS results internally (to curl)
261 curl_easy_setopt(mCurlHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
262
259 // resist the temptation to explicitly add the Transfer-Encoding: chunked 263 // resist the temptation to explicitly add the Transfer-Encoding: chunked
260 // header here - invokes a libCURL bug 264 // header here - invokes a libCURL bug
261 curl_easy_setopt(mCurlHandle, CURLOPT_HTTPHEADER, mHTTPHeaders); 265 curl_easy_setopt(mCurlHandle, CURLOPT_HTTPHEADER, mHTTPHeaders);
diff --git a/linden/indra/llmessage/llhttpclient.cpp b/linden/indra/llmessage/llhttpclient.cpp
index fc2612f..fb43861 100644
--- a/linden/indra/llmessage/llhttpclient.cpp
+++ b/linden/indra/llmessage/llhttpclient.cpp
@@ -106,7 +106,7 @@ namespace
106 LLSDInjector(const LLSD& sd) : mSD(sd) {} 106 LLSDInjector(const LLSD& sd) : mSD(sd) {}
107 virtual ~LLSDInjector() {} 107 virtual ~LLSDInjector() {}
108 108
109 const char* contentType() { return "application/xml"; } 109 const char* contentType() { return "application/llsd+xml"; }
110 110
111 virtual EStatus process_impl(const LLChannelDescriptors& channels, 111 virtual EStatus process_impl(const LLChannelDescriptors& channels,
112 buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump) 112 buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump)
@@ -238,7 +238,8 @@ static void request(
238 //the Pragma header it so gratuitously inserts 238 //the Pragma header it so gratuitously inserts
239 //Before inserting the header, force libcurl 239 //Before inserting the header, force libcurl
240 //to not use the proxy (read: llurlrequest.cpp) 240 //to not use the proxy (read: llurlrequest.cpp)
241 if ((iter->first == "Pragma") && (iter->second.asString() == "")) 241 static const std::string PRAGMA("Pragma");
242 if ((iter->first == PRAGMA) && (iter->second.asString().empty()))
242 { 243 {
243 req->useProxy(false); 244 req->useProxy(false);
244 } 245 }
@@ -247,6 +248,19 @@ static void request(
247 req->addHeader(header.str().c_str()); 248 req->addHeader(header.str().c_str());
248 } 249 }
249 } 250 }
251
252 // Check to see if we have already set Accept or not. If no one
253 // set it, set it to application/llsd+xml since that's what we
254 // almost always want.
255 if( method != LLURLRequest::HTTP_PUT && method != LLURLRequest::HTTP_POST )
256 {
257 static const std::string ACCEPT("Accept");
258 if(!headers.has(ACCEPT))
259 {
260 req->addHeader("Accept: application/llsd+xml");
261 }
262 }
263
250 req->setCallback(new LLHTTPClientURLAdaptor(responder)); 264 req->setCallback(new LLHTTPClientURLAdaptor(responder));
251 265
252 if (method == LLURLRequest::HTTP_POST && gMessageSystem) 266 if (method == LLURLRequest::HTTP_POST && gMessageSystem)
@@ -254,12 +268,22 @@ static void request(
254 req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d", 268 req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d",
255 gMessageSystem->mPort).c_str()); 269 gMessageSystem->mPort).c_str());
256 } 270 }
257 271
258 if (method == LLURLRequest::HTTP_PUT || method == LLURLRequest::HTTP_POST) 272 if (method == LLURLRequest::HTTP_PUT || method == LLURLRequest::HTTP_POST)
259 { 273 {
260 req->addHeader(llformat("Content-Type: %s", 274 static const std::string CONTENT_TYPE("Content-Type");
261 body_injector->contentType()).c_str()); 275 if(!headers.has(CONTENT_TYPE))
262 276 {
277 // If the Content-Type header was passed in, it has
278 // already been added as a header through req->addHeader
279 // in the loop above. We defer to the caller's wisdom, but
280 // if they did not specify a Content-Type, then ask the
281 // injector.
282 req->addHeader(
283 llformat(
284 "Content-Type: %s",
285 body_injector->contentType()).c_str());
286 }
263 chain.push_back(LLIOPipe::ptr_t(body_injector)); 287 chain.push_back(LLIOPipe::ptr_t(body_injector));
264 } 288 }
265 289
diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp
index d4155f6..64222ff 100644
--- a/linden/indra/llmessage/lliohttpserver.cpp
+++ b/linden/indra/llmessage/lliohttpserver.cpp
@@ -47,6 +47,7 @@
47#include "llpumpio.h" 47#include "llpumpio.h"
48#include "llsd.h" 48#include "llsd.h"
49#include "llsdserialize_xml.h" 49#include "llsdserialize_xml.h"
50#include "llstat.h"
50#include "llstl.h" 51#include "llstl.h"
51#include "lltimer.h" 52#include "lltimer.h"
52 53
@@ -171,22 +172,26 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
171 std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB]; 172 std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB];
172 if(verb == HTTP_VERB_GET) 173 if(verb == HTTP_VERB_GET)
173 { 174 {
175 LLPerfBlock getblock("http_get");
174 mNode.get(LLHTTPNode::ResponsePtr(mResponse), context); 176 mNode.get(LLHTTPNode::ResponsePtr(mResponse), context);
175 } 177 }
176 else if(verb == HTTP_VERB_PUT) 178 else if(verb == HTTP_VERB_PUT)
177 { 179 {
180 LLPerfBlock putblock("http_put");
178 LLSD input; 181 LLSD input;
179 LLSDSerialize::fromXML(input, istr); 182 LLSDSerialize::fromXML(input, istr);
180 mNode.put(LLHTTPNode::ResponsePtr(mResponse), context, input); 183 mNode.put(LLHTTPNode::ResponsePtr(mResponse), context, input);
181 } 184 }
182 else if(verb == HTTP_VERB_POST) 185 else if(verb == HTTP_VERB_POST)
183 { 186 {
187 LLPerfBlock postblock("http_post");
184 LLSD input; 188 LLSD input;
185 LLSDSerialize::fromXML(input, istr); 189 LLSDSerialize::fromXML(input, istr);
186 mNode.post(LLHTTPNode::ResponsePtr(mResponse), context, input); 190 mNode.post(LLHTTPNode::ResponsePtr(mResponse), context, input);
187 } 191 }
188 else if(verb == HTTP_VERB_DELETE) 192 else if(verb == HTTP_VERB_DELETE)
189 { 193 {
194 LLPerfBlock delblock("http_delete");
190 mNode.del(LLHTTPNode::ResponsePtr(mResponse), context); 195 mNode.del(LLHTTPNode::ResponsePtr(mResponse), context);
191 } 196 }
192 else if(verb == HTTP_VERB_OPTIONS) 197 else if(verb == HTTP_VERB_OPTIONS)
@@ -240,7 +245,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
240 case STATE_GOOD_RESULT: 245 case STATE_GOOD_RESULT:
241 { 246 {
242 LLSD headers = mHeaders; 247 LLSD headers = mHeaders;
243 headers["Content-Type"] = "application/xml"; 248 headers["Content-Type"] = "application/llsd+xml";
244 context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers; 249 context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers;
245 LLBufferStream ostr(channels, buffer.get()); 250 LLBufferStream ostr(channels, buffer.get());
246 LLSDSerialize::toXML(mGoodResult, ostr); 251 LLSDSerialize::toXML(mGoodResult, ostr);
diff --git a/linden/indra/llmessage/lliosocket.cpp b/linden/indra/llmessage/lliosocket.cpp
index dec83b0..28fee37 100644
--- a/linden/indra/llmessage/lliosocket.cpp
+++ b/linden/indra/llmessage/lliosocket.cpp
@@ -355,8 +355,11 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl(
355 } 355 }
356 else if(APR_STATUS_IS_EAGAIN(status)) 356 else if(APR_STATUS_IS_EAGAIN(status))
357 { 357 {
358/*Commented out by Aura 9-9-8 for DEV-19961.
358 // everything is fine, but we can terminate this process pump. 359 // everything is fine, but we can terminate this process pump.
360
359 rv = STATUS_BREAK; 361 rv = STATUS_BREAK;
362*/
360 } 363 }
361 else 364 else
362 { 365 {
diff --git a/linden/indra/llmessage/llmail.cpp b/linden/indra/llmessage/llmail.cpp
index 8ae7206..181f378 100644
--- a/linden/indra/llmessage/llmail.cpp
+++ b/linden/indra/llmessage/llmail.cpp
@@ -51,6 +51,7 @@
51#include "llblowfishcipher.h" 51#include "llblowfishcipher.h"
52#include "llerror.h" 52#include "llerror.h"
53#include "llhost.h" 53#include "llhost.h"
54#include "llsd.h"
54#include "llstring.h" 55#include "llstring.h"
55#include "lluuid.h" 56#include "lluuid.h"
56#include "net.h" 57#include "net.h"
@@ -111,16 +112,22 @@ void disconnect_smtp()
111// Returns TRUE on success. 112// Returns TRUE on success.
112// message should NOT be SMTP escaped. 113// message should NOT be SMTP escaped.
113// static 114// static
114BOOL LLMail::send(const char* from_name, const char* from_address, 115BOOL LLMail::send(
115 const char* to_name, const char* to_address, 116 const char* from_name,
116 const char* subject, const char* message) 117 const char* from_address,
118 const char* to_name,
119 const char* to_address,
120 const char* subject,
121 const char* message,
122 const LLSD& headers)
117{ 123{
118 std::string header = buildSMTPTransaction( 124 std::string header = buildSMTPTransaction(
119 from_name, 125 from_name,
120 from_address, 126 from_address,
121 to_name, 127 to_name,
122 to_address, 128 to_address,
123 subject); 129 subject,
130 headers);
124 if(header.empty()) 131 if(header.empty())
125 { 132 {
126 return FALSE; 133 return FALSE;
@@ -192,7 +199,8 @@ std::string LLMail::buildSMTPTransaction(
192 const char* from_address, 199 const char* from_address,
193 const char* to_name, 200 const char* to_name,
194 const char* to_address, 201 const char* to_address,
195 const char* subject) 202 const char* subject,
203 const LLSD& headers)
196{ 204{
197 if(!from_address || !to_address) 205 if(!from_address || !to_address)
198 { 206 {
@@ -236,8 +244,20 @@ std::string LLMail::buildSMTPTransaction(
236 << "DATA\r\n" 244 << "DATA\r\n"
237 << "From: " << from_fmt.str() << "\r\n" 245 << "From: " << from_fmt.str() << "\r\n"
238 << "To: " << to_fmt.str() << "\r\n" 246 << "To: " << to_fmt.str() << "\r\n"
239 << "Subject: " << subject << "\r\n" 247 << "Subject: " << subject << "\r\n";
240 << "\r\n"; 248
249 if(headers.isMap())
250 {
251 LLSD::map_const_iterator iter = headers.beginMap();
252 LLSD::map_const_iterator end = headers.endMap();
253 for(; iter != end; ++iter)
254 {
255 header << (*iter).first << ": " << ((*iter).second).asString()
256 << "\r\n";
257 }
258 }
259
260 header << "\r\n";
241 return header.str(); 261 return header.str();
242} 262}
243 263
@@ -324,7 +344,7 @@ bool LLMail::send(
324 << "when sending messages larger than " << LL_MAX_KNOWN_GOOD_MAIL_SIZE 344 << "when sending messages larger than " << LL_MAX_KNOWN_GOOD_MAIL_SIZE
325 << " bytes. The next log about success is potentially a lie." << llendl; 345 << " bytes. The next log about success is potentially a lie." << llendl;
326 } 346 }
327 llinfos << "send_mail success: " 347 lldebugs << "send_mail success: "
328 << "to=<" << to_address 348 << "to=<" << to_address
329 << ">, from=<" << from_address << ">" 349 << ">, from=<" << from_address << ">"
330 << ", bytes=" << original_size 350 << ", bytes=" << original_size
diff --git a/linden/indra/llmessage/llmail.h b/linden/indra/llmessage/llmail.h
index 86b7793..018e180 100644
--- a/linden/indra/llmessage/llmail.h
+++ b/linden/indra/llmessage/llmail.h
@@ -34,7 +34,7 @@
34 34
35typedef struct apr_pool_t apr_pool_t; 35typedef struct apr_pool_t apr_pool_t;
36 36
37class LLUUID; 37#include "llsd.h"
38 38
39class LLMail 39class LLMail
40{ 40{
@@ -45,34 +45,51 @@ public:
45 // Allow all email transmission to be disabled/enabled. 45 // Allow all email transmission to be disabled/enabled.
46 static void enable(bool mail_enabled); 46 static void enable(bool mail_enabled);
47 47
48 // returns TRUE if the call succeeds, FALSE otherwise. 48 /**
49 // 49 * @brief send an email
50 // Results in: 50 * @param from_name The name of the email sender
51 // From: "from_name" <from_address> 51 * @param from_address The email address for the sender
52 // To: "to_name" <to_address> 52 * @param to_name The name of the email recipient
53 // Subject: subject 53 * @param to_address The email recipient address
54 // message 54 * @param subject The subject of the email
55 static BOOL send(const char* from_name, const char* from_address, 55 * @param headers optional X-Foo headers in an llsd map.
56 const char* to_name, const char* to_address, 56 * @return Returns TRUE if the call succeeds, FALSE otherwise.
57 const char* subject, const char* message); 57 *
58 * Results in:
59 * From: "from_name" <from_address>
60 * To: "to_name" <to_address>
61 * Subject: subject
62 *
63 * message
64 */
65 static BOOL send(
66 const char* from_name,
67 const char* from_address,
68 const char* to_name,
69 const char* to_address,
70 const char* subject,
71 const char* message,
72 const LLSD& headers = LLSD());
58 73
59 /** 74 /**
60 * @brief build the complete smtp transaction & header for use in an 75 * @brief build the complete smtp transaction & header for use in an
61 * mail. 76 * mail.
62 * 77 *
63 * @param from_name The name of the email sender 78 * @param from_name The name of the email sender
64 * @param from_address The email address for the sender 79 * @param from_address The email address for the sender
65 * @param to_name The name of the email recipient 80 * @param to_name The name of the email recipient
66 * @param to_name The email recipient address 81 * @param to_address The email recipient address
67 * @param subject The subject of the email 82 * @param subject The subject of the email
68 * @return Returns the complete SMTP transaction mail header. 83 * @param headers optional X-Foo headers in an llsd map.
69 */ 84 * @return Returns the complete SMTP transaction mail header.
85 */
70 static std::string buildSMTPTransaction( 86 static std::string buildSMTPTransaction(
71 const char* from_name, 87 const char* from_name,
72 const char* from_address, 88 const char* from_address,
73 const char* to_name, 89 const char* to_name,
74 const char* to_address, 90 const char* to_address,
75 const char* subject); 91 const char* subject,
92 const LLSD& headers = LLSD());
76 93
77 /** 94 /**
78 * @brief send an email with header and body. 95 * @brief send an email with header and body.
diff --git a/linden/indra/llmessage/llmessagetemplate.cpp b/linden/indra/llmessage/llmessagetemplate.cpp
index 4a560ca..ff44d45 100644
--- a/linden/indra/llmessage/llmessagetemplate.cpp
+++ b/linden/indra/llmessage/llmessagetemplate.cpp
@@ -50,7 +50,7 @@ void LLMsgVarData::addData(const void *data, S32 size, EMsgVariableType type, S3
50 } 50 }
51 if(size) 51 if(size)
52 { 52 {
53 delete mData; // Delete it if it already exists 53 delete[] mData; // Delete it if it already exists
54 mData = new U8[size]; 54 mData = new U8[size];
55 htonmemcpy(mData, data, mType, size); 55 htonmemcpy(mData, data, mType, size);
56 } 56 }
@@ -175,3 +175,23 @@ std::ostream& operator<<(std::ostream& s, LLMessageTemplate &msg)
175 175
176 return s; 176 return s;
177} 177}
178
179void LLMessageTemplate::banUdp()
180{
181 static const char* deprecation[] = {
182 "NotDeprecated",
183 "Deprecated",
184 "UDPDeprecated",
185 "UDPBlackListed"
186 };
187 if (mDeprecation != MD_DEPRECATED)
188 {
189 llinfos << "Setting " << mName << " to UDPBlackListed was " << deprecation[mDeprecation] << llendl;
190 mDeprecation = MD_UDPBLACKLISTED;
191 }
192 else
193 {
194 llinfos << mName << " is already more deprecated than UDPBlackListed" << llendl;
195 }
196}
197
diff --git a/linden/indra/llmessage/llmessagetemplate.h b/linden/indra/llmessage/llmessagetemplate.h
index 716c618..445d1a8 100644
--- a/linden/indra/llmessage/llmessagetemplate.h
+++ b/linden/indra/llmessage/llmessagetemplate.h
@@ -34,6 +34,7 @@
34 34
35#include "lldarray.h" 35#include "lldarray.h"
36#include "message.h" // TODO: babbage: Remove... 36#include "message.h" // TODO: babbage: Remove...
37#include "llstat.h"
37#include "llstl.h" 38#include "llstl.h"
38 39
39class LLMsgVarData 40class LLMsgVarData
@@ -370,20 +371,23 @@ public:
370 { 371 {
371 if (mHandlerFunc) 372 if (mHandlerFunc)
372 { 373 {
374 LLPerfBlock msg_cb_time("msg_cb", mName);
373 mHandlerFunc(msgsystem, mUserData); 375 mHandlerFunc(msgsystem, mUserData);
374 return TRUE; 376 return TRUE;
375 } 377 }
376 return FALSE; 378 return FALSE;
377 } 379 }
378 380
379 bool isBanned(bool trustedSource) const 381 bool isUdpBanned() const
380 { 382 {
381 return trustedSource ? mBanFromTrusted : mBanFromUntrusted; 383 return mDeprecation == MD_UDPBLACKLISTED;
382 } 384 }
383 385
384 bool isUdpBanned() const 386 void banUdp();
387
388 bool isBanned(bool trustedSource) const
385 { 389 {
386 return mDeprecation == MD_UDPBLACKLISTED; 390 return trustedSource ? mBanFromTrusted : mBanFromUntrusted;
387 } 391 }
388 392
389 friend std::ostream& operator<<(std::ostream& s, LLMessageTemplate &msg); 393 friend std::ostream& operator<<(std::ostream& s, LLMessageTemplate &msg);
diff --git a/linden/indra/llmessage/llnamevalue.cpp b/linden/indra/llmessage/llnamevalue.cpp
index c44f6ce..f661261 100644
--- a/linden/indra/llmessage/llnamevalue.cpp
+++ b/linden/indra/llmessage/llnamevalue.cpp
@@ -896,7 +896,7 @@ void LLNameValue::setVec3(const LLVector3 &a)
896} 896}
897 897
898 898
899std::string LLNameValue::printNameValue() 899std::string LLNameValue::printNameValue() const
900{ 900{
901 std::string buffer; 901 std::string buffer;
902 buffer = llformat("%s %s %s %s ", mName, mStringType, mStringClass, mStringSendto); 902 buffer = llformat("%s %s %s %s ", mName, mStringType, mStringClass, mStringSendto);
@@ -905,7 +905,7 @@ std::string LLNameValue::printNameValue()
905 return buffer; 905 return buffer;
906} 906}
907 907
908std::string LLNameValue::printData() 908std::string LLNameValue::printData() const
909{ 909{
910 std::string buffer; 910 std::string buffer;
911 switch(mType) 911 switch(mType)
diff --git a/linden/indra/llmessage/llnamevalue.h b/linden/indra/llmessage/llnamevalue.h
index 52beb07..f6c5040 100644
--- a/linden/indra/llmessage/llnamevalue.h
+++ b/linden/indra/llmessage/llnamevalue.h
@@ -148,8 +148,8 @@ public:
148 BOOL sendToViewer() const; 148 BOOL sendToViewer() const;
149 149
150 void callCallback(); 150 void callCallback();
151 std::string printNameValue(); 151 std::string printNameValue() const;
152 std::string printData(); 152 std::string printData() const;
153 153
154 ENameValueType getTypeEnum() const { return mType; } 154 ENameValueType getTypeEnum() const { return mType; }
155 ENameValueClass getClassEnum() const { return mClass; } 155 ENameValueClass getClassEnum() const { return mClass; }
diff --git a/linden/indra/llmessage/llpartdata.h b/linden/indra/llmessage/llpartdata.h
index 82757ec..58a1fae 100644
--- a/linden/indra/llmessage/llpartdata.h
+++ b/linden/indra/llmessage/llpartdata.h
@@ -114,6 +114,7 @@ public:
114 //LL_PART_TRAIL_MASK = 0x400, // Particles have historical "trails" 114 //LL_PART_TRAIL_MASK = 0x400, // Particles have historical "trails"
115 115
116 // Viewer side use only! 116 // Viewer side use only!
117 LL_PART_HUD = 0x40000000,
117 LL_PART_DEAD_MASK = 0x80000000, 118 LL_PART_DEAD_MASK = 0x80000000,
118 }; 119 };
119 120
diff --git a/linden/indra/llmessage/llpumpio.cpp b/linden/indra/llmessage/llpumpio.cpp
index c92612f..467502b 100644
--- a/linden/indra/llmessage/llpumpio.cpp
+++ b/linden/indra/llmessage/llpumpio.cpp
@@ -41,6 +41,7 @@
41#include "llapr.h" 41#include "llapr.h"
42#include "llmemtype.h" 42#include "llmemtype.h"
43#include "llstl.h" 43#include "llstl.h"
44#include "llstat.h"
44 45
45// These should not be enabled in production, but they can be 46// These should not be enabled in production, but they can be
46// intensely useful during development for finding certain kinds of 47// intensely useful during development for finding certain kinds of
@@ -176,7 +177,8 @@ LLPumpIO::LLPumpIO(apr_pool_t* pool) :
176 mCurrentPool(NULL), 177 mCurrentPool(NULL),
177 mCurrentPoolReallocCount(0), 178 mCurrentPoolReallocCount(0),
178 mChainsMutex(NULL), 179 mChainsMutex(NULL),
179 mCallbackMutex(NULL) 180 mCallbackMutex(NULL),
181 mCurrentChain(mRunningChains.end())
180{ 182{
181 LLMemType m1(LLMemType::MTYPE_IO_PUMP); 183 LLMemType m1(LLMemType::MTYPE_IO_PUMP);
182 initialize(pool); 184 initialize(pool);
@@ -269,6 +271,16 @@ bool LLPumpIO::setTimeoutSeconds(F32 timeout)
269 return true; 271 return true;
270} 272}
271 273
274void LLPumpIO::adjustTimeoutSeconds(F32 delta)
275{
276 // If no chain is running, bail
277 if(mRunningChains.end() == mCurrentChain)
278 {
279 return;
280 }
281 (*mCurrentChain).adjustTimeoutSeconds(delta);
282}
283
272static std::string events_2_string(apr_int16_t events) 284static std::string events_2_string(apr_int16_t events)
273{ 285{
274 std::ostringstream ostr; 286 std::ostringstream ostr;
@@ -514,7 +526,10 @@ void LLPumpIO::pump(const S32& poll_timeout)
514 //llinfos << "polling" << llendl; 526 //llinfos << "polling" << llendl;
515 S32 count = 0; 527 S32 count = 0;
516 S32 client_id = 0; 528 S32 client_id = 0;
517 apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd); 529 {
530 LLPerfBlock polltime("pump_poll");
531 apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd);
532 }
518 PUMP_DEBUG; 533 PUMP_DEBUG;
519 for(S32 ii = 0; ii < count; ++ii) 534 for(S32 ii = 0; ii < count; ++ii)
520 { 535 {
@@ -1161,3 +1176,14 @@ void LLPumpIO::LLChainInfo::setTimeoutSeconds(F32 timeout)
1161 mTimer.stop(); 1176 mTimer.stop();
1162 } 1177 }
1163} 1178}
1179
1180void LLPumpIO::LLChainInfo::adjustTimeoutSeconds(F32 delta)
1181{
1182 LLMemType m1(LLMemType::MTYPE_IO_PUMP);
1183 if(mTimer.getStarted())
1184 {
1185 F64 expiry = mTimer.expiresAt();
1186 expiry += delta;
1187 mTimer.setExpiryAt(expiry);
1188 }
1189}
diff --git a/linden/indra/llmessage/llpumpio.h b/linden/indra/llmessage/llpumpio.h
index d2392a3..daff723 100644
--- a/linden/indra/llmessage/llpumpio.h
+++ b/linden/indra/llmessage/llpumpio.h
@@ -166,6 +166,14 @@ public:
166 bool setTimeoutSeconds(F32 timeout); 166 bool setTimeoutSeconds(F32 timeout);
167 167
168 /** 168 /**
169 * @brief Adjust the timeout of the running chain.
170 *
171 * This method has no effect if there is no timeout on the chain.
172 * @param delta The number of seconds to add to/remove from the timeout.
173 */
174 void adjustTimeoutSeconds(F32 delta);
175
176 /**
169 * @brief Set up file descriptors for for the running chain. 177 * @brief Set up file descriptors for for the running chain.
170 * @see rebuildPollset() 178 * @see rebuildPollset()
171 * 179 *
@@ -349,6 +357,7 @@ protected:
349 // methods 357 // methods
350 LLChainInfo(); 358 LLChainInfo();
351 void setTimeoutSeconds(F32 timeout); 359 void setTimeoutSeconds(F32 timeout);
360 void adjustTimeoutSeconds(F32 delta);
352 361
353 // basic member data 362 // basic member data
354 bool mInit; 363 bool mInit;
diff --git a/linden/indra/llmessage/llqueryflags.h b/linden/indra/llmessage/llqueryflags.h
index 1d8d500..6740d46 100644
--- a/linden/indra/llmessage/llqueryflags.h
+++ b/linden/indra/llmessage/llqueryflags.h
@@ -38,7 +38,7 @@
38const U32 DFQ_PEOPLE = 0x1 << 0; 38const U32 DFQ_PEOPLE = 0x1 << 0;
39const U32 DFQ_ONLINE = 0x1 << 1; 39const U32 DFQ_ONLINE = 0x1 << 1;
40//const U32 DFQ_PLACES = 0x1 << 2; 40//const U32 DFQ_PLACES = 0x1 << 2;
41const U32 DFQ_EVENTS = 0x1 << 3; 41const U32 DFQ_EVENTS = 0x1 << 3; // This is not set by the 1.21 viewer, but I don't know about older versions. JC
42const U32 DFQ_GROUPS = 0x1 << 4; 42const U32 DFQ_GROUPS = 0x1 << 4;
43const U32 DFQ_DATE_EVENTS = 0x1 << 5; 43const U32 DFQ_DATE_EVENTS = 0x1 << 5;
44 44
diff --git a/linden/indra/llmessage/llurlrequest.cpp b/linden/indra/llmessage/llurlrequest.cpp
index ee62798..e561597 100644
--- a/linden/indra/llmessage/llurlrequest.cpp
+++ b/linden/indra/llmessage/llurlrequest.cpp
@@ -68,6 +68,7 @@ public:
68 LLChannelDescriptors mChannels; 68 LLChannelDescriptors mChannels;
69 U8* mLastRead; 69 U8* mLastRead;
70 U32 mBodyLimit; 70 U32 mBodyLimit;
71 S32 mByteAccumulator;
71 bool mIsBodyLimitSet; 72 bool mIsBodyLimitSet;
72}; 73};
73 74
@@ -76,8 +77,8 @@ LLURLRequestDetail::LLURLRequestDetail() :
76 mResponseBuffer(NULL), 77 mResponseBuffer(NULL),
77 mLastRead(NULL), 78 mLastRead(NULL),
78 mBodyLimit(0), 79 mBodyLimit(0),
80 mByteAccumulator(0),
79 mIsBodyLimitSet(false) 81 mIsBodyLimitSet(false)
80
81{ 82{
82 LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); 83 LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
83 mCurlRequest = new LLCurlEasyRequest(); 84 mCurlRequest = new LLCurlEasyRequest();
@@ -264,8 +265,25 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
264 { 265 {
265 CURLcode result; 266 CURLcode result;
266 bool newmsg = mDetail->mCurlRequest->getResult(&result); 267 bool newmsg = mDetail->mCurlRequest->getResult(&result);
267 if (!newmsg) 268 if(!newmsg)
268 { 269 {
270 // we're still waiting or prcessing, check how many
271 // bytes we have accumulated.
272 const S32 MIN_ACCUMULATION = 100000;
273 if(pump && (mDetail->mByteAccumulator > MIN_ACCUMULATION))
274 {
275 // This is a pretty sloppy calculation, but this
276 // tries to make the gross assumption that if data
277 // is coming in at 56kb/s, then this transfer will
278 // probably succeed. So, if we're accumlated
279 // 100,000 bytes (MIN_ACCUMULATION) then let's
280 // give this client another 2s to complete.
281 const F32 TIMEOUT_ADJUSTMENT = 2.0f;
282 mDetail->mByteAccumulator = 0;
283 pump->adjustTimeoutSeconds(TIMEOUT_ADJUSTMENT);
284 }
285
286 // keep processing
269 break; 287 break;
270 } 288 }
271 289
@@ -434,6 +452,7 @@ size_t LLURLRequest::downCallback(
434 req->mDetail->mChannels.out(), 452 req->mDetail->mChannels.out(),
435 (U8*)data, 453 (U8*)data,
436 bytes); 454 bytes);
455 req->mDetail->mByteAccumulator += bytes;
437 return bytes; 456 return bytes;
438} 457}
439 458
diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp
index b20731a..9ca7211 100644
--- a/linden/indra/llmessage/message.cpp
+++ b/linden/indra/llmessage/message.cpp
@@ -763,7 +763,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
763 clearReceiveState(); 763 clearReceiveState();
764 valid_packet = FALSE; 764 valid_packet = FALSE;
765 } 765 }
766 766
767 if( valid_packet ) 767 if( valid_packet )
768 { 768 {
769 logValidMsg(cdp, host, recv_reliable, recv_resent, (BOOL)(acks>0) ); 769 logValidMsg(cdp, host, recv_reliable, recv_resent, (BOOL)(acks>0) );
@@ -3956,22 +3956,27 @@ void LLMessageSystem::getString(const char *block, const char *var,
3956 blocknum); 3956 blocknum);
3957} 3957}
3958 3958
3959S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) 3959BOOL LLMessageSystem::has(const char *blockname) const
3960{
3961 return getNumberOfBlocks(blockname) > 0;
3962}
3963
3964S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) const
3960{ 3965{
3961 return mMessageReader->getNumberOfBlocks(blockname); 3966 return mMessageReader->getNumberOfBlocks(blockname);
3962} 3967}
3963 3968
3964S32 LLMessageSystem::getNumberOfBlocks(const char *blockname) 3969S32 LLMessageSystem::getNumberOfBlocks(const char *blockname) const
3965{ 3970{
3966 return getNumberOfBlocksFast(LLMessageStringTable::getInstance()->getString(blockname)); 3971 return getNumberOfBlocksFast(LLMessageStringTable::getInstance()->getString(blockname));
3967} 3972}
3968 3973
3969S32 LLMessageSystem::getSizeFast(const char *blockname, const char *varname) 3974S32 LLMessageSystem::getSizeFast(const char *blockname, const char *varname) const
3970{ 3975{
3971 return mMessageReader->getSize(blockname, varname); 3976 return mMessageReader->getSize(blockname, varname);
3972} 3977}
3973 3978
3974S32 LLMessageSystem::getSize(const char *blockname, const char *varname) 3979S32 LLMessageSystem::getSize(const char *blockname, const char *varname) const
3975{ 3980{
3976 return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), 3981 return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname),
3977 LLMessageStringTable::getInstance()->getString(varname)); 3982 LLMessageStringTable::getInstance()->getString(varname));
@@ -3979,13 +3984,13 @@ S32 LLMessageSystem::getSize(const char *blockname, const char *varname)
3979 3984
3980// size in bytes of variable length data 3985// size in bytes of variable length data
3981S32 LLMessageSystem::getSizeFast(const char *blockname, S32 blocknum, 3986S32 LLMessageSystem::getSizeFast(const char *blockname, S32 blocknum,
3982 const char *varname) 3987 const char *varname) const
3983{ 3988{
3984 return mMessageReader->getSize(blockname, blocknum, varname); 3989 return mMessageReader->getSize(blockname, blocknum, varname);
3985} 3990}
3986 3991
3987S32 LLMessageSystem::getSize(const char *blockname, S32 blocknum, 3992S32 LLMessageSystem::getSize(const char *blockname, S32 blocknum,
3988 const char *varname) 3993 const char *varname) const
3989{ 3994{
3990 return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), blocknum, 3995 return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), blocknum,
3991 LLMessageStringTable::getInstance()->getString(varname)); 3996 LLMessageStringTable::getInstance()->getString(varname));
@@ -4021,3 +4026,18 @@ bool LLMessageSystem::checkAllMessages(S64 frame_count, LLPumpIO* http_pump)
4021 http_pump->callback(); 4026 http_pump->callback();
4022 return (mPacketsIn - packetsIn) > 0; 4027 return (mPacketsIn - packetsIn) > 0;
4023} 4028}
4029
4030void LLMessageSystem::banUdpMessage(const std::string& name)
4031{
4032 message_template_name_map_t::iterator itt = mMessageTemplates.find(
4033 LLMessageStringTable::getInstance()->getString(name.c_str())
4034 );
4035 if(itt != mMessageTemplates.end())
4036 {
4037 itt->second->banUdp();
4038 }
4039 else
4040 {
4041 llwarns << "Attempted to ban an unknown message: " << name << "." << llendl;
4042 }
4043}
diff --git a/linden/indra/llmessage/message.h b/linden/indra/llmessage/message.h
index 8807521..b72aa9a 100644
--- a/linden/indra/llmessage/message.h
+++ b/linden/indra/llmessage/message.h
@@ -562,6 +562,9 @@ public:
562 /** Return false true if name is unknown or trusted */ 562 /** Return false true if name is unknown or trusted */
563 bool isUntrustedMessage(const std::string& name) const; 563 bool isUntrustedMessage(const std::string& name) const;
564 564
565 // Change this message to be UDP black listed.
566 void banUdpMessage(const std::string& name);
567
565private: 568private:
566 // A list of the circuits that need to be sent DenyTrustedCircuit messages. 569 // A list of the circuits that need to be sent DenyTrustedCircuit messages.
567 typedef std::set<LLHost> host_set_t; 570 typedef std::set<LLHost> host_set_t;
@@ -591,13 +594,14 @@ public:
591 LLHost findHost(const U32 circuit_code); 594 LLHost findHost(const U32 circuit_code);
592 void sanityCheck(); 595 void sanityCheck();
593 596
594 S32 getNumberOfBlocksFast(const char *blockname); 597 BOOL has(const char *blockname) const;
595 S32 getNumberOfBlocks(const char *blockname); 598 S32 getNumberOfBlocksFast(const char *blockname) const;
596 S32 getSizeFast(const char *blockname, const char *varname); 599 S32 getNumberOfBlocks(const char *blockname) const;
597 S32 getSize(const char *blockname, const char *varname); 600 S32 getSizeFast(const char *blockname, const char *varname) const;
601 S32 getSize(const char *blockname, const char *varname) const;
598 S32 getSizeFast(const char *blockname, S32 blocknum, 602 S32 getSizeFast(const char *blockname, S32 blocknum,
599 const char *varname); // size in bytes of data 603 const char *varname) const; // size in bytes of data
600 S32 getSize(const char *blockname, S32 blocknum, const char *varname); 604 S32 getSize(const char *blockname, S32 blocknum, const char *varname) const;
601 605
602 void resetReceiveCounts(); // resets receive counts for all message types to 0 606 void resetReceiveCounts(); // resets receive counts for all message types to 0
603 void dumpReceiveCounts(); // dumps receive count for each message type to llinfos 607 void dumpReceiveCounts(); // dumps receive count for each message type to llinfos