Monty Brandenberg avatar Monty Brandenberg committed 77e8b94

DRTVWR-209 Additional merge of viewer-development with SH-3316 drano-http code.
Restore original deleteRequest/removeRequest implementation removing
a small race. Remove a short-lived additional timeout scheme on requests
which really isn't appropriate as originally implemented as we can have
very long-lived requests on big regions.

Comments (0)

Files changed (1)

indra/newview/lltexturefetch.cpp

 // Threads:  Ttf
 bool LLTextureFetchWorker::doWork(S32 param)
 {
-	static const F32 FETCHING_TIMEOUT = 120.f;//seconds
-	
 	static const LLCore::HttpStatus http_not_found(HTTP_NOT_FOUND);						// 404
 	static const LLCore::HttpStatus http_service_unavail(HTTP_SERVICE_UNAVAILABLE);		// 503
 	static const LLCore::HttpStatus http_not_sat(HTTP_REQUESTED_RANGE_NOT_SATISFIABLE);	// 416;
 		}
 		else
 		{
-			// *FIXME:  This auxiliary timeout logic appeared recently and then
-			// quickly disappeared.  While I haven't seen it invoked, I'm leaving
-			// it active for now.  
-			if(FETCHING_TIMEOUT < mRequestedTimer.getElapsedTimeF32())
-			{
-				//timeout, abort.
-				LL_WARNS("Texture") << "Fetch of texture " << mID << " timed out after "
-									<< mRequestedTimer.getElapsedTimeF32()
-									<< " seconds.  Canceling request." << LL_ENDL;
-
-				if (LLCORE_HTTP_HANDLE_INVALID != mHttpHandle)
-				{
-					// Issue cancel on any outstanding request.  Asynchronous
-					// so cancel may not actually take effect if operation is
-					// complete & queued.  Either way, notification will
-					// complete and the request can be transitioned.
-					mFetcher->mHttpRequest->requestCancel(mHttpHandle, NULL);
-				}
-				else
-				{
-					// Shouldn't happen but if it does, cancel quickly.
-					mState = DONE;
-					releaseHttpSemaphore();
-					return true;
-				}
-			}
+			// *HISTORY:  There was a texture timeout test here originally that
+			// would cancel a request that was over 120 seconds old.  That's
+			// probably not a good idea.  Particularly rich regions can take
+			// an enormous amount of time to load textures.  We'll revisit the
+			// various possible timeout components (total request time, connection
+			// time, I/O time, with and without retries, etc.) in the future.
 
 			setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority);
 			return false;
 	mHTTPTextureBits += received_size * 8; // Approximate - does not include header bits	
 }																		// -Mfnq
 
+// NB:  If you change deleteRequest() you should probably make
+// parallel changes in removeRequest().  They're functionally
+// identical with only argument variations.
+//
 // Threads:  T*
 void LLTextureFetch::deleteRequest(const LLUUID& id, bool cancel)
 {
 	lockQueue();														// +Mfq
 	LLTextureFetchWorker* worker = getWorkerAfterLock(id);
-	unlockQueue();														// -Mfq
-
-	// *TODO:  Refactoring this code may have introduced a thread race
-	// here where other code can run between the lookup above and the
-	// removeRequest() below.
-	removeRequest(worker, cancel);
+	if (worker)
+	{		
+		size_t erased_1 = mRequestMap.erase(worker->mID);
+		unlockQueue();													// -Mfq
+
+		llassert_always(erased_1 > 0) ;
+		removeFromNetworkQueue(worker, cancel);
+		llassert_always(!(worker->getFlags(LLWorkerClass::WCF_DELETE_REQUESTED))) ;
+
+		worker->scheduleDelete();	
+	}
+	else
+	{
+		unlockQueue();													// -Mfq
+	}
 }
 
+// NB:  If you change removeRequest() you should probably make
+// parallel changes in deleteRequest().  They're functionally
+// identical with only argument variations.
+//
 // Threads:  T*
 void LLTextureFetch::removeRequest(LLTextureFetchWorker* worker, bool cancel)
 {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.