diff options
author | UbitUmarov | 2012-09-08 12:22:40 +0100 |
---|---|---|
committer | UbitUmarov | 2012-09-08 12:22:40 +0100 |
commit | a91ca984d57a4177ff31898e384ee85948d4eff1 (patch) | |
tree | 620abcf38786f49c7d0b90478a88d3c24164ed36 /OpenSim | |
parent | One more redundante ParcelProprieties on login (diff) | |
download | opensim-SC-a91ca984d57a4177ff31898e384ee85948d4eff1.zip opensim-SC-a91ca984d57a4177ff31898e384ee85948d4eff1.tar.gz opensim-SC-a91ca984d57a4177ff31898e384ee85948d4eff1.tar.bz2 opensim-SC-a91ca984d57a4177ff31898e384ee85948d4eff1.tar.xz |
llClientView: try to have only one thread per client processing
RegionHandleRequests. (code assumes packet handle is called async as it is not)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e78ebed..7749ef3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -8751,16 +8751,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8751 | 8751 | ||
8752 | #region Parcel related packets | 8752 | #region Parcel related packets |
8753 | 8753 | ||
8754 | // acumulate several HandleRegionHandleRequest consecutive overlaping requests | ||
8755 | // to be done with minimal resources as possible | ||
8756 | // variables temporary here while in test | ||
8757 | |||
8758 | Queue<UUID> RegionHandleRequests = new Queue<UUID>(); | ||
8759 | bool RegionHandleRequestsInService = false; | ||
8760 | |||
8754 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) | 8761 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) |
8755 | { | 8762 | { |
8756 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | 8763 | UUID currentUUID; |
8757 | 8764 | ||
8758 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; | 8765 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; |
8759 | if (handlerRegionHandleRequest != null) | 8766 | |
8767 | if (handlerRegionHandleRequest == null) | ||
8768 | return true; | ||
8769 | |||
8770 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | ||
8771 | |||
8772 | lock (RegionHandleRequests) | ||
8773 | { | ||
8774 | if (RegionHandleRequestsInService) | ||
8775 | { | ||
8776 | // we are already busy doing a previus request | ||
8777 | // so enqueue it | ||
8778 | RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); | ||
8779 | return true; | ||
8780 | } | ||
8781 | |||
8782 | // else do it | ||
8783 | currentUUID = rhrPack.RequestBlock.RegionID; | ||
8784 | RegionHandleRequestsInService = true; | ||
8785 | } | ||
8786 | |||
8787 | while (true) | ||
8760 | { | 8788 | { |
8761 | handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); | 8789 | handlerRegionHandleRequest(this, currentUUID); |
8790 | |||
8791 | lock (RegionHandleRequests) | ||
8792 | { | ||
8793 | // exit condition, nothing to do or closed | ||
8794 | // current code seems to assume we may loose the handler at anytime, | ||
8795 | // so keep checking it | ||
8796 | handlerRegionHandleRequest = OnRegionHandleRequest; | ||
8797 | |||
8798 | if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) | ||
8799 | { | ||
8800 | RegionHandleRequests.Clear(); | ||
8801 | RegionHandleRequestsInService = false; | ||
8802 | return true; | ||
8803 | } | ||
8804 | currentUUID = RegionHandleRequests.Dequeue(); | ||
8805 | } | ||
8762 | } | 8806 | } |
8763 | return true; | 8807 | |
8808 | return true; // actually unreached | ||
8764 | } | 8809 | } |
8765 | 8810 | ||
8766 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) | 8811 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) |