Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-09-08 13:35:09 +02:00
commit b776aa1665
1 changed files with 49 additions and 4 deletions

View File

@ -8751,16 +8751,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Parcel related packets #region Parcel related packets
// acumulate several HandleRegionHandleRequest consecutive overlaping requests
// to be done with minimal resources as possible
// variables temporary here while in test
Queue<UUID> RegionHandleRequests = new Queue<UUID>();
bool RegionHandleRequestsInService = false;
private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack)
{ {
RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; UUID currentUUID;
RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest;
if (handlerRegionHandleRequest != null)
if (handlerRegionHandleRequest == null)
return true;
RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
lock (RegionHandleRequests)
{ {
handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); if (RegionHandleRequestsInService)
{
// we are already busy doing a previus request
// so enqueue it
RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID);
return true;
}
// else do it
currentUUID = rhrPack.RequestBlock.RegionID;
RegionHandleRequestsInService = true;
} }
return true;
while (true)
{
handlerRegionHandleRequest(this, currentUUID);
lock (RegionHandleRequests)
{
// exit condition, nothing to do or closed
// current code seems to assume we may loose the handler at anytime,
// so keep checking it
handlerRegionHandleRequest = OnRegionHandleRequest;
if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null)
{
RegionHandleRequests.Clear();
RegionHandleRequestsInService = false;
return true;
}
currentUUID = RegionHandleRequests.Dequeue();
}
}
return true; // actually unreached
} }
private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack)