diff options
Diffstat (limited to 'linden/indra/llmessage/llurlrequest.cpp')
-rw-r--r-- | linden/indra/llmessage/llurlrequest.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
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 | ||