aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs97
1 files changed, 55 insertions, 42 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 8d957dc..218c2b2 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -862,44 +862,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
862 return x == m_location; 862 return x == m_location;
863 } 863 }
864 864
865 public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting) 865// public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
866 { 866// {
867 // CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way 867// // CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way
868 if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting) 868// if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting)
869 allowSplitting = false; 869// allowSplitting = false;
870 870//
871 if (allowSplitting && packet.HasVariableBlocks) 871// if (allowSplitting && packet.HasVariableBlocks)
872 { 872// {
873 byte[][] datas = packet.ToBytesMultiple(); 873// byte[][] datas = packet.ToBytesMultiple();
874 int packetCount = datas.Length; 874// int packetCount = datas.Length;
875 875//
876 if (packetCount < 1) 876// if (packetCount < 1)
877 m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length); 877// m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length);
878 878//
879 for (int i = 0; i < packetCount; i++) 879// for (int i = 0; i < packetCount; i++)
880 { 880// {
881 byte[] data = datas[i]; 881// byte[] data = datas[i];
882 m_scene.ForEachClient( 882// m_scene.ForEachClient(
883 delegate(IClientAPI client) 883// delegate(IClientAPI client)
884 { 884// {
885 if (client is LLClientView) 885// if (client is LLClientView)
886 SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null); 886// SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
887 } 887// }
888 ); 888// );
889 } 889// }
890 } 890// }
891 else 891// else
892 { 892// {
893 byte[] data = packet.ToBytes(); 893// byte[] data = packet.ToBytes();
894 m_scene.ForEachClient( 894// m_scene.ForEachClient(
895 delegate(IClientAPI client) 895// delegate(IClientAPI client)
896 { 896// {
897 if (client is LLClientView) 897// if (client is LLClientView)
898 SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null); 898// SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
899 } 899// }
900 ); 900// );
901 } 901// }
902 } 902// }
903 903
904 /// <summary> 904 /// <summary>
905 /// Start the process of sending a packet to the client. 905 /// Start the process of sending a packet to the client.
@@ -919,6 +919,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
919 if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting) 919 if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
920 allowSplitting = false; 920 allowSplitting = false;
921 921
922 bool packetQueued = false;
923
922 if (allowSplitting && packet.HasVariableBlocks) 924 if (allowSplitting && packet.HasVariableBlocks)
923 { 925 {
924 byte[][] datas = packet.ToBytesMultiple(); 926 byte[][] datas = packet.ToBytesMultiple();
@@ -930,18 +932,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
930 for (int i = 0; i < packetCount; i++) 932 for (int i = 0; i < packetCount; i++)
931 { 933 {
932 byte[] data = datas[i]; 934 byte[] data = datas[i];
933 SendPacketData(udpClient, data, packet.Type, category, method); 935
936 if (!SendPacketData(udpClient, data, packet.Type, category, method))
937 packetQueued = true;
934 } 938 }
935 } 939 }
936 else 940 else
937 { 941 {
938 byte[] data = packet.ToBytes(); 942 byte[] data = packet.ToBytes();
939 SendPacketData(udpClient, data, packet.Type, category, method); 943 packetQueued = SendPacketData(udpClient, data, packet.Type, category, method);
940 } 944 }
941 945
942 PacketPool.Instance.ReturnPacket(packet); 946 PacketPool.Instance.ReturnPacket(packet);
943 947
944 m_dataPresentEvent.Set(); 948 if (packetQueued)
949 m_dataPresentEvent.Set();
945 } 950 }
946 951
947 /// <summary> 952 /// <summary>
@@ -955,7 +960,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
955 /// The method to call if the packet is not acked by the client. If null, then a standard 960 /// The method to call if the packet is not acked by the client. If null, then a standard
956 /// resend of the packet is done. 961 /// resend of the packet is done.
957 /// </param> 962 /// </param>
958 public void SendPacketData( 963 /// <returns>true if the data was sent immediately, false if it was queued for sending</returns>
964 public bool SendPacketData(
959 LLUDPClient udpClient, byte[] data, PacketType type, ThrottleOutPacketType category, UnackedPacketMethod method) 965 LLUDPClient udpClient, byte[] data, PacketType type, ThrottleOutPacketType category, UnackedPacketMethod method)
960 { 966 {
961 int dataLength = data.Length; 967 int dataLength = data.Length;
@@ -1020,7 +1026,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1020 // packet so that it isn't sent before a queued update packet. 1026 // packet so that it isn't sent before a queued update packet.
1021 bool requestQueue = type == PacketType.KillObject; 1027 bool requestQueue = type == PacketType.KillObject;
1022 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue)) 1028 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue))
1029 {
1023 SendPacketFinal(outgoingPacket); 1030 SendPacketFinal(outgoingPacket);
1031 return true;
1032 }
1033 else
1034 {
1035 return false;
1036 }
1024 1037
1025 #endregion Queue or Send 1038 #endregion Queue or Send
1026 } 1039 }