aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/llcurl.cpp2
-rw-r--r--linden/indra/llmessage/lldatapacker.cpp5
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.cpp6
-rw-r--r--linden/indra/llmessage/llhttpclient.cpp40
-rw-r--r--linden/indra/llmessage/llhttpclient.h2
-rw-r--r--linden/indra/llmessage/lliohttpserver.cpp37
-rw-r--r--linden/indra/llmessage/llmessageconfig.cpp16
-rw-r--r--linden/indra/llmessage/llmessageconfig.h2
-rw-r--r--linden/indra/llmessage/llmessagereader.cpp3
-rw-r--r--linden/indra/llmessage/llmessagetemplateparser.cpp1
-rw-r--r--linden/indra/llmessage/llnamevalue.cpp3
-rw-r--r--linden/indra/llmessage/llnamevalue.h1
-rw-r--r--linden/indra/llmessage/llservicebuilder.cpp19
-rw-r--r--linden/indra/llmessage/lltemplatemessagereader.cpp11
-rw-r--r--linden/indra/llmessage/lluseroperation.cpp21
-rw-r--r--linden/indra/llmessage/lluseroperation.h4
-rw-r--r--linden/indra/llmessage/llxfer_file.cpp6
-rw-r--r--linden/indra/llmessage/message.cpp1
-rw-r--r--linden/indra/llmessage/message.h103
19 files changed, 198 insertions, 85 deletions
diff --git a/linden/indra/llmessage/llcurl.cpp b/linden/indra/llmessage/llcurl.cpp
index 362204a..b94a41e 100644
--- a/linden/indra/llmessage/llcurl.cpp
+++ b/linden/indra/llmessage/llcurl.cpp
@@ -96,7 +96,7 @@ namespace boost
96 96
97 void intrusive_ptr_release(LLCurl::Responder* p) 97 void intrusive_ptr_release(LLCurl::Responder* p)
98 { 98 {
99 if(0 == --p->mReferenceCount) 99 if(p && 0 == --p->mReferenceCount)
100 { 100 {
101 delete p; 101 delete p;
102 } 102 }
diff --git a/linden/indra/llmessage/lldatapacker.cpp b/linden/indra/llmessage/lldatapacker.cpp
index 3cdaa25..8725870 100644
--- a/linden/indra/llmessage/lldatapacker.cpp
+++ b/linden/indra/llmessage/lldatapacker.cpp
@@ -1895,7 +1895,10 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v
1895 { 1895 {
1896 fpos_t last_pos; 1896 fpos_t last_pos;
1897 fgetpos(mFP, &last_pos); 1897 fgetpos(mFP, &last_pos);
1898 fgets(buffer, DP_BUFSIZE, mFP); 1898 if (fgets(buffer, DP_BUFSIZE, mFP) == NULL)
1899 {
1900 buffer[0] = '\0';
1901 }
1899 1902
1900 sscanf(buffer, "%511s %511[^\n]", keyword, value); /* Flawfinder: ignore */ 1903 sscanf(buffer, "%511s %511[^\n]", keyword, value); /* Flawfinder: ignore */
1901 1904
diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp
index d83349b..b6c20b9 100644
--- a/linden/indra/llmessage/llhttpassetstorage.cpp
+++ b/linden/indra/llmessage/llhttpassetstorage.cpp
@@ -38,7 +38,11 @@
38#include "llvfile.h" 38#include "llvfile.h"
39#include "llvfs.h" 39#include "llvfs.h"
40 40
41#include "zlib/zlib.h" 41#ifdef LL_STANDALONE
42# include <zlib.h>
43#else
44# include "zlib/zlib.h"
45#endif
42 46
43const U32 MAX_RUNNING_REQUESTS = 1; 47const U32 MAX_RUNNING_REQUESTS = 1;
44const F32 MAX_PROCESSING_TIME = 0.005f; 48const F32 MAX_PROCESSING_TIME = 0.005f;
diff --git a/linden/indra/llmessage/llhttpclient.cpp b/linden/indra/llmessage/llhttpclient.cpp
index 392dfd0..e36503a 100644
--- a/linden/indra/llmessage/llhttpclient.cpp
+++ b/linden/indra/llmessage/llhttpclient.cpp
@@ -252,6 +252,7 @@ static void request(
252 LLURLRequest::ERequestAction method, 252 LLURLRequest::ERequestAction method,
253 Injector* body_injector, 253 Injector* body_injector,
254 LLHTTPClient::ResponderPtr responder, 254 LLHTTPClient::ResponderPtr responder,
255 const LLSD& headers,
255 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS) 256 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS)
256{ 257{
257 if (!LLHTTPClient::hasPump()) 258 if (!LLHTTPClient::hasPump())
@@ -263,6 +264,19 @@ static void request(
263 264
264 LLURLRequest *req = new LLURLRequest(method, url); 265 LLURLRequest *req = new LLURLRequest(method, url);
265 req->requestEncoding(""); 266 req->requestEncoding("");
267
268 if (headers.isMap())
269 {
270 LLSD::map_const_iterator iter = headers.beginMap();
271 LLSD::map_const_iterator end = headers.endMap();
272
273 for (; iter != end; ++iter)
274 {
275 std::ostringstream header;
276 header << iter->first << ": " << iter->second.asString() ;
277 req->addHeader(header.str().c_str());
278 }
279 }
266 if (!gCABundle.empty()) 280 if (!gCABundle.empty())
267 { 281 {
268 req->checkRootCertificate(true, gCABundle.c_str()); 282 req->checkRootCertificate(true, gCABundle.c_str());
@@ -287,17 +301,37 @@ static void request(
287 theClientPump->addChain(chain, timeout); 301 theClientPump->addChain(chain, timeout);
288} 302}
289 303
304static void request(
305 const std::string& url,
306 LLURLRequest::ERequestAction method,
307 Injector* body_injector,
308 LLHTTPClient::ResponderPtr responder,
309 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS)
310{
311 request(url, method, body_injector, responder, LLSD(), timeout);
312}
313
314void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout)
315{
316 request(url, LLURLRequest::HTTP_GET, NULL, responder, headers, timeout);
317}
318
290void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const F32 timeout) 319void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const F32 timeout)
291{ 320{
292 request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout); 321 get(url, responder, LLSD(), timeout);
293} 322}
294 323
295void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const F32 timeout) 324void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const LLSD& headers, const F32 timeout)
296{ 325{
297 LLURI uri; 326 LLURI uri;
298 327
299 uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query); 328 uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query);
300 get(uri.asString(), responder, timeout); 329 get(uri.asString(), responder, headers, timeout);
330}
331
332void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const F32 timeout)
333{
334 get(url, query, responder, LLSD(), timeout);
301} 335}
302 336
303// A simple class for managing data returned from a curl http request. 337// A simple class for managing data returned from a curl http request.
diff --git a/linden/indra/llmessage/llhttpclient.h b/linden/indra/llmessage/llhttpclient.h
index 88f8cbb..578b176 100644
--- a/linden/indra/llmessage/llhttpclient.h
+++ b/linden/indra/llmessage/llhttpclient.h
@@ -79,7 +79,9 @@ public:
79 typedef boost::intrusive_ptr<Responder> ResponderPtr; 79 typedef boost::intrusive_ptr<Responder> ResponderPtr;
80 80
81 static void get(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 81 static void get(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
82 static void get(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
82 static void get(const std::string& url, const LLSD& query, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 83 static void get(const std::string& url, const LLSD& query, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
84 static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
83 static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 85 static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
84 ///< non-blocking 86 ///< non-blocking
85 static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 87 static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp
index 5c96102..3c8010b 100644
--- a/linden/indra/llmessage/lliohttpserver.cpp
+++ b/linden/indra/llmessage/lliohttpserver.cpp
@@ -53,6 +53,7 @@
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");
56static const std::string CONTEXT_RESPONSE("response");
56static const std::string HTTP_VERB_GET("GET"); 57static const std::string HTTP_VERB_GET("GET");
57static const std::string HTTP_VERB_PUT("PUT"); 58static const std::string HTTP_VERB_PUT("PUT");
58static const std::string HTTP_VERB_POST("POST"); 59static const std::string HTTP_VERB_POST("POST");
@@ -156,10 +157,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
156 LLBufferStream istr(channels, buffer.get()); 157 LLBufferStream istr(channels, buffer.get());
157 158
158 static LLTimer timer; 159 static LLTimer timer;
159 if (sTimingCallback) 160 timer.reset();
160 {
161 timer.reset();
162 }
163 161
164 std::string verb = context[CONTEXT_REQUEST]["verb"]; 162 std::string verb = context[CONTEXT_REQUEST]["verb"];
165 if(verb == HTTP_VERB_GET) 163 if(verb == HTTP_VERB_GET)
@@ -189,6 +187,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
189 mResponse->methodNotAllowed(); 187 mResponse->methodNotAllowed();
190 } 188 }
191 189
190 F32 delta = timer.getElapsedTimeF32();
192 if (sTimingCallback) 191 if (sTimingCallback)
193 { 192 {
194 LLHTTPNode::Description desc; 193 LLHTTPNode::Description desc;
@@ -197,16 +196,20 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
197 std::string timing_name = info["description"]; 196 std::string timing_name = info["description"];
198 timing_name += " "; 197 timing_name += " ";
199 timing_name += verb; 198 timing_name += verb;
200 F32 delta = timer.getElapsedTimeF32();
201 sTimingCallback(timing_name.c_str(), delta, sTimingCallbackData); 199 sTimingCallback(timing_name.c_str(), delta, sTimingCallbackData);
202 } 200 }
203 201
202 // Log all HTTP transactions.
203 llinfos << verb << " " << context[CONTEXT_REQUEST]["path"].asString()
204 << " " << mStatusCode << " " << mStatusMessage << " " << delta
205 << "s" << llendl;
206
204 // Log Internal Server Errors 207 // Log Internal Server Errors
205 if(mStatusCode == 500) 208 //if(mStatusCode == 500)
206 { 209 //{
207 llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error" 210 // llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error"
208 << llendl; 211 // << llendl;
209 } 212 //}
210 } 213 }
211 214
212 PUMP_DEBUG; 215 PUMP_DEBUG;
@@ -223,7 +226,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
223 226
224 case STATE_GOOD_RESULT: 227 case STATE_GOOD_RESULT:
225 { 228 {
226 context["response"]["contentType"] = "application/xml"; 229 context[CONTEXT_RESPONSE]["contentType"] = "application/xml";
227 LLBufferStream ostr(channels, buffer.get()); 230 LLBufferStream ostr(channels, buffer.get());
228 LLSDSerialize::toXML(mGoodResult, ostr); 231 LLSDSerialize::toXML(mGoodResult, ostr);
229 232
@@ -232,9 +235,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
232 235
233 case STATE_STATUS_RESULT: 236 case STATE_STATUS_RESULT:
234 { 237 {
235 context["response"]["contentType"] = "text/plain"; 238 context[CONTEXT_RESPONSE]["contentType"] = "text/plain";
236 context["response"]["statusCode"] = mStatusCode; 239 context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode;
237 context["response"]["statusMessage"] = mStatusMessage; 240 context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage;
238 LLBufferStream ostr(channels, buffer.get()); 241 LLBufferStream ostr(channels, buffer.get());
239 ostr << mStatusMessage << std::ends; 242 ostr << mStatusMessage << std::ends;
240 243
@@ -371,9 +374,9 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
371 PUMP_DEBUG; 374 PUMP_DEBUG;
372 //mGotEOS = true; 375 //mGotEOS = true;
373 std::ostringstream ostr; 376 std::ostringstream ostr;
374 std::string message = context["response"]["statusMessage"]; 377 std::string message = context[CONTEXT_RESPONSE]["statusMessage"];
375 378
376 int code = context["response"]["statusCode"]; 379 int code = context[CONTEXT_RESPONSE]["statusCode"];
377 if (code < 200) 380 if (code < 200)
378 { 381 {
379 code = 200; 382 code = 200;
@@ -382,7 +385,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
382 385
383 ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; 386 ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n";
384 387
385 std::string type = context["response"]["contentType"].asString(); 388 std::string type = context[CONTEXT_RESPONSE]["contentType"].asString();
386 if (!type.empty()) 389 if (!type.empty())
387 { 390 {
388 ostr << "Content-Type: " << type << "\r\n"; 391 ostr << "Content-Type: " << type << "\r\n";
diff --git a/linden/indra/llmessage/llmessageconfig.cpp b/linden/indra/llmessage/llmessageconfig.cpp
index 8d114a9..6ecb1ad 100644
--- a/linden/indra/llmessage/llmessageconfig.cpp
+++ b/linden/indra/llmessage/llmessageconfig.cpp
@@ -252,3 +252,19 @@ bool LLMessageConfig::isCapBanned(const std::string& cap_name)
252{ 252{
253 return LLMessageConfigFile::instance().isCapBanned(cap_name); 253 return LLMessageConfigFile::instance().isCapBanned(cap_name);
254} 254}
255
256// return the web-service path to use for a given
257// message. This entry *should* match the entry
258// in simulator.xml!
259LLSD LLMessageConfig::getConfigForMessage(const std::string& msg_name)
260{
261 if (sServerName.empty())
262 {
263 llerrs << "LLMessageConfig::isMessageTrusted(name) before"
264 << " LLMessageConfig::initClass()" << llendl;
265 }
266 LLMessageConfigFile& file = LLMessageConfigFile::instance();
267 // LLSD for the CamelCase message name
268 LLSD config = file.mMessages[msg_name];
269 return config;
270}
diff --git a/linden/indra/llmessage/llmessageconfig.h b/linden/indra/llmessage/llmessageconfig.h
index ca09c27..86e7fb0 100644
--- a/linden/indra/llmessage/llmessageconfig.h
+++ b/linden/indra/llmessage/llmessageconfig.h
@@ -30,6 +30,7 @@
30#define LL_MESSAGECONFIG_H 30#define LL_MESSAGECONFIG_H
31 31
32#include <string> 32#include <string>
33#include "llsd.h"
33 34
34class LLSD; 35class LLSD;
35 36
@@ -50,5 +51,6 @@ public:
50 static SenderTrust getSenderTrustedness(const std::string& msg_name); 51 static SenderTrust getSenderTrustedness(const std::string& msg_name);
51 static bool isValidMessage(const std::string& msg_name); 52 static bool isValidMessage(const std::string& msg_name);
52 static bool isCapBanned(const std::string& cap_name); 53 static bool isCapBanned(const std::string& cap_name);
54 static LLSD getConfigForMessage(const std::string& msg_name);
53}; 55};
54#endif // LL_MESSAGECONFIG_H 56#endif // LL_MESSAGECONFIG_H
diff --git a/linden/indra/llmessage/llmessagereader.cpp b/linden/indra/llmessage/llmessagereader.cpp
index db4cbdf..2679019 100644
--- a/linden/indra/llmessage/llmessagereader.cpp
+++ b/linden/indra/llmessage/llmessagereader.cpp
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file llsdmessagereader.cpp 2 * @file llmessagereader.cpp
3 * @brief LLMessageReader class implementation 3 * @brief LLMessageReader class implementation
4 * 4 *
5 * Copyright (c) 2007-2007, Linden Research, Inc. 5 * Copyright (c) 2007-2007, Linden Research, Inc.
@@ -26,6 +26,7 @@
26 * COMPLETENESS OR PERFORMANCE. 26 * COMPLETENESS OR PERFORMANCE.
27 */ 27 */
28 28
29#include "linden_common.h"
29#include "llmessagereader.h" 30#include "llmessagereader.h"
30 31
31static BOOL sTimeDecodes = FALSE; 32static BOOL sTimeDecodes = FALSE;
diff --git a/linden/indra/llmessage/llmessagetemplateparser.cpp b/linden/indra/llmessage/llmessagetemplateparser.cpp
index eb5e87e..4c14ede 100644
--- a/linden/indra/llmessage/llmessagetemplateparser.cpp
+++ b/linden/indra/llmessage/llmessagetemplateparser.cpp
@@ -26,6 +26,7 @@
26 * COMPLETENESS OR PERFORMANCE. 26 * COMPLETENESS OR PERFORMANCE.
27 */ 27 */
28 28
29#include "linden_common.h"
29#include "llmessagetemplateparser.h" 30#include "llmessagetemplateparser.h"
30#include <boost/tokenizer.hpp> 31#include <boost/tokenizer.hpp>
31 32
diff --git a/linden/indra/llmessage/llnamevalue.cpp b/linden/indra/llmessage/llnamevalue.cpp
index 6e449ed..a11bf97 100644
--- a/linden/indra/llmessage/llnamevalue.cpp
+++ b/linden/indra/llmessage/llnamevalue.cpp
@@ -122,6 +122,9 @@ void LLNameValue::baseInit()
122 122
123 mSendto = NVS_NULL; 123 mSendto = NVS_NULL;
124 mStringSendto = NameValueSendtoStrings[NVS_NULL]; 124 mStringSendto = NameValueSendtoStrings[NVS_NULL];
125
126 mNameValueCB = NULL;
127 mUserData = NULL;
125} 128}
126 129
127void LLNameValue::init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, TNameValueCallback nvcb, void **user_data) 130void LLNameValue::init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, TNameValueCallback nvcb, void **user_data)
diff --git a/linden/indra/llmessage/llnamevalue.h b/linden/indra/llmessage/llnamevalue.h
index fe733fa..580c99d 100644
--- a/linden/indra/llmessage/llnamevalue.h
+++ b/linden/indra/llmessage/llnamevalue.h
@@ -194,7 +194,6 @@ public:
194 ENameValueSendto mSendto; 194 ENameValueSendto mSendto;
195 195
196 UNameValueReference mNameValueReference; 196 UNameValueReference mNameValueReference;
197 S32 mNumberEntries;
198 LLStringTable *mNVNameTable; 197 LLStringTable *mNVNameTable;
199 TNameValueCallback mNameValueCB; 198 TNameValueCallback mNameValueCB;
200 void **mUserData; 199 void **mUserData;
diff --git a/linden/indra/llmessage/llservicebuilder.cpp b/linden/indra/llmessage/llservicebuilder.cpp
index 91040c0..0b35a69 100644
--- a/linden/indra/llmessage/llservicebuilder.cpp
+++ b/linden/indra/llmessage/llservicebuilder.cpp
@@ -109,7 +109,7 @@ std::string LLServiceBuilder::buildServiceURI(
109 const LLSD& option_map) 109 const LLSD& option_map)
110{ 110{
111 std::string service_url = buildServiceURI(service_name); 111 std::string service_url = buildServiceURI(service_name);
112 112
113 // Find the Service Name 113 // Find the Service Name
114 if(!service_url.empty() && option_map.isMap()) 114 if(!service_url.empty() && option_map.isMap())
115 { 115 {
@@ -128,6 +128,23 @@ std::string LLServiceBuilder::buildServiceURI(
128 find_pos, 128 find_pos,
129 variable_name.length(), 129 variable_name.length(),
130 (*option_itr).second.asString()); 130 (*option_itr).second.asString());
131 continue;
132 }
133 variable_name.assign("{%");
134 variable_name.append((*option_itr).first);
135 variable_name.append("}");
136 find_pos = service_url.find(variable_name);
137 if(find_pos != std::string::npos)
138 {
139 std::string query_str = LLURI::mapToQueryString(
140 (*option_itr).second);
141 if(!query_str.empty())
142 {
143 service_url.replace(
144 find_pos,
145 variable_name.length(),
146 query_str);
147 }
131 } 148 }
132 } 149 }
133 } 150 }
diff --git a/linden/indra/llmessage/lltemplatemessagereader.cpp b/linden/indra/llmessage/lltemplatemessagereader.cpp
index a1f5213..329d2a8 100644
--- a/linden/indra/llmessage/lltemplatemessagereader.cpp
+++ b/linden/indra/llmessage/lltemplatemessagereader.cpp
@@ -26,6 +26,7 @@
26 * COMPLETENESS OR PERFORMANCE. 26 * COMPLETENESS OR PERFORMANCE.
27 */ 27 */
28 28
29#include "linden_common.h"
29#include "lltemplatemessagereader.h" 30#include "lltemplatemessagereader.h"
30 31
31#include "llfasttimer.h" 32#include "llfasttimer.h"
@@ -351,7 +352,7 @@ void LLTemplateMessageReader::getF64(const char *block, const char *var,
351void LLTemplateMessageReader::getVector3(const char *block, const char *var, 352void LLTemplateMessageReader::getVector3(const char *block, const char *var,
352 LLVector3 &v, S32 blocknum ) 353 LLVector3 &v, S32 blocknum )
353{ 354{
354 getData(block, var, v.mV, sizeof(v.mV), blocknum); 355 getData(block, var, &v.mV[0], sizeof(v.mV), blocknum);
355 356
356 if( !v.isFinite() ) 357 if( !v.isFinite() )
357 { 358 {
@@ -364,7 +365,7 @@ void LLTemplateMessageReader::getVector3(const char *block, const char *var,
364void LLTemplateMessageReader::getVector4(const char *block, const char *var, 365void LLTemplateMessageReader::getVector4(const char *block, const char *var,
365 LLVector4 &v, S32 blocknum) 366 LLVector4 &v, S32 blocknum)
366{ 367{
367 getData(block, var, v.mV, sizeof(v.mV), blocknum); 368 getData(block, var, &v.mV[0], sizeof(v.mV), blocknum);
368 369
369 if( !v.isFinite() ) 370 if( !v.isFinite() )
370 { 371 {
@@ -377,7 +378,7 @@ void LLTemplateMessageReader::getVector4(const char *block, const char *var,
377void LLTemplateMessageReader::getVector3d(const char *block, const char *var, 378void LLTemplateMessageReader::getVector3d(const char *block, const char *var,
378 LLVector3d &v, S32 blocknum ) 379 LLVector3d &v, S32 blocknum )
379{ 380{
380 getData(block, var, v.mdV, sizeof(v.mdV), blocknum); 381 getData(block, var, &v.mdV[0], sizeof(v.mdV), blocknum);
381 382
382 if( !v.isFinite() ) 383 if( !v.isFinite() )
383 { 384 {
@@ -392,7 +393,7 @@ void LLTemplateMessageReader::getQuat(const char *block, const char *var,
392 LLQuaternion &q, S32 blocknum) 393 LLQuaternion &q, S32 blocknum)
393{ 394{
394 LLVector3 vec; 395 LLVector3 vec;
395 getData(block, var, vec.mV, sizeof(vec.mV), blocknum); 396 getData(block, var, &vec.mV[0], sizeof(vec.mV), blocknum);
396 if( vec.isFinite() ) 397 if( vec.isFinite() )
397 { 398 {
398 q.unpackFromVector3( vec ); 399 q.unpackFromVector3( vec );
@@ -408,7 +409,7 @@ void LLTemplateMessageReader::getQuat(const char *block, const char *var,
408void LLTemplateMessageReader::getUUID(const char *block, const char *var, 409void LLTemplateMessageReader::getUUID(const char *block, const char *var,
409 LLUUID &u, S32 blocknum) 410 LLUUID &u, S32 blocknum)
410{ 411{
411 getData(block, var, u.mData, sizeof(u.mData), blocknum); 412 getData(block, var, &u.mData[0], sizeof(u.mData), blocknum);
412} 413}
413 414
414inline void LLTemplateMessageReader::getIPAddr(const char *block, const char *var, U32 &u, S32 blocknum) 415inline void LLTemplateMessageReader::getIPAddr(const char *block, const char *var, U32 &u, S32 blocknum)
diff --git a/linden/indra/llmessage/lluseroperation.cpp b/linden/indra/llmessage/lluseroperation.cpp
index 29146ea..f43e02a 100644
--- a/linden/indra/llmessage/lluseroperation.cpp
+++ b/linden/indra/llmessage/lluseroperation.cpp
@@ -42,7 +42,8 @@ LLUserOperationMgr* gUserOperationMgr = NULL;
42 42
43LLUserOperation::LLUserOperation(const LLUUID& agent_id) 43LLUserOperation::LLUserOperation(const LLUUID& agent_id)
44: mAgentID(agent_id), 44: mAgentID(agent_id),
45 mTimer() 45 mTimer(),
46 mNoExpire(FALSE)
46{ 47{
47 mTransactionID.generate(); 48 mTransactionID.generate();
48} 49}
@@ -51,14 +52,16 @@ LLUserOperation::LLUserOperation(const LLUUID& agent_id,
51 const LLUUID& transaction_id) : 52 const LLUUID& transaction_id) :
52 mAgentID(agent_id), 53 mAgentID(agent_id),
53 mTransactionID(transaction_id), 54 mTransactionID(transaction_id),
54 mTimer() 55 mTimer(),
56 mNoExpire(FALSE)
55{ 57{
56} 58}
57 59
58// protected constructor which is used by base classes that determine 60// protected constructor which is used by base classes that determine
59// transaction, agent, et. after construction. 61// transaction, agent, et. after construction.
60LLUserOperation::LLUserOperation() : 62LLUserOperation::LLUserOperation() :
61 mTimer() 63 mTimer(),
64 mNoExpire(FALSE)
62{ 65{
63} 66}
64 67
@@ -66,11 +69,19 @@ LLUserOperation::~LLUserOperation()
66{ 69{
67} 70}
68 71
72void LLUserOperation::SetNoExpireFlag(const BOOL flag)
73{
74 mNoExpire = flag;
75}
69 76
70BOOL LLUserOperation::isExpired() 77BOOL LLUserOperation::isExpired()
71{ 78{
72 const F32 EXPIRE_TIME_SECS = 10.f; 79 if (!mNoExpire)
73 return mTimer.getElapsedTimeF32() > EXPIRE_TIME_SECS; 80 {
81 const F32 EXPIRE_TIME_SECS = 10.f;
82 return mTimer.getElapsedTimeF32() > EXPIRE_TIME_SECS;
83 }
84 return FALSE;
74} 85}
75 86
76void LLUserOperation::expire() 87void LLUserOperation::expire()
diff --git a/linden/indra/llmessage/lluseroperation.h b/linden/indra/llmessage/lluseroperation.h
index 2b351f9..6ac2862 100644
--- a/linden/indra/llmessage/lluseroperation.h
+++ b/linden/indra/llmessage/lluseroperation.h
@@ -48,6 +48,9 @@ public:
48 // Operation never got necessary data, so expired 48 // Operation never got necessary data, so expired
49 virtual BOOL isExpired(); 49 virtual BOOL isExpired();
50 50
51 // ability to mark this operation as never expiring.
52 void SetNoExpireFlag(const BOOL flag);
53
51 // Send request to the dataserver 54 // Send request to the dataserver
52 virtual void sendRequest() = 0; 55 virtual void sendRequest() = 0;
53 56
@@ -67,6 +70,7 @@ protected:
67 LLUUID mAgentID; 70 LLUUID mAgentID;
68 LLUUID mTransactionID; 71 LLUUID mTransactionID;
69 LLFrameTimer mTimer; 72 LLFrameTimer mTimer;
73 BOOL mNoExpire; // this is used for operations that expect an answer and will wait till it gets one.
70}; 74};
71 75
72 76
diff --git a/linden/indra/llmessage/llxfer_file.cpp b/linden/indra/llmessage/llxfer_file.cpp
index 33db248..b36dd5a 100644
--- a/linden/indra/llmessage/llxfer_file.cpp
+++ b/linden/indra/llmessage/llxfer_file.cpp
@@ -289,7 +289,11 @@ S32 LLXfer_File::flush()
289 289
290 if (mFp) 290 if (mFp)
291 { 291 {
292 fwrite(mBuffer,1,mBufferLength,mFp); 292 if (fwrite(mBuffer,1,mBufferLength,mFp) != mBufferLength)
293 {
294 llwarns << "Short write" << llendl;
295 }
296
293// llinfos << "******* wrote " << mBufferLength << " bytes of file xfer" << llendl; 297// llinfos << "******* wrote " << mBufferLength << " bytes of file xfer" << llendl;
294 fclose(mFp); 298 fclose(mFp);
295 mFp = NULL; 299 mFp = NULL;
diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp
index 01dce40..a9d5dd3 100644
--- a/linden/indra/llmessage/message.cpp
+++ b/linden/indra/llmessage/message.cpp
@@ -405,6 +405,7 @@ LLMessageSystem::~LLMessageSystem()
405 { 405 {
406 end_net(mSocket); 406 end_net(mSocket);
407 } 407 }
408 mSocket = 0;
408 409
409 delete mTemplateMessageReader; 410 delete mTemplateMessageReader;
410 mTemplateMessageReader = NULL; 411 mTemplateMessageReader = NULL;
diff --git a/linden/indra/llmessage/message.h b/linden/indra/llmessage/message.h
index 6c834f7..d18bd09 100644
--- a/linden/indra/llmessage/message.h
+++ b/linden/indra/llmessage/message.h
@@ -39,6 +39,10 @@
39#include <netinet/in.h> 39#include <netinet/in.h>
40#endif 40#endif
41 41
42#if LL_SOLARIS
43#include <netinet/in.h>
44#endif
45
42#if LL_WINDOWS 46#if LL_WINDOWS
43#include "winsock2.h" // htons etc. 47#include "winsock2.h" // htons etc.
44#endif 48#endif
@@ -204,14 +208,14 @@ public:
204class LLMessageSystem 208class LLMessageSystem
205{ 209{
206 private: 210 private:
207 U8 mSendBuffer[MAX_BUFFER_SIZE]; 211 U8 mSendBuffer[MAX_BUFFER_SIZE];
208 S32 mSendSize; 212 S32 mSendSize;
209 213
210 public: 214 public:
211 LLPacketRing mPacketRing; 215 LLPacketRing mPacketRing;
212 LLReliablePacketParams mReliablePacketParams; 216 LLReliablePacketParams mReliablePacketParams;
213 217
214 //LLLinkedList<LLPacketAck> mAckList; 218 //LLLinkedList<LLPacketAck> mAckList;
215 219
216 // Set this flag to TRUE when you want *very* verbose logs. 220 // Set this flag to TRUE when you want *very* verbose logs.
217 BOOL mVerboseLog; 221 BOOL mVerboseLog;
@@ -222,36 +226,35 @@ class LLMessageSystem
222 typedef std::map<U32, LLMessageTemplate*> message_template_number_map_t; 226 typedef std::map<U32, LLMessageTemplate*> message_template_number_map_t;
223 227
224private: 228private:
225 message_template_name_map_t mMessageTemplates; 229 message_template_name_map_t mMessageTemplates;
226 message_template_number_map_t mMessageNumbers; 230 message_template_number_map_t mMessageNumbers;
227 231
228public: 232public:
229 S32 mSystemVersionMajor; 233 S32 mSystemVersionMajor;
230 S32 mSystemVersionMinor; 234 S32 mSystemVersionMinor;
231 S32 mSystemVersionPatch; 235 S32 mSystemVersionPatch;
232 S32 mSystemVersionServer; 236 S32 mSystemVersionServer;
233 U32 mVersionFlags; 237 U32 mVersionFlags;
234 238
239 BOOL mbProtected;
235 240
236 BOOL mbProtected; 241 U32 mNumberHighFreqMessages;
242 U32 mNumberMediumFreqMessages;
243 U32 mNumberLowFreqMessages;
244 S32 mPort;
245 S32 mSocket;
237 246
238 U32 mNumberHighFreqMessages; 247 U32 mPacketsIn; // total packets in, including compressed and uncompressed
239 U32 mNumberMediumFreqMessages; 248 U32 mPacketsOut; // total packets out, including compressed and uncompressed
240 U32 mNumberLowFreqMessages;
241 S32 mPort;
242 S32 mSocket;
243 249
244 U32 mPacketsIn; // total packets in, including compressed and uncompressed 250 U64 mBytesIn; // total bytes in, including compressed and uncompressed
245 U32 mPacketsOut; // total packets out, including compressed and uncompressed 251 U64 mBytesOut; // total bytes out, including compressed and uncompressed
246
247 U64 mBytesIn; // total bytes in, including compressed and uncompressed
248 U64 mBytesOut; // total bytes out, including compressed and uncompressed
249 252
250 U32 mCompressedPacketsIn; // total compressed packets in 253 U32 mCompressedPacketsIn; // total compressed packets in
251 U32 mCompressedPacketsOut; // total compressed packets out 254 U32 mCompressedPacketsOut; // total compressed packets out
252 255
253 U32 mReliablePacketsIn; // total reliable packets in 256 U32 mReliablePacketsIn; // total reliable packets in
254 U32 mReliablePacketsOut; // total reliable packets out 257 U32 mReliablePacketsOut; // total reliable packets out
255 258
256 U32 mDroppedPackets; // total dropped packets in 259 U32 mDroppedPackets; // total dropped packets in
257 U32 mResentPackets; // total resent packets out 260 U32 mResentPackets; // total resent packets out
@@ -259,26 +262,26 @@ public:
259 U32 mOffCircuitPackets; // total # of off-circuit packets rejected 262 U32 mOffCircuitPackets; // total # of off-circuit packets rejected
260 U32 mInvalidOnCircuitPackets; // total # of on-circuit but invalid packets rejected 263 U32 mInvalidOnCircuitPackets; // total # of on-circuit but invalid packets rejected
261 264
262 S64 mUncompressedBytesIn; // total uncompressed size of compressed packets in 265 S64 mUncompressedBytesIn; // total uncompressed size of compressed packets in
263 S64 mUncompressedBytesOut; // total uncompressed size of compressed packets out 266 S64 mUncompressedBytesOut; // total uncompressed size of compressed packets out
264 S64 mCompressedBytesIn; // total compressed size of compressed packets in 267 S64 mCompressedBytesIn; // total compressed size of compressed packets in
265 S64 mCompressedBytesOut; // total compressed size of compressed packets out 268 S64 mCompressedBytesOut; // total compressed size of compressed packets out
266 S64 mTotalBytesIn; // total size of all uncompressed packets in 269 S64 mTotalBytesIn; // total size of all uncompressed packets in
267 S64 mTotalBytesOut; // total size of all uncompressed packets out 270 S64 mTotalBytesOut; // total size of all uncompressed packets out
268 271
269 BOOL mSendReliable; // does the outgoing message require a pos ack? 272 BOOL mSendReliable; // does the outgoing message require a pos ack?
270 273
271 LLCircuit mCircuitInfo; 274 LLCircuit mCircuitInfo;
272 F64 mCircuitPrintTime; // used to print circuit debug info every couple minutes 275 F64 mCircuitPrintTime; // used to print circuit debug info every couple minutes
273 F32 mCircuitPrintFreq; // seconds 276 F32 mCircuitPrintFreq; // seconds
274 277
275 std::map<U64, U32> mIPPortToCircuitCode; 278 std::map<U64, U32> mIPPortToCircuitCode;
276 std::map<U32, U64> mCircuitCodeToIPPort; 279 std::map<U32, U64> mCircuitCodeToIPPort;
277 U32 mOurCircuitCode; 280 U32 mOurCircuitCode;
278 S32 mSendPacketFailureCount; 281 S32 mSendPacketFailureCount;
279 S32 mUnackedListDepth; 282 S32 mUnackedListDepth;
280 S32 mUnackedListSize; 283 S32 mUnackedListSize;
281 S32 mDSMaxListDepth; 284 S32 mDSMaxListDepth;
282 285
283public: 286public:
284 // Read file and build message templates 287 // Read file and build message templates
@@ -693,14 +696,14 @@ private:
693 696
694 LLMessagePollInfo *mPollInfop; 697 LLMessagePollInfo *mPollInfop;
695 698
696 U8 mEncodedRecvBuffer[MAX_BUFFER_SIZE]; 699 U8 mEncodedRecvBuffer[MAX_BUFFER_SIZE];
697 U8 mTrueReceiveBuffer[MAX_BUFFER_SIZE]; 700 U8 mTrueReceiveBuffer[MAX_BUFFER_SIZE];
698 S32 mTrueReceiveSize; 701 S32 mTrueReceiveSize;
699 702
700 // Must be valid during decode 703 // Must be valid during decode
701 704
702 BOOL mbError; 705 BOOL mbError;
703 S32 mErrorCode; 706 S32 mErrorCode;
704 707
705 F64 mResendDumpTime; // The last time we dumped resends 708 F64 mResendDumpTime; // The last time we dumped resends
706 709
@@ -775,6 +778,10 @@ void null_message_callback(LLMessageSystem *msg, void **data);
775// Inlines 778// Inlines
776// 779//
777 780
781#if !defined( LL_BIG_ENDIAN ) && !defined( LL_LITTLE_ENDIAN )
782#error Unknown endianness for htonmemcpy. Did you miss a common include?
783#endif
784
778static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, size_t n) 785static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, size_t n)
779{ 786{
780 char *s = (char *)vs; 787 char *s = (char *)vs;