aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltexturefetch.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/lltexturefetch.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp
index 8ff9e9f..3a5665c 100644
--- a/linden/indra/newview/lltexturefetch.cpp
+++ b/linden/indra/newview/lltexturefetch.cpp
@@ -744,13 +744,17 @@ bool LLTextureFetchWorker::doWork(S32 param)
744 } 744 }
745 else if (mSentRequest == UNSENT) 745 else if (mSentRequest == UNSENT)
746 { 746 {
747 // Add this to the network queue and sit here. 747 if(mFetcher->mQueueMutex.tryLock())
748 // LLTextureFetch::update() will send off a request which will change our state 748 {
749 mRequestedSize = mDesiredSize; 749 // Add this to the network queue and sit here.
750 mRequestedDiscard = mDesiredDiscard; 750 // LLTextureFetch::update() will send off a request which will change our state
751 mSentRequest = QUEUED; 751 mRequestedSize = mDesiredSize;
752 mFetcher->addToNetworkQueue(this); 752 mRequestedDiscard = mDesiredDiscard;
753 setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); 753 mSentRequest = QUEUED;
754 mFetcher->addToNetworkQueue(this);
755 setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority);
756 mFetcher->mQueueMutex.unlock();
757 }
754 return false; 758 return false;
755 } 759 }
756 else 760 else
@@ -800,7 +804,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
800 // Set the throttle to the entire bandwidth, assuming UDP packets will get priority 804 // Set the throttle to the entire bandwidth, assuming UDP packets will get priority
801 // when they are needed 805 // when they are needed
802 F32 max_bandwidth = mFetcher->mMaxBandwidth; 806 F32 max_bandwidth = mFetcher->mMaxBandwidth;
803 if ((mFetcher->getHTTPQueueSize() >= HTTP_QUEUE_MAX_SIZE) || 807 if ((mFetcher->getNumHTTPRequests() >= HTTP_QUEUE_MAX_SIZE) ||
804 (mFetcher->getTextureBandwidth() > max_bandwidth)) 808 (mFetcher->getTextureBandwidth() > max_bandwidth))
805 { 809 {
806 // Make normal priority and return (i.e. wait until there is room in the queue) 810 // Make normal priority and return (i.e. wait until there is room in the queue)
@@ -1469,12 +1473,13 @@ void LLTextureFetch::deleteRequest(const LLUUID& id, bool cancel)
1469 } 1473 }
1470} 1474}
1471 1475
1476// Need to hold mQueueMutex when entering this function SNOW-196
1477// Snowglobe ToDo fix holding mQueueMutex over the entire function, we only need
1478// it for the mRequestMap access
1472// protected 1479// protected
1473void LLTextureFetch::addToNetworkQueue(LLTextureFetchWorker* worker) 1480void LLTextureFetch::addToNetworkQueue(LLTextureFetchWorker* worker)
1474{ 1481{
1475 mQueueMutex.lock();
1476 bool is_worker_in_request_map = (mRequestMap.find(worker->mID) != mRequestMap.end()); 1482 bool is_worker_in_request_map = (mRequestMap.find(worker->mID) != mRequestMap.end());
1477 mQueueMutex.unlock();
1478 1483
1479 LLMutexLock lock(&mNetworkQueueMutex); 1484 LLMutexLock lock(&mNetworkQueueMutex);
1480 if (is_worker_in_request_map) 1485 if (is_worker_in_request_map)
@@ -1916,6 +1921,7 @@ bool LLTextureFetch::receiveImageHeader(const LLHost& host, const LLUUID& id, U8
1916 { 1921 {
1917// llwarns << "Received header for non active worker: " << id << llendl; 1922// llwarns << "Received header for non active worker: " << id << llendl;
1918 ++mBadPacketCount; 1923 ++mBadPacketCount;
1924 LLMutexLock lock2(&mNetworkQueueMutex);
1919 mCancelQueue[host].insert(id); 1925 mCancelQueue[host].insert(id);
1920 return false; 1926 return false;
1921 } 1927 }
@@ -1944,6 +1950,7 @@ bool LLTextureFetch::receiveImageHeader(const LLHost& host, const LLUUID& id, U8
1944 if (!res) 1950 if (!res)
1945 { 1951 {
1946 ++mBadPacketCount; 1952 ++mBadPacketCount;
1953 LLMutexLock lock2(&mNetworkQueueMutex);
1947 mCancelQueue[host].insert(id); 1954 mCancelQueue[host].insert(id);
1948 } 1955 }
1949 else 1956 else
@@ -1988,6 +1995,7 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1
1988 if (!res) 1995 if (!res)
1989 { 1996 {
1990 ++mBadPacketCount; 1997 ++mBadPacketCount;
1998 LLMutexLock lock2(&mNetworkQueueMutex);
1991 mCancelQueue[host].insert(id); 1999 mCancelQueue[host].insert(id);
1992 return false; 2000 return false;
1993 } 2001 }