aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs67
1 files changed, 56 insertions, 11 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 516327c..85f9d68 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -648,12 +648,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP
648 /// <returns>true if the handler was added. This is currently always the case.</returns> 648 /// <returns>true if the handler was added. This is currently always the case.</returns>
649 public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync) 649 public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync)
650 { 650 {
651 return AddLocalPacketHandler(packetType, handler, doAsync, false);
652 }
653
654 /// <summary>
655 /// Add a handler for the given packet type.
656 /// </summary>
657 /// <param name="packetType"></param>
658 /// <param name="handler"></param>
659 /// <param name="doAsync">
660 /// If true, when the packet is received handle it on a different thread. Whether this is given direct to
661 /// a threadpool thread or placed in a queue depends on the inEngine parameter.
662 /// </param>
663 /// <param name="inEngine">
664 /// If async is false then this parameter is ignored.
665 /// If async is true and inEngine is false, then the packet is sent directly to a
666 /// threadpool thread.
667 /// If async is true and inEngine is true, then the packet is sent to the IncomingPacketAsyncHandlingEngine.
668 /// This may result in slower handling but reduces the risk of overloading the simulator when there are many
669 /// simultaneous async requests.
670 /// </param>
671 /// <returns>true if the handler was added. This is currently always the case.</returns>
672 public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync, bool inEngine)
673 {
651 bool result = false; 674 bool result = false;
652 lock (m_packetHandlers) 675 lock (m_packetHandlers)
653 { 676 {
654 if (!m_packetHandlers.ContainsKey(packetType)) 677 if (!m_packetHandlers.ContainsKey(packetType))
655 { 678 {
656 m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = doAsync }); 679 m_packetHandlers.Add(
680 packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine });
657 result = true; 681 result = true;
658 } 682 }
659 } 683 }
@@ -688,21 +712,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
688 PacketProcessor pprocessor; 712 PacketProcessor pprocessor;
689 if (m_packetHandlers.TryGetValue(packet.Type, out pprocessor)) 713 if (m_packetHandlers.TryGetValue(packet.Type, out pprocessor))
690 { 714 {
715 ClientInfo cinfo = UDPClient.GetClientInfo();
716
691 //there is a local handler for this packet type 717 //there is a local handler for this packet type
692 if (pprocessor.Async) 718 if (pprocessor.Async)
693 { 719 {
694 ClientInfo cinfo = UDPClient.GetClientInfo();
695 if (!cinfo.AsyncRequests.ContainsKey(packet.Type.ToString())) 720 if (!cinfo.AsyncRequests.ContainsKey(packet.Type.ToString()))
696 cinfo.AsyncRequests[packet.Type.ToString()] = 0; 721 cinfo.AsyncRequests[packet.Type.ToString()] = 0;
697 cinfo.AsyncRequests[packet.Type.ToString()]++; 722 cinfo.AsyncRequests[packet.Type.ToString()]++;
698 723
699 object obj = new AsyncPacketProcess(this, pprocessor.method, packet); 724 object obj = new AsyncPacketProcess(this, pprocessor.method, packet);
700 Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString()); 725
726 if (pprocessor.InEngine)
727 m_udpServer.IpahEngine.QueueRequest(
728 packet.Type.ToString(),
729 ProcessSpecificPacketAsync,
730 obj);
731 else
732 Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString());
733
701 result = true; 734 result = true;
702 } 735 }
703 else 736 else
704 { 737 {
705 ClientInfo cinfo = UDPClient.GetClientInfo();
706 if (!cinfo.SyncRequests.ContainsKey(packet.Type.ToString())) 738 if (!cinfo.SyncRequests.ContainsKey(packet.Type.ToString()))
707 cinfo.SyncRequests[packet.Type.ToString()] = 0; 739 cinfo.SyncRequests[packet.Type.ToString()] = 0;
708 cinfo.SyncRequests[packet.Type.ToString()]++; 740 cinfo.SyncRequests[packet.Type.ToString()]++;
@@ -5554,10 +5586,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5554 AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false); 5586 AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false);
5555 AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); 5587 AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest);
5556 AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); 5588 AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest);
5557 AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); 5589 AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage, true, true);
5558 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); 5590 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest, true, true);
5559 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 5591 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
5560 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate); 5592 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate, true, true);
5561 AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply); 5593 AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply);
5562 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage); 5594 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage);
5563 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); 5595 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
@@ -5742,8 +5774,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5742 AddLocalPacketHandler(PacketType.PickDelete, HandlePickDelete); 5774 AddLocalPacketHandler(PacketType.PickDelete, HandlePickDelete);
5743 AddLocalPacketHandler(PacketType.PickGodDelete, HandlePickGodDelete); 5775 AddLocalPacketHandler(PacketType.PickGodDelete, HandlePickGodDelete);
5744 AddLocalPacketHandler(PacketType.PickInfoUpdate, HandlePickInfoUpdate); 5776 AddLocalPacketHandler(PacketType.PickInfoUpdate, HandlePickInfoUpdate);
5745 AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate); 5777 AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate, true, true);
5746 AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate); 5778 AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate, true, true);
5747 AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights); 5779 AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights);
5748 AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery); 5780 AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery);
5749 AddLocalPacketHandler(PacketType.UpdateMuteListEntry, HandleUpdateMuteListEntry); 5781 AddLocalPacketHandler(PacketType.UpdateMuteListEntry, HandleUpdateMuteListEntry);
@@ -12801,8 +12833,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12801 12833
12802 public struct PacketProcessor 12834 public struct PacketProcessor
12803 { 12835 {
12804 public PacketMethod method; 12836 /// <summary>
12805 public bool Async; 12837 /// Packet handling method.
12838 /// </summary>
12839 public PacketMethod method { get; set; }
12840
12841 /// <summary>
12842 /// Should this packet be handled asynchronously?
12843 /// </summary>
12844 public bool Async { get; set; }
12845
12846 /// <summary>
12847 /// If async is true, should this packet be handled in the async engine or given directly to a threadpool
12848 /// thread?
12849 /// </summary>
12850 public bool InEngine { get; set; }
12806 } 12851 }
12807 12852
12808 public class AsyncPacketProcess 12853 public class AsyncPacketProcess