diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 65 |
1 files changed, 8 insertions, 57 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 54359eb..01c1fb9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -706,36 +706,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
706 | /// <returns>true if the handler was added. This is currently always the case.</returns> | 706 | /// <returns>true if the handler was added. This is currently always the case.</returns> |
707 | public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync) | 707 | public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync) |
708 | { | 708 | { |
709 | return AddLocalPacketHandler(packetType, handler, doAsync, false); | ||
710 | } | ||
711 | |||
712 | /// <summary> | ||
713 | /// Add a handler for the given packet type. | ||
714 | /// </summary> | ||
715 | /// <param name="packetType"></param> | ||
716 | /// <param name="handler"></param> | ||
717 | /// <param name="doAsync"> | ||
718 | /// If true, when the packet is received handle it on a different thread. Whether this is given direct to | ||
719 | /// a threadpool thread or placed in a queue depends on the inEngine parameter. | ||
720 | /// </param> | ||
721 | /// <param name="inEngine"> | ||
722 | /// If async is false then this parameter is ignored. | ||
723 | /// If async is true and inEngine is false, then the packet is sent directly to a | ||
724 | /// threadpool thread. | ||
725 | /// If async is true and inEngine is true, then the packet is sent to the IncomingPacketAsyncHandlingEngine. | ||
726 | /// This may result in slower handling but reduces the risk of overloading the simulator when there are many | ||
727 | /// simultaneous async requests. | ||
728 | /// </param> | ||
729 | /// <returns>true if the handler was added. This is currently always the case.</returns> | ||
730 | public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync, bool inEngine) | ||
731 | { | ||
732 | bool result = false; | 709 | bool result = false; |
733 | lock (m_packetHandlers) | 710 | lock (m_packetHandlers) |
734 | { | 711 | { |
735 | if (!m_packetHandlers.ContainsKey(packetType)) | 712 | if (!m_packetHandlers.ContainsKey(packetType)) |
736 | { | 713 | { |
737 | m_packetHandlers.Add( | 714 | m_packetHandlers.Add( |
738 | packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine }); | 715 | packetType, new PacketProcessor() { method = handler, Async = doAsync}); |
739 | result = true; | 716 | result = true; |
740 | } | 717 | } |
741 | } | 718 | } |
@@ -770,31 +747,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
770 | PacketProcessor pprocessor; | 747 | PacketProcessor pprocessor; |
771 | if (m_packetHandlers.TryGetValue(packet.Type, out pprocessor)) | 748 | if (m_packetHandlers.TryGetValue(packet.Type, out pprocessor)) |
772 | { | 749 | { |
773 | ClientInfo cinfo = UDPClient.GetClientInfo(); | ||
774 | 750 | ||
775 | //there is a local handler for this packet type | 751 | //there is a local handler for this packet type |
776 | if (pprocessor.Async) | 752 | if (pprocessor.Async) |
777 | { | 753 | { |
778 | if (!cinfo.AsyncRequests.ContainsKey(packet.Type.ToString())) | ||
779 | cinfo.AsyncRequests[packet.Type.ToString()] = 0; | ||
780 | cinfo.AsyncRequests[packet.Type.ToString()]++; | ||
781 | |||
782 | object obj = new AsyncPacketProcess(this, pprocessor.method, packet); | 754 | object obj = new AsyncPacketProcess(this, pprocessor.method, packet); |
783 | /* | ||
784 | if (pprocessor.InEngine) | ||
785 | m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj)); | ||
786 | else | ||
787 | Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString()); | ||
788 | */ | ||
789 | m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj)); | 755 | m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj)); |
790 | result = true; | 756 | result = true; |
791 | } | 757 | } |
792 | else | 758 | else |
793 | { | 759 | { |
794 | if (!cinfo.SyncRequests.ContainsKey(packet.Type.ToString())) | ||
795 | cinfo.SyncRequests[packet.Type.ToString()] = 0; | ||
796 | cinfo.SyncRequests[packet.Type.ToString()]++; | ||
797 | |||
798 | result = pprocessor.method(this, packet); | 760 | result = pprocessor.method(this, packet); |
799 | } | 761 | } |
800 | } | 762 | } |
@@ -809,11 +771,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
809 | } | 771 | } |
810 | if (found) | 772 | if (found) |
811 | { | 773 | { |
812 | ClientInfo cinfo = UDPClient.GetClientInfo(); | ||
813 | if (!cinfo.GenericRequests.ContainsKey(packet.Type.ToString())) | ||
814 | cinfo.GenericRequests[packet.Type.ToString()] = 0; | ||
815 | cinfo.GenericRequests[packet.Type.ToString()]++; | ||
816 | |||
817 | result = method(this, packet); | 774 | result = method(this, packet); |
818 | } | 775 | } |
819 | } | 776 | } |
@@ -5995,10 +5952,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5995 | AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false); | 5952 | AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false); |
5996 | AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); | 5953 | AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); |
5997 | AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); | 5954 | AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); |
5998 | AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage, true, true); | 5955 | AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); |
5999 | AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest, true, true); | 5956 | AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); |
6000 | AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); | 5957 | AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); |
6001 | AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate, true, true); | 5958 | AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate); |
6002 | AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply); | 5959 | AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply); |
6003 | AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage); | 5960 | AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage); |
6004 | AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); | 5961 | AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); |
@@ -6040,8 +5997,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6040 | AddLocalPacketHandler(PacketType.ObjectExtraParams, HandleObjectExtraParams); | 5997 | AddLocalPacketHandler(PacketType.ObjectExtraParams, HandleObjectExtraParams); |
6041 | AddLocalPacketHandler(PacketType.ObjectDuplicate, HandleObjectDuplicate); | 5998 | AddLocalPacketHandler(PacketType.ObjectDuplicate, HandleObjectDuplicate); |
6042 | AddLocalPacketHandler(PacketType.RequestMultipleObjects, HandleRequestMultipleObjects); | 5999 | AddLocalPacketHandler(PacketType.RequestMultipleObjects, HandleRequestMultipleObjects); |
6043 | AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect, true, true); | 6000 | AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect); |
6044 | AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect, true, true); | 6001 | AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect); |
6045 | AddLocalPacketHandler(PacketType.ObjectPosition, HandleObjectPosition); | 6002 | AddLocalPacketHandler(PacketType.ObjectPosition, HandleObjectPosition); |
6046 | AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); | 6003 | AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); |
6047 | AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); | 6004 | AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); |
@@ -6185,8 +6142,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6185 | AddLocalPacketHandler(PacketType.PickDelete, HandlePickDelete); | 6142 | AddLocalPacketHandler(PacketType.PickDelete, HandlePickDelete); |
6186 | AddLocalPacketHandler(PacketType.PickGodDelete, HandlePickGodDelete); | 6143 | AddLocalPacketHandler(PacketType.PickGodDelete, HandlePickGodDelete); |
6187 | AddLocalPacketHandler(PacketType.PickInfoUpdate, HandlePickInfoUpdate); | 6144 | AddLocalPacketHandler(PacketType.PickInfoUpdate, HandlePickInfoUpdate); |
6188 | AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate, true, true); | 6145 | AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate); |
6189 | AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate, true, true); | 6146 | AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate); |
6190 | AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights); | 6147 | AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights); |
6191 | AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery); | 6148 | AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery); |
6192 | AddLocalPacketHandler(PacketType.UpdateMuteListEntry, HandleUpdateMuteListEntry); | 6149 | AddLocalPacketHandler(PacketType.UpdateMuteListEntry, HandleUpdateMuteListEntry); |
@@ -13436,7 +13393,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
13436 | SendAssetNotFound(req); | 13393 | SendAssetNotFound(req); |
13437 | return; | 13394 | return; |
13438 | } | 13395 | } |
13439 | |||
13440 | } | 13396 | } |
13441 | 13397 | ||
13442 | if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) | 13398 | if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) |
@@ -13513,11 +13469,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
13513 | /// </summary> | 13469 | /// </summary> |
13514 | public bool Async { get; set; } | 13470 | public bool Async { get; set; } |
13515 | 13471 | ||
13516 | /// <summary> | ||
13517 | /// If async is true, should this packet be handled in the async engine or given directly to a threadpool | ||
13518 | /// thread? | ||
13519 | /// </summary> | ||
13520 | public bool InEngine { get; set; } | ||
13521 | } | 13472 | } |
13522 | 13473 | ||
13523 | public class AsyncPacketProcess | 13474 | public class AsyncPacketProcess |