aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:59 -0500
committerJacek Antonelli2008-08-15 23:44:59 -0500
commita408bac29378072fbf36864164149458c978cfcc (patch)
tree67feccf1a5d3816611ba48d6762f86f0f7f4b1f6 /linden/indra/llmessage
parentSecond Life viewer sources 1.17.0.12 (diff)
downloadmeta-impy-a408bac29378072fbf36864164149458c978cfcc.zip
meta-impy-a408bac29378072fbf36864164149458c978cfcc.tar.gz
meta-impy-a408bac29378072fbf36864164149458c978cfcc.tar.bz2
meta-impy-a408bac29378072fbf36864164149458c978cfcc.tar.xz
Second Life viewer sources 1.17.1.0
Diffstat (limited to 'linden/indra/llmessage')
-rw-r--r--linden/indra/llmessage/llassetstorage.cpp18
-rw-r--r--linden/indra/llmessage/llassetstorage.h19
-rw-r--r--linden/indra/llmessage/llblowfishcipher.cpp56
-rw-r--r--linden/indra/llmessage/llcachename.cpp196
-rw-r--r--linden/indra/llmessage/llcurl.cpp2
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.cpp68
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.h8
-rw-r--r--linden/indra/llmessage/llhttpnode.cpp2
-rw-r--r--linden/indra/llmessage/lliohttpserver.cpp2
-rw-r--r--linden/indra/llmessage/lliosocket.cpp2
-rw-r--r--linden/indra/llmessage/llmessagethrottle.cpp2
-rw-r--r--linden/indra/llmessage/llservicebuilder.cpp1
-rw-r--r--linden/indra/llmessage/lltemplatemessagereader.cpp2
-rw-r--r--linden/indra/llmessage/message.cpp16
-rw-r--r--linden/indra/llmessage/net.cpp12
-rw-r--r--linden/indra/llmessage/net.h2
16 files changed, 246 insertions, 162 deletions
diff --git a/linden/indra/llmessage/llassetstorage.cpp b/linden/indra/llmessage/llassetstorage.cpp
index c8610a7..8696438 100644
--- a/linden/indra/llmessage/llassetstorage.cpp
+++ b/linden/indra/llmessage/llassetstorage.cpp
@@ -162,6 +162,8 @@ LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type
162 mHost(), 162 mHost(),
163 mIsTemp( FALSE ), 163 mIsTemp( FALSE ),
164 mIsLocal(FALSE), 164 mIsLocal(FALSE),
165 mIsUserWaiting(FALSE),
166 mTimeout(LL_ASSET_STORAGE_TIMEOUT),
165 mIsPriority(FALSE), 167 mIsPriority(FALSE),
166 mDataSentInFirstPacket(FALSE), 168 mDataSentInFirstPacket(FALSE),
167 mDataIsInVFS( FALSE ) 169 mDataIsInVFS( FALSE )
@@ -1270,7 +1272,9 @@ void LLAssetStorage::storeAssetData(
1270 void* user_data, 1272 void* user_data,
1271 bool temp_file, 1273 bool temp_file,
1272 bool is_priority, 1274 bool is_priority,
1273 bool store_local) 1275 bool store_local,
1276 bool user_waiting,
1277 F64 timeout)
1274{ 1278{
1275 llwarns << "storeAssetData: wrong version called" << llendl; 1279 llwarns << "storeAssetData: wrong version called" << llendl;
1276} 1280}
@@ -1285,7 +1289,9 @@ void LLAssetStorage::storeAssetData(
1285 bool temp_file , 1289 bool temp_file ,
1286 bool is_priority, 1290 bool is_priority,
1287 bool store_local, 1291 bool store_local,
1288 const LLUUID& requesting_agent_id) 1292 const LLUUID& requesting_agent_id,
1293 bool user_waiting,
1294 F64 timeout)
1289{ 1295{
1290 llwarns << "storeAssetData: wrong version called" << llendl; 1296 llwarns << "storeAssetData: wrong version called" << llendl;
1291} 1297}
@@ -1299,7 +1305,9 @@ void LLAssetStorage::storeAssetData(
1299 LLStoreAssetCallback callback, 1305 LLStoreAssetCallback callback,
1300 void* user_data, 1306 void* user_data,
1301 bool temp_file, 1307 bool temp_file,
1302 bool is_priority) 1308 bool is_priority,
1309 bool user_waiting,
1310 F64 timeout)
1303{ 1311{
1304 llwarns << "storeAssetData: wrong version called" << llendl; 1312 llwarns << "storeAssetData: wrong version called" << llendl;
1305} 1313}
@@ -1313,7 +1321,9 @@ void LLAssetStorage::storeAssetData(
1313 LLStoreAssetCallback callback, 1321 LLStoreAssetCallback callback,
1314 void* user_data, 1322 void* user_data,
1315 bool temp_file, 1323 bool temp_file,
1316 bool is_priority) 1324 bool is_priority,
1325 bool user_waiting,
1326 F64 timeout)
1317{ 1327{
1318 llwarns << "storeAssetData: wrong version called" << llendl; 1328 llwarns << "storeAssetData: wrong version called" << llendl;
1319} 1329}
diff --git a/linden/indra/llmessage/llassetstorage.h b/linden/indra/llmessage/llassetstorage.h
index f80a77d..ab12b7a 100644
--- a/linden/indra/llmessage/llassetstorage.h
+++ b/linden/indra/llmessage/llassetstorage.h
@@ -95,6 +95,7 @@ public:
95 95
96 void setUUID(const LLUUID& id) { mUUID = id; } 96 void setUUID(const LLUUID& id) { mUUID = id; }
97 void setType(LLAssetType::EType type) { mType = type; } 97 void setType(LLAssetType::EType type) { mType = type; }
98 void setTimeout (F64 timeout) { mTimeout = timeout; }
98 99
99protected: 100protected:
100 LLUUID mUUID; 101 LLUUID mUUID;
@@ -109,7 +110,9 @@ public:
109 LLHost mHost; 110 LLHost mHost;
110 BOOL mIsTemp; 111 BOOL mIsTemp;
111 BOOL mIsLocal; 112 BOOL mIsLocal;
113 BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result.
112 F64 mTime; // Message system time 114 F64 mTime; // Message system time
115 F64 mTimeout; // Amount of time before timing out.
113 BOOL mIsPriority; 116 BOOL mIsPriority;
114 BOOL mDataSentInFirstPacket; 117 BOOL mDataSentInFirstPacket;
115 BOOL mDataIsInVFS; 118 BOOL mDataIsInVFS;
@@ -252,7 +255,9 @@ public:
252 void* user_data, 255 void* user_data,
253 bool temp_file = false, 256 bool temp_file = false,
254 bool is_priority = false, 257 bool is_priority = false,
255 bool store_local = false); 258 bool store_local = false,
259 bool user_waiting= false,
260 F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
256 261
257 /* 262 /*
258 * AssetID version 263 * AssetID version
@@ -266,7 +271,9 @@ public:
266 bool temp_file = false, 271 bool temp_file = false,
267 bool is_priority = false, 272 bool is_priority = false,
268 bool store_local = false, 273 bool store_local = false,
269 const LLUUID& requesting_agent_id = LLUUID::null); 274 const LLUUID& requesting_agent_id = LLUUID::null,
275 bool user_waiting= false,
276 F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
270 277
271 virtual void checkForTimeouts(); 278 virtual void checkForTimeouts();
272 279
@@ -360,7 +367,9 @@ public:
360 LLStoreAssetCallback callback, 367 LLStoreAssetCallback callback,
361 void* user_data, 368 void* user_data,
362 bool temp_file = false, 369 bool temp_file = false,
363 bool is_priority = false); 370 bool is_priority = false,
371 bool user_waiting = false,
372 F64 timeout = LL_ASSET_STORAGE_TIMEOUT);
364 373
365 /* 374 /*
366 * TransactionID version 375 * TransactionID version
@@ -372,7 +381,9 @@ public:
372 LLStoreAssetCallback callback, 381 LLStoreAssetCallback callback,
373 void *user_data, 382 void *user_data,
374 bool temp_file = false, 383 bool temp_file = false,
375 bool is_priority = false); 384 bool is_priority = false,
385 bool user_waiting = false,
386 F64 timeout = LL_ASSET_STORAGE_TIMEOUT);
376 387
377 static void legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType, void *user_data, S32 status); 388 static void legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType, void *user_data, S32 status);
378 static void legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status); 389 static void legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status);
diff --git a/linden/indra/llmessage/llblowfishcipher.cpp b/linden/indra/llmessage/llblowfishcipher.cpp
index 1772078..62464de 100644
--- a/linden/indra/llmessage/llblowfishcipher.cpp
+++ b/linden/indra/llmessage/llblowfishcipher.cpp
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file llblowcipher.cpp 2 * @file llblowfishcipher.cpp
3 * @brief Wrapper around OpenSSL Blowfish encryption algorithm. 3 * @brief Wrapper around OpenSSL Blowfish encryption algorithm.
4 * 4 *
5 * We do not have OpenSSL headers or libraries on Windows, so this 5 * We do not have OpenSSL headers or libraries on Windows, so this
@@ -85,33 +85,33 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
85 << " iv_len " << iv_length 85 << " iv_len " << iv_length
86 << llendl; 86 << llendl;
87 87
88 int output_len = 0; 88 int output_len = 0;
89 int temp_len = 0; 89 int temp_len = 0;
90 if (!EVP_EncryptUpdate(&context, 90 if (!EVP_EncryptUpdate(&context,
91 dst, 91 dst,
92 &output_len, 92 &output_len,
93 src, 93 src,
94 src_len)) 94 src_len))
95 { 95 {
96 llwarns << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << llendl; 96 llwarns << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << llendl;
97 goto ERROR; 97 goto ERROR;
98 } 98 }
99 99
100 // There may be some final data left to encrypt if the input is 100 // There may be some final data left to encrypt if the input is
101 // not an exact multiple of the block size. 101 // not an exact multiple of the block size.
102 if (!EVP_EncryptFinal_ex(&context, (unsigned char*)(dst + output_len), &temp_len)) 102 if (!EVP_EncryptFinal_ex(&context, (unsigned char*)(dst + output_len), &temp_len))
103 { 103 {
104 llwarns << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << llendl; 104 llwarns << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << llendl;
105 goto ERROR; 105 goto ERROR;
106 } 106 }
107 output_len += temp_len; 107 output_len += temp_len;
108 108
109 EVP_CIPHER_CTX_cleanup(&context); 109 EVP_CIPHER_CTX_cleanup(&context);
110 return output_len; 110 return output_len;
111 111
112ERROR: 112ERROR:
113 EVP_CIPHER_CTX_cleanup(&context); 113 EVP_CIPHER_CTX_cleanup(&context);
114 return 0; 114 return 0;
115} 115}
116 116
117// virtual 117// virtual
diff --git a/linden/indra/llmessage/llcachename.cpp b/linden/indra/llmessage/llcachename.cpp
index 2a21b5a..d960429 100644
--- a/linden/indra/llmessage/llcachename.cpp
+++ b/linden/indra/llmessage/llcachename.cpp
@@ -66,132 +66,130 @@ LLCacheName* gCacheName = NULL;
66/// class LLCacheNameEntry 66/// class LLCacheNameEntry
67/// --------------------------------------------------------------------------- 67/// ---------------------------------------------------------------------------
68 68
69namespace { 69class LLCacheNameEntry
70 class LLCacheNameEntry 70{
71 { 71public:
72 public: 72 LLCacheNameEntry();
73 LLCacheNameEntry();
74 73
75 public: 74public:
76 bool mIsGroup; 75 bool mIsGroup;
77 U32 mCreateTime; // unix time_t 76 U32 mCreateTime; // unix time_t
78 char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 77 char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
79 char mLastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 78 char mLastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
80 char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 79 char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
81 }; 80};
82 81
83 LLCacheNameEntry::LLCacheNameEntry() 82LLCacheNameEntry::LLCacheNameEntry()
84 { 83{
85 mFirstName[0] = '\0'; 84 mFirstName[0] = '\0';
86 mLastName[0] = '\0'; 85 mLastName[0] = '\0';
87 mGroupName[0] = '\0'; 86 mGroupName[0] = '\0';
88 } 87}
89 88
90 89
91 class PendingReply 90class PendingReply
92 { 91{
93 public: 92public:
94 LLUUID mID; 93 LLUUID mID;
95 LLCacheNameCallback mCallback; 94 LLCacheNameCallback mCallback;
96 LLHost mHost; 95 LLHost mHost;
97 void* mData; 96 void* mData;
98 PendingReply(const LLUUID& id, LLCacheNameCallback callback, void* data = NULL) 97 PendingReply(const LLUUID& id, LLCacheNameCallback callback, void* data = NULL)
99 : mID(id), mCallback(callback), mData(data) 98 : mID(id), mCallback(callback), mData(data)
100 { } 99 { }
101 100
102 PendingReply(const LLUUID& id, const LLHost& host) 101 PendingReply(const LLUUID& id, const LLHost& host)
103 : mID(id), mCallback(0), mHost(host) 102 : mID(id), mCallback(0), mHost(host)
104 { } 103 { }
105 104
106 void done() { mID.setNull(); } 105 void done() { mID.setNull(); }
107 bool isDone() const { return mID.isNull() != FALSE; } 106 bool isDone() const { return mID.isNull() != FALSE; }
108 }; 107};
109 108
110 class ReplySender 109class ReplySender
111 { 110{
112 public: 111public:
113 ReplySender(LLMessageSystem* msg); 112 ReplySender(LLMessageSystem* msg);
114 ~ReplySender(); 113 ~ReplySender();
115 114
116 void send(const LLUUID& id, 115 void send(const LLUUID& id,
117 const LLCacheNameEntry& entry, const LLHost& host); 116 const LLCacheNameEntry& entry, const LLHost& host);
118 117
119 private: 118private:
120 void flush(); 119 void flush();
121 120
122 LLMessageSystem* mMsg; 121 LLMessageSystem* mMsg;
123 bool mPending; 122 bool mPending;
124 bool mCurrIsGroup; 123 bool mCurrIsGroup;
125 LLHost mCurrHost; 124 LLHost mCurrHost;
126 }; 125};
127 126
128 ReplySender::ReplySender(LLMessageSystem* msg) 127ReplySender::ReplySender(LLMessageSystem* msg)
129 : mMsg(msg), mPending(false) 128 : mMsg(msg), mPending(false)
130 { } 129{ }
131 130
132 ReplySender::~ReplySender() 131ReplySender::~ReplySender()
133 { 132{
134 flush(); 133 flush();
135 } 134}
136 135
137 void ReplySender::send(const LLUUID& id, 136void ReplySender::send(const LLUUID& id,
138 const LLCacheNameEntry& entry, const LLHost& host) 137 const LLCacheNameEntry& entry, const LLHost& host)
138{
139 if (mPending)
139 { 140 {
140 if (mPending) 141 if (mCurrIsGroup != entry.mIsGroup
142 || mCurrHost != host)
141 { 143 {
142 if (mCurrIsGroup != entry.mIsGroup 144 flush();
143 || mCurrHost != host)
144 {
145 flush();
146 }
147 } 145 }
146 }
148 147
149 if (!mPending) 148 if (!mPending)
150 { 149 {
151 mPending = true; 150 mPending = true;
152 mCurrIsGroup = entry.mIsGroup; 151 mCurrIsGroup = entry.mIsGroup;
153 mCurrHost = host; 152 mCurrHost = host;
154
155 if(mCurrIsGroup)
156 mMsg->newMessageFast(_PREHASH_UUIDGroupNameReply);
157 else
158 mMsg->newMessageFast(_PREHASH_UUIDNameReply);
159 }
160 153
161 mMsg->nextBlockFast(_PREHASH_UUIDNameBlock);
162 mMsg->addUUIDFast(_PREHASH_ID, id);
163 if(mCurrIsGroup) 154 if(mCurrIsGroup)
164 { 155 mMsg->newMessageFast(_PREHASH_UUIDGroupNameReply);
165 mMsg->addStringFast(_PREHASH_GroupName, entry.mGroupName);
166 }
167 else 156 else
168 { 157 mMsg->newMessageFast(_PREHASH_UUIDNameReply);
169 mMsg->addStringFast(_PREHASH_FirstName, entry.mFirstName); 158 }
170 mMsg->addStringFast(_PREHASH_LastName, entry.mLastName);
171 }
172 159
173 if(mMsg->isSendFullFast(_PREHASH_UUIDNameBlock)) 160 mMsg->nextBlockFast(_PREHASH_UUIDNameBlock);
174 { 161 mMsg->addUUIDFast(_PREHASH_ID, id);
175 flush(); 162 if(mCurrIsGroup)
176 } 163 {
164 mMsg->addStringFast(_PREHASH_GroupName, entry.mGroupName);
165 }
166 else
167 {
168 mMsg->addStringFast(_PREHASH_FirstName, entry.mFirstName);
169 mMsg->addStringFast(_PREHASH_LastName, entry.mLastName);
177 } 170 }
178 171
179 void ReplySender::flush() 172 if(mMsg->isSendFullFast(_PREHASH_UUIDNameBlock))
180 { 173 {
181 if (mPending) 174 flush();
182 {
183 mMsg->sendReliable(mCurrHost);
184 mPending = false;
185 }
186 } 175 }
176}
187 177
178void ReplySender::flush()
179{
180 if (mPending)
181 {
182 mMsg->sendReliable(mCurrHost);
183 mPending = false;
184 }
185}
188 186
189 typedef std::set<LLUUID> AskQueue; 187
190 typedef std::vector<PendingReply> ReplyQueue; 188typedef std::set<LLUUID> AskQueue;
191 typedef std::map<LLUUID,U32> PendingQueue; 189typedef std::vector<PendingReply> ReplyQueue;
192 typedef std::map<LLUUID, LLCacheNameEntry*> Cache; 190typedef std::map<LLUUID,U32> PendingQueue;
193 typedef std::vector<LLCacheNameCallback> Observers; 191typedef std::map<LLUUID, LLCacheNameEntry*> Cache;
194}; 192typedef std::vector<LLCacheNameCallback> Observers;
195 193
196class LLCacheName::Impl 194class LLCacheName::Impl
197{ 195{
diff --git a/linden/indra/llmessage/llcurl.cpp b/linden/indra/llmessage/llcurl.cpp
index 5eaaab0..362204a 100644
--- a/linden/indra/llmessage/llcurl.cpp
+++ b/linden/indra/llmessage/llcurl.cpp
@@ -28,6 +28,8 @@
28 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 */ 29 */
30 30
31#include "linden_common.h"
32
31#include "llcurl.h" 33#include "llcurl.h"
32 34
33#include <iomanip> 35#include <iomanip>
diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp
index 5a0cdad..d83349b 100644
--- a/linden/indra/llmessage/llhttpassetstorage.cpp
+++ b/linden/indra/llmessage/llhttpassetstorage.cpp
@@ -428,14 +428,18 @@ void LLHTTPAssetStorage::storeAssetData(
428 bool temp_file, 428 bool temp_file,
429 bool is_priority, 429 bool is_priority,
430 bool store_local, 430 bool store_local,
431 const LLUUID& requesting_agent_id) 431 const LLUUID& requesting_agent_id,
432 bool user_waiting,
433 F64 timeout)
432{ 434{
433 if (mVFS->getExists(uuid, type)) 435 if (mVFS->getExists(uuid, type))
434 { 436 {
435 LLAssetRequest *req = new LLAssetRequest(uuid, type); 437 LLAssetRequest *req = new LLAssetRequest(uuid, type);
436 req->mUpCallback = callback; 438 req->mUpCallback = callback;
437 req->mUserData = user_data; 439 req->mUserData = user_data;
438 req->mRequestingAgentID = requesting_agent_id; 440 req->mRequestingAgentID = requesting_agent_id;
441 req->mIsUserWaiting = user_waiting;
442 req->mTimeout = timeout;
439 443
440 // this will get picked up and transmitted in checkForTimeouts 444 // this will get picked up and transmitted in checkForTimeouts
441 if(store_local) 445 if(store_local)
@@ -469,7 +473,9 @@ void LLHTTPAssetStorage::storeAssetData(
469 LLStoreAssetCallback callback, 473 LLStoreAssetCallback callback,
470 void* user_data, 474 void* user_data,
471 bool temp_file, 475 bool temp_file,
472 bool is_priority) 476 bool is_priority,
477 bool user_waiting,
478 F64 timeout)
473{ 479{
474 llinfos << "LLAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; 480 llinfos << "LLAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl;
475 481
@@ -509,7 +515,11 @@ void LLHTTPAssetStorage::storeAssetData(
509 legacyStoreDataCallback, 515 legacyStoreDataCallback,
510 (void**)legacy, 516 (void**)legacy,
511 temp_file, 517 temp_file,
512 is_priority); 518 is_priority,
519 false,
520 LLUUID::null,
521 user_waiting,
522 timeout);
513 } 523 }
514 else 524 else
515 { 525 {
@@ -608,7 +618,19 @@ bool LLHTTPAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt,
608 // This request was found in the pending list. Move it to the end! 618 // This request was found in the pending list. Move it to the end!
609 LLAssetRequest* pending_req = *result; 619 LLAssetRequest* pending_req = *result;
610 pending->remove(pending_req); 620 pending->remove(pending_req);
611 pending->push_back(pending_req); 621
622 if (!pending_req->mIsUserWaiting) //A user is waiting on this request. Toss it.
623 {
624 pending->push_back(pending_req);
625 }
626 else
627 {
628 if (pending_req->mUpCallback) //Clean up here rather than _callUploadCallbacks because this request is already cleared the req.
629 {
630 pending_req->mUpCallback(pending_req->getUUID(), pending_req->mUserData, -1);
631 }
632
633 }
612 634
613 llinfos << "Asset " << getRequestName(rt) << " request for " 635 llinfos << "Asset " << getRequestName(rt) << " request for "
614 << asset_id << "." << LLAssetType::lookup(asset_type) 636 << asset_id << "." << LLAssetType::lookup(asset_type)
@@ -744,6 +766,14 @@ void LLHTTPAssetStorage::checkForTimeouts()
744 766
745 LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), 767 LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(),
746 req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle); 768 req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle);
769
770 if (req->mIsUserWaiting) //If a user is waiting on a realtime response, we want to perserve information across upload attempts.
771 {
772 new_req->mTime = req->mTime;
773 new_req->mTimeout = req->mTimeout;
774 new_req->mIsUserWaiting = req->mIsUserWaiting;
775 }
776
747 if (do_compress) 777 if (do_compress)
748 { 778 {
749 new_req->prepareCompressedUpload(); 779 new_req->prepareCompressedUpload();
@@ -839,11 +869,12 @@ void LLHTTPAssetStorage::checkForTimeouts()
839 if (curl_msg && curl_msg->msg == CURLMSG_DONE) 869 if (curl_msg && curl_msg->msg == CURLMSG_DONE)
840 { 870 {
841 long curl_result = 0; 871 long curl_result = 0;
842 S32 xfer_result = 0; 872 S32 xfer_result = LL_ERR_NOERR;
843 873
844 LLHTTPAssetRequest *req = NULL; 874 LLHTTPAssetRequest *req = NULL;
845 curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_PRIVATE, &req); 875 curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_PRIVATE, &req);
846 876
877 // TODO: Throw curl_result at all callbacks.
847 curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_HTTP_CODE, &curl_result); 878 curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_HTTP_CODE, &curl_result);
848 if (RT_UPLOAD == req->mRequestType || RT_LOCALUPLOAD == req->mRequestType) 879 if (RT_UPLOAD == req->mRequestType || RT_LOCALUPLOAD == req->mRequestType)
849 { 880 {
@@ -865,6 +896,12 @@ void LLHTTPAssetStorage::checkForTimeouts()
865 { 896 {
866 llwarns << "Re-requesting upload for " << req->getUUID() << ". Received upload error to " << req->mURLBuffer << 897 llwarns << "Re-requesting upload for " << req->getUUID() << ". Received upload error to " << req->mURLBuffer <<
867 " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl; 898 " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl;
899
900 ////HACK (probably) I am sick of this getting requeued and driving me mad.
901 //if (req->mIsUserWaiting)
902 //{
903 // deletePendingRequest(RT_UPLOAD, req->getType(), req->getUUID());
904 //}
868 } 905 }
869 else 906 else
870 { 907 {
@@ -949,14 +986,23 @@ void LLHTTPAssetStorage::checkForTimeouts()
949 986
950void LLHTTPAssetStorage::bumpTimedOutUploads() 987void LLHTTPAssetStorage::bumpTimedOutUploads()
951{ 988{
989 bool user_waiting=FALSE;
990
991 F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
992
993 if (mPendingUploads.size())
994 {
995 request_list_t::iterator it = mPendingUploads.begin();
996 LLAssetRequest* req = *it;
997 user_waiting=req->mIsUserWaiting;
998 }
999
952 // No point bumping currently running uploads if there are no others in line. 1000 // No point bumping currently running uploads if there are no others in line.
953 if (!(mPendingUploads.size() > mRunningUploads.size())) 1001 if (!(mPendingUploads.size() > mRunningUploads.size()) && !user_waiting)
954 { 1002 {
955 return; 1003 return;
956 } 1004 }
957 1005
958 F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
959
960 // deletePendingRequest will modify the mRunningUploads list so we don't want to iterate over it. 1006 // deletePendingRequest will modify the mRunningUploads list so we don't want to iterate over it.
961 request_list_t temp_running = mRunningUploads; 1007 request_list_t temp_running = mRunningUploads;
962 1008
@@ -967,7 +1013,7 @@ void LLHTTPAssetStorage::bumpTimedOutUploads()
967 //request_list_t::iterator curiter = iter++; 1013 //request_list_t::iterator curiter = iter++;
968 LLAssetRequest* req = *it; 1014 LLAssetRequest* req = *it;
969 1015
970 if ( LL_ASSET_STORAGE_TIMEOUT < (mt_secs - req->mTime) ) 1016 if ( req->mTimeout < (mt_secs - req->mTime) )
971 { 1017 {
972 llwarns << "Asset upload request timed out for " 1018 llwarns << "Asset upload request timed out for "
973 << req->getUUID() << "." 1019 << req->getUUID() << "."
diff --git a/linden/indra/llmessage/llhttpassetstorage.h b/linden/indra/llmessage/llhttpassetstorage.h
index 2977301..962bece 100644
--- a/linden/indra/llmessage/llhttpassetstorage.h
+++ b/linden/indra/llmessage/llhttpassetstorage.h
@@ -66,7 +66,9 @@ public:
66 bool temp_file = false, 66 bool temp_file = false,
67 bool is_priority = false, 67 bool is_priority = false,
68 bool store_local = false, 68 bool store_local = false,
69 const LLUUID& requesting_agent_id = LLUUID::null); 69 const LLUUID& requesting_agent_id = LLUUID::null,
70 bool user_waiting=FALSE,
71 F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
70 72
71 virtual void storeAssetData( 73 virtual void storeAssetData(
72 const char* filename, 74 const char* filename,
@@ -75,7 +77,9 @@ public:
75 LLStoreAssetCallback callback, 77 LLStoreAssetCallback callback,
76 void* user_data, 78 void* user_data,
77 bool temp_file, 79 bool temp_file,
78 bool is_priority); 80 bool is_priority,
81 bool user_waiting=FALSE,
82 F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
79 83
80 virtual LLSD getPendingDetails(ERequestType rt, 84 virtual LLSD getPendingDetails(ERequestType rt,
81 LLAssetType::EType asset_type, 85 LLAssetType::EType asset_type,
diff --git a/linden/indra/llmessage/llhttpnode.cpp b/linden/indra/llmessage/llhttpnode.cpp
index 97064a1..25413b4 100644
--- a/linden/indra/llmessage/llhttpnode.cpp
+++ b/linden/indra/llmessage/llhttpnode.cpp
@@ -29,7 +29,7 @@
29#include "linden_common.h" 29#include "linden_common.h"
30#include "llhttpnode.h" 30#include "llhttpnode.h"
31 31
32#include "boost/tokenizer.hpp" 32#include <boost/tokenizer.hpp>
33 33
34#include "llstl.h" 34#include "llstl.h"
35 35
diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp
index d7fc54e..5c96102 100644
--- a/linden/indra/llmessage/lliohttpserver.cpp
+++ b/linden/indra/llmessage/lliohttpserver.cpp
@@ -49,7 +49,7 @@
49 49
50#include <sstream> 50#include <sstream>
51 51
52#include "boost/tokenizer.hpp" 52#include <boost/tokenizer.hpp>
53 53
54static const char HTTP_VERSION_STR[] = "HTTP/1.0"; 54static const char HTTP_VERSION_STR[] = "HTTP/1.0";
55static const std::string CONTEXT_REQUEST("request"); 55static const std::string CONTEXT_REQUEST("request");
diff --git a/linden/indra/llmessage/lliosocket.cpp b/linden/indra/llmessage/lliosocket.cpp
index 0ceb436..8bc347c 100644
--- a/linden/indra/llmessage/lliosocket.cpp
+++ b/linden/indra/llmessage/lliosocket.cpp
@@ -441,6 +441,8 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
441#if LL_WINDOWS 441#if LL_WINDOWS
442 if (status == 730035) 442 if (status == 730035)
443 break; 443 break;
444#else
445 (void) status;
444#endif 446#endif
445 mLastWritten = segment.data() + len - 1; 447 mLastWritten = segment.data() + len - 1;
446 448
diff --git a/linden/indra/llmessage/llmessagethrottle.cpp b/linden/indra/llmessage/llmessagethrottle.cpp
index 07c22a5..bbaa9d8 100644
--- a/linden/indra/llmessage/llmessagethrottle.cpp
+++ b/linden/indra/llmessage/llmessagethrottle.cpp
@@ -26,6 +26,8 @@
26 * COMPLETENESS OR PERFORMANCE. 26 * COMPLETENESS OR PERFORMANCE.
27 */ 27 */
28 28
29#include "linden_common.h"
30
29#include "llhash.h" 31#include "llhash.h"
30 32
31#include "llmessagethrottle.h" 33#include "llmessagethrottle.h"
diff --git a/linden/indra/llmessage/llservicebuilder.cpp b/linden/indra/llmessage/llservicebuilder.cpp
index 86b7d9d..91040c0 100644
--- a/linden/indra/llmessage/llservicebuilder.cpp
+++ b/linden/indra/llmessage/llservicebuilder.cpp
@@ -26,6 +26,7 @@
26 * COMPLETENESS OR PERFORMANCE. 26 * COMPLETENESS OR PERFORMANCE.
27*/ 27*/
28 28
29#include "linden_common.h"
29#include "llapp.h" 30#include "llapp.h"
30#include "llfile.h" 31#include "llfile.h"
31#include "llservicebuilder.h" 32#include "llservicebuilder.h"
diff --git a/linden/indra/llmessage/lltemplatemessagereader.cpp b/linden/indra/llmessage/lltemplatemessagereader.cpp
index 892efb8..bb3f4f4 100644
--- a/linden/indra/llmessage/lltemplatemessagereader.cpp
+++ b/linden/indra/llmessage/lltemplatemessagereader.cpp
@@ -594,7 +594,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
594 tsize = tsizeh; 594 tsize = tsizeh;
595 break; 595 break;
596 case 4: 596 case 4:
597 htonmemcpy(&tsizeb, &buffer[decode_pos], MVT_U32, 4); 597 htonmemcpy(&tsize, &buffer[decode_pos], MVT_U32, 4);
598 break; 598 break;
599 default: 599 default:
600 llerrs << "Attempting to read variable field with unknown size of " << data_size << llendl; 600 llerrs << "Attempting to read variable field with unknown size of " << data_size << llendl;
diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp
index ab41cca..d1c2875 100644
--- a/linden/indra/llmessage/message.cpp
+++ b/linden/indra/llmessage/message.cpp
@@ -1341,7 +1341,7 @@ LLMessageSystem::~LLMessageSystem()
1341 1341
1342 if (!mbError) 1342 if (!mbError)
1343 { 1343 {
1344 end_net(); 1344 end_net(mSocket);
1345 } 1345 }
1346 1346
1347 delete mTemplateMessageReader; 1347 delete mTemplateMessageReader;
@@ -1355,6 +1355,9 @@ LLMessageSystem::~LLMessageSystem()
1355 delete mLLSDMessageReader; 1355 delete mLLSDMessageReader;
1356 mLLSDMessageReader = NULL; 1356 mLLSDMessageReader = NULL;
1357 1357
1358 delete mLLSDMessageBuilder;
1359 mLLSDMessageBuilder = NULL;
1360
1358 delete mPollInfop; 1361 delete mPollInfop;
1359 mPollInfop = NULL; 1362 mPollInfop = NULL;
1360 1363
@@ -4164,11 +4167,13 @@ void LLMessageSystem::dumpPacketToLog()
4164 char line_buffer[256]; /* Flawfinder: ignore */ 4167 char line_buffer[256]; /* Flawfinder: ignore */
4165 S32 i; 4168 S32 i;
4166 S32 cur_line_pos = 0; 4169 S32 cur_line_pos = 0;
4167
4168 S32 cur_line = 0; 4170 S32 cur_line = 0;
4171
4169 for (i = 0; i < mTrueReceiveSize; i++) 4172 for (i = 0; i < mTrueReceiveSize; i++)
4170 { 4173 {
4171 snprintf(line_buffer + cur_line_pos*3, sizeof(line_buffer),"%02x ", mTrueReceiveBuffer[i]); /* Flawfinder: ignore */ 4174 S32 offset = cur_line_pos * 3;
4175 snprintf(line_buffer + offset, sizeof(line_buffer) - offset,
4176 "%02x ", mTrueReceiveBuffer[i]); /* Flawfinder: ignore */
4172 cur_line_pos++; 4177 cur_line_pos++;
4173 if (cur_line_pos >= 16) 4178 if (cur_line_pos >= 16)
4174 { 4179 {
@@ -4345,11 +4350,6 @@ std::string get_shared_secret()
4345 4350
4346typedef std::map<const char*, LLMessageBuilder*> BuilderMap; 4351typedef std::map<const char*, LLMessageBuilder*> BuilderMap;
4347 4352
4348static void setBuilder(BuilderMap& map, const char* name, LLMessageBuilder* builder)
4349{
4350 map[gMessageStringTable.getString(name)] = builder;
4351}
4352
4353void LLMessageSystem::newMessageFast(const char *name) 4353void LLMessageSystem::newMessageFast(const char *name)
4354{ 4354{
4355 if(LLMessageConfig::isMessageBuiltTemplate(name)) 4355 if(LLMessageConfig::isMessageBuiltTemplate(name))
diff --git a/linden/indra/llmessage/net.cpp b/linden/indra/llmessage/net.cpp
index c61f4a2..1395093 100644
--- a/linden/indra/llmessage/net.cpp
+++ b/linden/indra/llmessage/net.cpp
@@ -289,8 +289,12 @@ S32 start_net(S32& socket_out, int& nPort)
289 return 0; 289 return 0;
290} 290}
291 291
292void end_net() 292void end_net(S32& socket_out)
293{ 293{
294 if (socket_out < 0)
295 {
296 closesocket(socket_out);
297 }
294 WSACleanup(); 298 WSACleanup();
295} 299}
296 300
@@ -457,8 +461,12 @@ S32 start_net(S32& socket_out, int& nPort)
457 return 0; 461 return 0;
458} 462}
459 463
460void end_net() 464void end_net(S32& socket_out)
461{ 465{
466 if (socket_out < 0)
467 {
468 close(socket_out);
469 }
462} 470}
463 471
464int receive_packet(int hSocket, char * receiveBuffer) 472int receive_packet(int hSocket, char * receiveBuffer)
diff --git a/linden/indra/llmessage/net.h b/linden/indra/llmessage/net.h
index b2f931f..cfc1f88 100644
--- a/linden/indra/llmessage/net.h
+++ b/linden/indra/llmessage/net.h
@@ -40,7 +40,7 @@ class LLHost;
40// Returns 0 on success, non-zero on error. 40// Returns 0 on success, non-zero on error.
41// Sets socket handler/descriptor, changes nPort if port requested is unavailable. 41// Sets socket handler/descriptor, changes nPort if port requested is unavailable.
42S32 start_net(S32& socket_out, int& nPort); 42S32 start_net(S32& socket_out, int& nPort);
43void end_net(); 43void end_net(S32& socket_out);
44 44
45// returns size of packet or -1 in case of error 45// returns size of packet or -1 in case of error
46S32 receive_packet(int hSocket, char * receiveBuffer); 46S32 receive_packet(int hSocket, char * receiveBuffer);