FIRE-18295: Region eventually gets spammed with MapBlockRequest messages

Fri, 13 May 2016 17:00:39 +0200

author
Ansariel
date
Fri, 13 May 2016 17:00:39 +0200
changeset 48966
e5afca0dc5fd
parent 48965
79f76ecb6bc8
child 48967
a3e2de1438f1

FIRE-18295: Region eventually gets spammed with MapBlockRequest messages

indra/newview/llworldmap.cpp file | annotate | diff | revisions
indra/newview/llworldmap.h file | annotate | diff | revisions
     1.1 --- a/indra/newview/llworldmap.cpp	Wed May 11 21:42:52 2016 -0500
     1.2 +++ b/indra/newview/llworldmap.cpp	Fri May 13 17:00:39 2016 +0200
     1.3 @@ -256,8 +256,7 @@
     1.4  	mIsTrackingDoubleClick( false ),
     1.5  	mIsTrackingCommit( false ),
     1.6  	mTrackingLocation( 0, 0, 0 ),
     1.7 -	mFirstRequest(true),
     1.8 -	mMapBlockLastUpdate(0.0) // <FS:Ansariel> Periodically update sim info
     1.9 +	mFirstRequest(true)
    1.10  {
    1.11  	//LL_INFOS("World Map") << "Creating the World Map -> LLWorldMap::LLWorldMap()" << LL_ENDL;
    1.12  	mMapBlockLoaded = new bool[MAP_BLOCK_RES*MAP_BLOCK_RES];
    1.13 @@ -332,7 +331,6 @@
    1.14  	{
    1.15  		mMapBlockLoaded[idx] = false;
    1.16  		// <FS:Ansariel> Periodically update sim info
    1.17 -		mMapBlockLastUpdate = 0.0;
    1.18  		mMapBlockLastUpdateOffsets.clear();
    1.19  		// </FS:Ansariel>
    1.20  	}
    1.21 @@ -662,9 +660,19 @@
    1.22  	y1 = y1 / MAP_BLOCK_SIZE;
    1.23  
    1.24  	// <FS:Ansariel> Periodically update sim info
    1.25 -	std::set<S32> new_offsets;
    1.26 -	bool did_update = false;
    1.27 +	block_last_update_map_t new_offsets;
    1.28  	F64 time_now = LLTimer::getElapsedSeconds();
    1.29 +
    1.30 +	// Remove blocks that have been request more than BLOCK_UPDATE_TIMER ago
    1.31 +	// so we re-request them for an update
    1.32 +	for (block_last_update_map_t::iterator it = mMapBlockLastUpdateOffsets.begin(); it != mMapBlockLastUpdateOffsets.end(); ++it)
    1.33 +	{
    1.34 +		if ((time_now - it->second) <= BLOCK_UPDATE_TIMER)
    1.35 +		{
    1.36 +			new_offsets[it->first] = it->second;
    1.37 +		}
    1.38 +	}
    1.39 +	mMapBlockLastUpdateOffsets.swap(new_offsets);
    1.40  	// </FS:Ansariel>
    1.41  
    1.42  	// Load the region info those blocks
    1.43 @@ -675,27 +683,17 @@
    1.44  			S32 offset = block_x | (block_y * MAP_BLOCK_RES);
    1.45  			// <FS:Ansariel> Periodically update sim info
    1.46  			//if (!mMapBlockLoaded[offset])
    1.47 -			if (!mMapBlockLoaded[offset] || (time_now - mMapBlockLastUpdate) > BLOCK_UPDATE_TIMER || mMapBlockLastUpdateOffsets.find(offset) == mMapBlockLastUpdateOffsets.end())
    1.48 +			if (!mMapBlockLoaded[offset] || mMapBlockLastUpdateOffsets.find(offset) == mMapBlockLastUpdateOffsets.end())
    1.49  			// </FS:Ansariel>
    1.50  			{
    1.51   				//LL_INFOS("World Map") << "Loading Block (" << block_x << "," << block_y << ")" << LL_ENDL;
    1.52  				LLWorldMapMessage::getInstance()->sendMapBlockRequest(block_x * MAP_BLOCK_SIZE, block_y * MAP_BLOCK_SIZE, (block_x * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1, (block_y * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1);
    1.53  				mMapBlockLoaded[offset] = true;
    1.54  				// <FS:Ansariel> Periodically update sim info
    1.55 -				new_offsets.insert(offset);
    1.56 -				did_update = true;
    1.57 -				// </FS:Ansariel>
    1.58 +				mMapBlockLastUpdateOffsets[offset] = time_now;
    1.59  			}
    1.60  		}
    1.61  	}
    1.62 -
    1.63 -	// <FS:Ansariel> Periodically update sim info
    1.64 -	if (did_update)
    1.65 -	{
    1.66 -		mMapBlockLastUpdate = time_now;
    1.67 -		mMapBlockLastUpdateOffsets.swap(new_offsets);
    1.68 -	}
    1.69 -	// </FS:Ansariel>
    1.70  }
    1.71  
    1.72  void LLWorldMap::dump()
     2.1 --- a/indra/newview/llworldmap.h	Wed May 11 21:42:52 2016 -0500
     2.2 +++ b/indra/newview/llworldmap.h	Fri May 13 17:00:39 2016 +0200
     2.3 @@ -294,8 +294,8 @@
     2.4  	bool *			mMapBlockLoaded;		// Telling us if the block of regions has been requested or not
     2.5  
     2.6  	// <FS:Ansariel> Periodically update sim info
     2.7 -	F64				mMapBlockLastUpdate;
     2.8 -	std::set<S32>	mMapBlockLastUpdateOffsets;
     2.9 +	typedef std::map<S32, F64> block_last_update_map_t;
    2.10 +	block_last_update_map_t	mMapBlockLastUpdateOffsets;
    2.11  
    2.12  	// Track location data : used while there's nothing tracked yet by LLTracker
    2.13  	bool			mIsTrackingLocation;	// True when we're tracking a point

mercurial