aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs159
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs20
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs3
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs1079
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs65
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs4
8 files changed, 856 insertions, 486 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 8ec2f20..ef6dedb 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -96,7 +96,10 @@ namespace OpenSim.Region.ClientStack.Linden
96 // private static readonly string m_fetchInventoryPath = "0006/"; 96 // private static readonly string m_fetchInventoryPath = "0006/";
97 private static readonly string m_copyFromNotecardPath = "0007/"; 97 private static readonly string m_copyFromNotecardPath = "0007/";
98 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. 98 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
99 99 private static readonly string m_getObjectPhysicsDataPath = "0101/";
100 private static readonly string m_getObjectCostPath = "0102/";
101 private static readonly string m_ResourceCostSelectedPath = "0103/";
102
100 103
101 // These are callbacks which will be setup by the scene so that we can update scene data when we 104 // These are callbacks which will be setup by the scene so that we can update scene data when we
102 // receive capability calls 105 // receive capability calls
@@ -186,7 +189,14 @@ namespace OpenSim.Region.ClientStack.Linden
186 m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); 189 m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
187 m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); 190 m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
188 m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); 191 m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard));
189 192 IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData);
193 m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
194 IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost);
195 m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
196 IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected);
197 m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
198
199
190 // As of RC 1.22.9 of the Linden client this is 200 // As of RC 1.22.9 of the Linden client this is
191 // supported 201 // supported
192 202
@@ -819,6 +829,151 @@ namespace OpenSim.Region.ClientStack.Linden
819 response["int_response_code"] = 200; 829 response["int_response_code"] = 200;
820 return LLSDHelpers.SerialiseLLSDReply(response); 830 return LLSDHelpers.SerialiseLLSDReply(response);
821 } 831 }
832
833 public string GetObjectPhysicsData(string request, string path,
834 string param, IOSHttpRequest httpRequest,
835 IOSHttpResponse httpResponse)
836 {
837 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
838 OSDMap resp = new OSDMap();
839 OSDArray object_ids = (OSDArray)req["object_ids"];
840
841 for (int i = 0 ; i < object_ids.Count ; i++)
842 {
843 UUID uuid = object_ids[i].AsUUID();
844
845 SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid);
846 if (obj != null)
847 {
848 OSDMap object_data = new OSDMap();
849
850 object_data["PhysicsShapeType"] = obj.PhysicsShapeType;
851 object_data["Density"] = obj.Density;
852 object_data["Friction"] = obj.Friction;
853 object_data["Restitution"] = obj.Bounciness;
854 object_data["GravityMultiplier"] = obj.GravityModifier;
855
856 resp[uuid.ToString()] = object_data;
857 }
858 }
859
860 string response = OSDParser.SerializeLLSDXmlString(resp);
861 return response;
862 }
863
864 public string GetObjectCost(string request, string path,
865 string param, IOSHttpRequest httpRequest,
866 IOSHttpResponse httpResponse)
867 {
868 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
869 OSDMap resp = new OSDMap();
870
871 OSDArray object_ids = (OSDArray)req["object_ids"];
872
873 for (int i = 0; i < object_ids.Count; i++)
874 {
875 UUID uuid = object_ids[i].AsUUID();
876
877 SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
878
879 if (part != null)
880 {
881 SceneObjectGroup grp = part.ParentGroup;
882 if (grp != null)
883 {
884 float linksetCost;
885 float linksetPhysCost;
886 float partCost;
887 float partPhysCost;
888
889 grp.GetResourcesCosts(part, out linksetCost, out linksetPhysCost, out partCost, out partPhysCost);
890
891 OSDMap object_data = new OSDMap();
892 object_data["linked_set_resource_cost"] = linksetCost;
893 object_data["resource_cost"] = partCost;
894 object_data["physics_cost"] = partPhysCost;
895 object_data["linked_set_physics_cost"] = linksetPhysCost;
896
897 resp[uuid.ToString()] = object_data;
898 }
899 }
900 }
901
902 string response = OSDParser.SerializeLLSDXmlString(resp);
903 return response;
904 }
905
906 public string ResourceCostSelected(string request, string path,
907 string param, IOSHttpRequest httpRequest,
908 IOSHttpResponse httpResponse)
909 {
910 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
911 OSDMap resp = new OSDMap();
912
913
914 float phys=0;
915 float stream=0;
916 float simul=0;
917
918 if (req.ContainsKey("selected_roots"))
919 {
920 OSDArray object_ids = (OSDArray)req["selected_roots"];
921
922 // should go by SOG suming costs for all parts
923 // ll v3 works ok with several objects select we get the list and adds ok
924 // FS calls per object so results are wrong guess fs bug
925 for (int i = 0; i < object_ids.Count; i++)
926 {
927 UUID uuid = object_ids[i].AsUUID();
928 float Physc;
929 float simulc;
930 float streamc;
931
932 SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid);
933 if (grp != null)
934 {
935 grp.GetSelectedCosts(out Physc, out streamc, out simulc);
936 phys += Physc;
937 stream += streamc;
938 simul += simulc;
939 }
940 }
941 }
942 else if (req.ContainsKey("selected_prims"))
943 {
944 OSDArray object_ids = (OSDArray)req["selected_prims"];
945
946 // don't see in use in any of the 2 viewers
947 // guess it should be for edit linked but... nothing
948 // should go to SOP per part
949 for (int i = 0; i < object_ids.Count; i++)
950 {
951 UUID uuid = object_ids[i].AsUUID();
952
953 SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
954 if (part != null)
955 {
956 phys += part.PhysicsCost;
957 stream += part.StreamingCost;
958 simul += part.SimulationCost;
959 }
960 }
961 }
962
963 if (simul != 0)
964 {
965 OSDMap object_data = new OSDMap();
966
967 object_data["physics"] = phys;
968 object_data["streaming"] = stream;
969 object_data["simulation"] = simul;
970
971 resp["selected"] = object_data;
972 }
973
974 string response = OSDParser.SerializeLLSDXmlString(resp);
975 return response;
976 }
822 } 977 }
823 978
824 public class AssetUploader 979 public class AssetUploader
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 7c07c56..a91b02c 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -805,5 +805,13 @@ namespace OpenSim.Region.ClientStack.Linden
805 { 805 {
806 return EventQueueHelper.BuildEvent(eventName, eventBody); 806 return EventQueueHelper.BuildEvent(eventName, eventBody);
807 } 807 }
808
809 public void partPhysicsProperties(uint localID, byte physhapetype,
810 float density, float friction, float bounce, float gravmod,UUID avatarID)
811 {
812 OSD item = EventQueueHelper.partPhysicsProperties(localID, physhapetype,
813 density, friction, bounce, gravmod);
814 Enqueue(item, avatarID);
815 }
808 } 816 }
809} 817}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
index 3f49aba..b9222e3 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
@@ -395,5 +395,25 @@ namespace OpenSim.Region.ClientStack.Linden
395 return message; 395 return message;
396 } 396 }
397 397
398 public static OSD partPhysicsProperties(uint localID, byte physhapetype,
399 float density, float friction, float bounce, float gravmod)
400 {
401
402 OSDMap physinfo = new OSDMap(6);
403 physinfo["LocalID"] = localID;
404 physinfo["Density"] = density;
405 physinfo["Friction"] = friction;
406 physinfo["GravityMultiplier"] = gravmod;
407 physinfo["Restitution"] = bounce;
408 physinfo["PhysicsShapeType"] = (int)physhapetype;
409
410 OSDArray array = new OSDArray(1);
411 array.Add(physinfo);
412
413 OSDMap llsdBody = new OSDMap(1);
414 llsdBody.Add("ObjectData", array);
415
416 return BuildEvent("ObjectPhysicsProperties", llsdBody);
417 }
398 } 418 }
399} 419}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index afbe56b..3995620 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -234,6 +234,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
234 m_stopPacket = TexturePacketCount(); 234 m_stopPacket = TexturePacketCount();
235 } 235 }
236 236
237 //Give them at least two packets, to play nice with some broken viewers (SL also behaves this way)
238 if (m_stopPacket == 1 && m_layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++;
239
237 m_currentPacket = StartPacket; 240 m_currentPacket = StartPacket;
238 } 241 }
239 } 242 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index ae5cbff..1004be6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -125,6 +125,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
125 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; 125 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
126 public event UpdatePrimFlags OnUpdatePrimFlags; 126 public event UpdatePrimFlags OnUpdatePrimFlags;
127 public event UpdatePrimTexture OnUpdatePrimTexture; 127 public event UpdatePrimTexture OnUpdatePrimTexture;
128 public event ClientChangeObject onClientChangeObject;
128 public event UpdateVector OnUpdatePrimGroupPosition; 129 public event UpdateVector OnUpdatePrimGroupPosition;
129 public event UpdateVector OnUpdatePrimSinglePosition; 130 public event UpdateVector OnUpdatePrimSinglePosition;
130 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 131 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
@@ -158,6 +159,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
158 public event RequestTaskInventory OnRequestTaskInventory; 159 public event RequestTaskInventory OnRequestTaskInventory;
159 public event UpdateInventoryItem OnUpdateInventoryItem; 160 public event UpdateInventoryItem OnUpdateInventoryItem;
160 public event CopyInventoryItem OnCopyInventoryItem; 161 public event CopyInventoryItem OnCopyInventoryItem;
162 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
161 public event MoveInventoryItem OnMoveInventoryItem; 163 public event MoveInventoryItem OnMoveInventoryItem;
162 public event RemoveInventoryItem OnRemoveInventoryItem; 164 public event RemoveInventoryItem OnRemoveInventoryItem;
163 public event RemoveInventoryFolder OnRemoveInventoryFolder; 165 public event RemoveInventoryFolder OnRemoveInventoryFolder;
@@ -256,7 +258,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
256 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 258 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
257 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 259 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
258 public event ClassifiedDelete OnClassifiedDelete; 260 public event ClassifiedDelete OnClassifiedDelete;
259 public event ClassifiedDelete OnClassifiedGodDelete; 261 public event ClassifiedGodDelete OnClassifiedGodDelete;
260 public event EventNotificationAddRequest OnEventNotificationAddRequest; 262 public event EventNotificationAddRequest OnEventNotificationAddRequest;
261 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 263 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
262 public event EventGodDelete OnEventGodDelete; 264 public event EventGodDelete OnEventGodDelete;
@@ -287,6 +289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
287 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 289 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
288 public event SimWideDeletesDelegate OnSimWideDeletes; 290 public event SimWideDeletesDelegate OnSimWideDeletes;
289 public event SendPostcard OnSendPostcard; 291 public event SendPostcard OnSendPostcard;
292 public event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
290 public event MuteListEntryUpdate OnUpdateMuteListEntry; 293 public event MuteListEntryUpdate OnUpdateMuteListEntry;
291 public event MuteListEntryRemove OnRemoveMuteListEntry; 294 public event MuteListEntryRemove OnRemoveMuteListEntry;
292 public event GodlikeMessage onGodlikeMessage; 295 public event GodlikeMessage onGodlikeMessage;
@@ -336,7 +339,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
336 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an 339 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
337 /// ownerless phantom. 340 /// ownerless phantom.
338 /// 341 ///
339 /// All manipulation of this set has to occur under a lock 342 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
340 /// 343 ///
341 /// </value> 344 /// </value>
342 protected HashSet<uint> m_killRecord; 345 protected HashSet<uint> m_killRecord;
@@ -344,6 +347,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
344// protected HashSet<uint> m_attachmentsSent; 347// protected HashSet<uint> m_attachmentsSent;
345 348
346 private int m_moneyBalance; 349 private int m_moneyBalance;
350 private bool m_deliverPackets = true;
347 private int m_animationSequenceNumber = 1; 351 private int m_animationSequenceNumber = 1;
348 private bool m_SendLogoutPacketWhenClosing = true; 352 private bool m_SendLogoutPacketWhenClosing = true;
349 private AgentUpdateArgs lastarg; 353 private AgentUpdateArgs lastarg;
@@ -383,6 +387,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
383 get { return m_startpos; } 387 get { return m_startpos; }
384 set { m_startpos = value; } 388 set { m_startpos = value; }
385 } 389 }
390 public bool DeliverPackets
391 {
392 get { return m_deliverPackets; }
393 set {
394 m_deliverPackets = value;
395 m_udpClient.m_deliverPackets = value;
396 }
397 }
386 public UUID AgentId { get { return m_agentId; } } 398 public UUID AgentId { get { return m_agentId; } }
387 public ISceneAgent SceneAgent { get; set; } 399 public ISceneAgent SceneAgent { get; set; }
388 public UUID ActiveGroupId { get { return m_activeGroupID; } } 400 public UUID ActiveGroupId { get { return m_activeGroupID; } }
@@ -485,18 +497,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
485 497
486 #region Client Methods 498 #region Client Methods
487 499
500
488 /// <summary> 501 /// <summary>
489 /// Shut down the client view 502 /// Shut down the client view
490 /// </summary> 503 /// </summary>
491 public void Close() 504 public void Close()
492 { 505 {
506 Close(true);
507 }
508
509 /// <summary>
510 /// Shut down the client view
511 /// </summary>
512 public void Close(bool sendStop)
513 {
493 m_log.DebugFormat( 514 m_log.DebugFormat(
494 "[CLIENT]: Close has been called for {0} attached to scene {1}", 515 "[CLIENT]: Close has been called for {0} attached to scene {1}",
495 Name, m_scene.RegionInfo.RegionName); 516 Name, m_scene.RegionInfo.RegionName);
496 517
497 // Send the STOP packet 518 if (sendStop)
498 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 519 {
499 OutPacket(disable, ThrottleOutPacketType.Unknown); 520 // Send the STOP packet
521 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
522 OutPacket(disable, ThrottleOutPacketType.Unknown);
523 }
500 524
501 IsActive = false; 525 IsActive = false;
502 526
@@ -796,7 +820,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
796 reply.ChatData.OwnerID = fromAgentID; 820 reply.ChatData.OwnerID = fromAgentID;
797 reply.ChatData.SourceID = fromAgentID; 821 reply.ChatData.SourceID = fromAgentID;
798 822
799 OutPacket(reply, ThrottleOutPacketType.Task); 823 OutPacket(reply, ThrottleOutPacketType.Unknown);
800 } 824 }
801 825
802 /// <summary> 826 /// <summary>
@@ -1082,6 +1106,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1082 public virtual void SendLayerData(float[] map) 1106 public virtual void SendLayerData(float[] map)
1083 { 1107 {
1084 Util.FireAndForget(DoSendLayerData, map); 1108 Util.FireAndForget(DoSendLayerData, map);
1109
1110 // Send it sync, and async. It's not that much data
1111 // and it improves user experience just so much!
1112 DoSendLayerData(map);
1085 } 1113 }
1086 1114
1087 /// <summary> 1115 /// <summary>
@@ -1094,16 +1122,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1094 1122
1095 try 1123 try
1096 { 1124 {
1097 //for (int y = 0; y < 16; y++) 1125 for (int y = 0; y < 16; y++)
1098 //{ 1126 {
1099 // for (int x = 0; x < 16; x++) 1127 for (int x = 0; x < 16; x+=4)
1100 // { 1128 {
1101 // SendLayerData(x, y, map); 1129 SendLayerPacket(x, y, map);
1102 // } 1130 }
1103 //} 1131 }
1104
1105 // Send LayerData in a spiral pattern. Fun!
1106 SendLayerTopRight(map, 0, 0, 15, 15);
1107 } 1132 }
1108 catch (Exception e) 1133 catch (Exception e)
1109 { 1134 {
@@ -1111,51 +1136,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1111 } 1136 }
1112 } 1137 }
1113 1138
1114 private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
1115 {
1116 // Row
1117 for (int i = x1; i <= x2; i++)
1118 SendLayerData(i, y1, map);
1119
1120 // Column
1121 for (int j = y1 + 1; j <= y2; j++)
1122 SendLayerData(x2, j, map);
1123
1124 if (x2 - x1 > 0)
1125 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1126 }
1127
1128 void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
1129 {
1130 // Row in reverse
1131 for (int i = x2; i >= x1; i--)
1132 SendLayerData(i, y2, map);
1133
1134 // Column in reverse
1135 for (int j = y2 - 1; j >= y1; j--)
1136 SendLayerData(x1, j, map);
1137
1138 if (x2 - x1 > 0)
1139 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1140 }
1141
1142 /// <summary> 1139 /// <summary>
1143 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1140 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1144 /// </summary> 1141 /// </summary>
1145 /// <param name="map">heightmap</param> 1142 /// <param name="map">heightmap</param>
1146 /// <param name="px">X coordinate for patches 0..12</param> 1143 /// <param name="px">X coordinate for patches 0..12</param>
1147 /// <param name="py">Y coordinate for patches 0..15</param> 1144 /// <param name="py">Y coordinate for patches 0..15</param>
1148 // private void SendLayerPacket(float[] map, int y, int x) 1145 private void SendLayerPacket(int x, int y, float[] map)
1149 // { 1146 {
1150 // int[] patches = new int[4]; 1147 int[] patches = new int[4];
1151 // patches[0] = x + 0 + y * 16; 1148 patches[0] = x + 0 + y * 16;
1152 // patches[1] = x + 1 + y * 16; 1149 patches[1] = x + 1 + y * 16;
1153 // patches[2] = x + 2 + y * 16; 1150 patches[2] = x + 2 + y * 16;
1154 // patches[3] = x + 3 + y * 16; 1151 patches[3] = x + 3 + y * 16;
1155 1152
1156 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1153 float[] heightmap = (map.Length == 65536) ?
1157 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1154 map :
1158 // } 1155 LLHeightFieldMoronize(map);
1156
1157 try
1158 {
1159 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1160 OutPacket(layerpack, ThrottleOutPacketType.Land);
1161 }
1162 catch
1163 {
1164 for (int px = x ; px < x + 4 ; px++)
1165 SendLayerData(px, y, map);
1166 }
1167 }
1159 1168
1160 /// <summary> 1169 /// <summary>
1161 /// Sends a specified patch to a client 1170 /// Sends a specified patch to a client
@@ -1175,7 +1184,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1175 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); 1184 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1176 layerpack.Header.Reliable = true; 1185 layerpack.Header.Reliable = true;
1177 1186
1178 OutPacket(layerpack, ThrottleOutPacketType.Land); 1187 OutPacket(layerpack, ThrottleOutPacketType.Task);
1179 } 1188 }
1180 catch (Exception e) 1189 catch (Exception e)
1181 { 1190 {
@@ -1538,7 +1547,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1538 1547
1539 public void SendKillObject(ulong regionHandle, List<uint> localIDs) 1548 public void SendKillObject(ulong regionHandle, List<uint> localIDs)
1540 { 1549 {
1541// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); 1550// foreach (uint id in localIDs)
1551// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle);
1542 1552
1543 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); 1553 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
1544 // TODO: don't create new blocks if recycling an old packet 1554 // TODO: don't create new blocks if recycling an old packet
@@ -2300,6 +2310,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2300 OutPacket(sound, ThrottleOutPacketType.Task); 2310 OutPacket(sound, ThrottleOutPacketType.Task);
2301 } 2311 }
2302 2312
2313 public void SendTransferAbort(TransferRequestPacket transferRequest)
2314 {
2315 TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort);
2316 abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
2317 abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType;
2318 m_log.Debug("[Assets] Aborting transfer; asset request failed");
2319 OutPacket(abort, ThrottleOutPacketType.Task);
2320 }
2321
2303 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) 2322 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
2304 { 2323 {
2305 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); 2324 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
@@ -2592,6 +2611,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2592 } 2611 }
2593 } 2612 }
2594 2613
2614 public void SendPartPhysicsProprieties(ISceneEntity entity)
2615 {
2616 SceneObjectPart part = (SceneObjectPart)entity;
2617 if (part != null && AgentId != UUID.Zero)
2618 {
2619 try
2620 {
2621 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
2622 if (eq != null)
2623 {
2624 uint localid = part.LocalId;
2625 byte physshapetype = part.PhysicsShapeType;
2626 float density = part.Density;
2627 float friction = part.Friction;
2628 float bounce = part.Bounciness;
2629 float gravmod = part.GravityModifier;
2630
2631 eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId);
2632 }
2633 }
2634 catch (Exception ex)
2635 {
2636 m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString());
2637 }
2638 part.UpdatePhysRequired = false;
2639 }
2640 }
2641
2642
2595 2643
2596 public void SendGroupNameReply(UUID groupLLUID, string GroupName) 2644 public void SendGroupNameReply(UUID groupLLUID, string GroupName)
2597 { 2645 {
@@ -2747,7 +2795,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2747 reply.Data.ParcelID = parcelID; 2795 reply.Data.ParcelID = parcelID;
2748 reply.Data.OwnerID = land.OwnerID; 2796 reply.Data.OwnerID = land.OwnerID;
2749 reply.Data.Name = Utils.StringToBytes(land.Name); 2797 reply.Data.Name = Utils.StringToBytes(land.Name);
2750 reply.Data.Desc = Utils.StringToBytes(land.Description); 2798 if (land != null && land.Description != null && land.Description != String.Empty)
2799 reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length));
2800 else
2801 reply.Data.Desc = new Byte[0];
2751 reply.Data.ActualArea = land.Area; 2802 reply.Data.ActualArea = land.Area;
2752 reply.Data.BillableArea = land.Area; // TODO: what is this? 2803 reply.Data.BillableArea = land.Area; // TODO: what is this?
2753 2804
@@ -3610,7 +3661,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3610 /// </summary> 3661 /// </summary>
3611 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 3662 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
3612 { 3663 {
3613 //double priority = m_prioritizer.GetUpdatePriority(this, entity); 3664 if (entity is SceneObjectPart)
3665 {
3666 SceneObjectPart e = (SceneObjectPart)entity;
3667 SceneObjectGroup g = e.ParentGroup;
3668 if (g.RootPart.Shape.State > 30) // HUD
3669 if (g.OwnerID != AgentId)
3670 return; // Don't send updates for other people's HUDs
3671 }
3672
3614 uint priority = m_prioritizer.GetUpdatePriority(this, entity); 3673 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
3615 3674
3616 lock (m_entityUpdates.SyncRoot) 3675 lock (m_entityUpdates.SyncRoot)
@@ -3677,211 +3736,238 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3677 3736
3678 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race 3737 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
3679 // condition where a kill can be processed before an out-of-date update for the same object. 3738 // condition where a kill can be processed before an out-of-date update for the same object.
3680 lock (m_killRecord) 3739 float avgTimeDilation = 1.0f;
3740 IEntityUpdate iupdate;
3741 Int32 timeinqueue; // this is just debugging code & can be dropped later
3742
3743 while (updatesThisCall < maxUpdates)
3681 { 3744 {
3682 float avgTimeDilation = 1.0f; 3745 lock (m_entityUpdates.SyncRoot)
3683 IEntityUpdate iupdate; 3746 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3684 Int32 timeinqueue; // this is just debugging code & can be dropped later 3747 break;
3685
3686 while (updatesThisCall < maxUpdates)
3687 {
3688 lock (m_entityUpdates.SyncRoot)
3689 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3690 break;
3691 3748
3692 EntityUpdate update = (EntityUpdate)iupdate; 3749 EntityUpdate update = (EntityUpdate)iupdate;
3693 3750
3694 avgTimeDilation += update.TimeDilation; 3751 avgTimeDilation += update.TimeDilation;
3695 avgTimeDilation *= 0.5f; 3752 avgTimeDilation *= 0.5f;
3696 3753
3697 if (update.Entity is SceneObjectPart) 3754 if (update.Entity is SceneObjectPart)
3755 {
3756 SceneObjectPart part = (SceneObjectPart)update.Entity;
3757
3758 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3759 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3760 // safety measure.
3761 //
3762 // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
3763 // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
3764 // updates and kills on different threads with different scheduling strategies, hence this protection.
3765 //
3766 // This doesn't appear to apply to child prims - a client will happily ignore these updates
3767 // after the root prim has been deleted.
3768 lock (m_killRecord)
3698 { 3769 {
3699 SceneObjectPart part = (SceneObjectPart)update.Entity;
3700
3701 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3702 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3703 // safety measure.
3704 //
3705 // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
3706 // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
3707 // updates and kills on different threads with different scheduling strategies, hence this protection.
3708 //
3709 // This doesn't appear to apply to child prims - a client will happily ignore these updates
3710 // after the root prim has been deleted.
3711 if (m_killRecord.Contains(part.LocalId)) 3770 if (m_killRecord.Contains(part.LocalId))
3712 {
3713 // m_log.WarnFormat(
3714 // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted",
3715 // part.LocalId, Name);
3716 continue; 3771 continue;
3717 } 3772 if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
3718 3773 continue;
3719 if (part.ParentGroup.IsAttachment && m_disableFacelights) 3774 }
3775
3776 if (part.ParentGroup.IsDeleted)
3777 continue;
3778
3779 if (part.ParentGroup.IsAttachment)
3780 { // Someone else's HUD, why are we getting these?
3781 if (part.ParentGroup.OwnerID != AgentId &&
3782 part.ParentGroup.RootPart.Shape.State >= 30)
3783 continue;
3784 ScenePresence sp;
3785 // Owner is not in the sim, don't update it to
3786 // anyone
3787 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
3788 continue;
3789
3790 List<SceneObjectGroup> atts = sp.GetAttachments();
3791 bool found = false;
3792 foreach (SceneObjectGroup att in atts)
3720 { 3793 {
3721 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && 3794 if (att == part.ParentGroup)
3722 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3723 { 3795 {
3724 part.Shape.LightEntry = false; 3796 found = true;
3797 break;
3725 } 3798 }
3726 } 3799 }
3800
3801 // It's an attachment of a valid avatar, but
3802 // doesn't seem to be attached, skip
3803 if (!found)
3804 continue;
3805
3806 // On vehicle crossing, the attachments are received
3807 // while the avatar is still a child. Don't send
3808 // updates here because the LocalId has not yet
3809 // been updated and the viewer will derender the
3810 // attachments until the avatar becomes root.
3811 if (sp.IsChildAgent)
3812 continue;
3727 } 3813 }
3728 3814 if (part.ParentGroup.IsAttachment && m_disableFacelights)
3729 ++updatesThisCall;
3730
3731 #region UpdateFlags to packet type conversion
3732
3733 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
3734
3735 bool canUseCompressed = true;
3736 bool canUseImproved = true;
3737
3738 // Compressed object updates only make sense for LL primitives
3739 if (!(update.Entity is SceneObjectPart))
3740 {
3741 canUseCompressed = false;
3742 }
3743
3744 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3745 {
3746 canUseCompressed = false;
3747 canUseImproved = false;
3748 }
3749 else
3750 { 3815 {
3751 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || 3816 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
3752 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || 3817 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3753 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3754 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3755 {
3756 canUseCompressed = false;
3757 }
3758
3759 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3760 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3761 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3762 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3763 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3764 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3765 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3766 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3767 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3768 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3769 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3770 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3771 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3772 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3773 { 3818 {
3774 canUseImproved = false; 3819 part.Shape.LightEntry = false;
3775 } 3820 }
3776 } 3821 }
3777 3822 }
3778 #endregion UpdateFlags to packet type conversion 3823
3779 3824 ++updatesThisCall;
3780 #region Block Construction 3825
3781 3826 #region UpdateFlags to packet type conversion
3782 // TODO: Remove this once we can build compressed updates 3827
3828 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
3829
3830 bool canUseCompressed = true;
3831 bool canUseImproved = true;
3832
3833 // Compressed object updates only make sense for LL primitives
3834 if (!(update.Entity is SceneObjectPart))
3835 {
3783 canUseCompressed = false; 3836 canUseCompressed = false;
3784 3837 }
3785 if (!canUseImproved && !canUseCompressed) 3838
3786 { 3839 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3787 if (update.Entity is ScenePresence) 3840 {
3788 { 3841 canUseCompressed = false;
3789 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); 3842 canUseImproved = false;
3790 objectUpdates.Value.Add(update); 3843 }
3791 } 3844 else
3792 else 3845 {
3793 { 3846 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
3794 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); 3847 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
3795 objectUpdates.Value.Add(update); 3848 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3796 } 3849 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3797 }
3798 else if (!canUseImproved)
3799 { 3850 {
3800 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); 3851 canUseCompressed = false;
3801 compressedUpdates.Value.Add(update);
3802 } 3852 }
3803 else 3853
3854 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3855 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3856 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3857 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3858 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3859 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3860 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3861 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3862 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3863 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3864 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3865 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3866 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3867 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3804 { 3868 {
3805 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) 3869 canUseImproved = false;
3806 {
3807 // Self updates go into a special list
3808 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3809 terseAgentUpdates.Value.Add(update);
3810 }
3811 else
3812 {
3813 // Everything else goes here
3814 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3815 terseUpdates.Value.Add(update);
3816 }
3817 } 3870 }
3818
3819 #endregion Block Construction
3820 } 3871 }
3821
3822
3823 #region Packet Sending
3824 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
3825 3872
3826 if (terseAgentUpdateBlocks.IsValueCreated) 3873 #endregion UpdateFlags to packet type conversion
3827 {
3828 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3829 3874
3830 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3875 #region Block Construction
3831 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3832 packet.RegionData.TimeDilation = timeDilation;
3833 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3834 3876
3835 for (int i = 0; i < blocks.Count; i++) 3877 // TODO: Remove this once we can build compressed updates
3836 packet.ObjectData[i] = blocks[i]; 3878 canUseCompressed = false;
3837 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3838 OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); });
3839 }
3840 3879
3841 if (objectUpdateBlocks.IsValueCreated) 3880 if (!canUseImproved && !canUseCompressed)
3842 { 3881 {
3843 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; 3882 if (update.Entity is ScenePresence)
3844 3883 {
3845 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 3884 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
3846 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3885 }
3847 packet.RegionData.TimeDilation = timeDilation; 3886 else
3848 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3887 {
3849 3888 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
3850 for (int i = 0; i < blocks.Count; i++) 3889 }
3851 packet.ObjectData[i] = blocks[i];
3852 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3853 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
3854 } 3890 }
3855 3891 else if (!canUseImproved)
3856 if (compressedUpdateBlocks.IsValueCreated)
3857 { 3892 {
3858 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; 3893 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
3859
3860 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
3861 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3862 packet.RegionData.TimeDilation = timeDilation;
3863 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
3864
3865 for (int i = 0; i < blocks.Count; i++)
3866 packet.ObjectData[i] = blocks[i];
3867 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3868 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
3869 } 3894 }
3870 3895 else
3871 if (terseUpdateBlocks.IsValueCreated)
3872 { 3896 {
3873 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; 3897 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId)
3874 3898 // Self updates go into a special list
3875 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3899 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3876 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3900 else
3877 packet.RegionData.TimeDilation = timeDilation; 3901 // Everything else goes here
3878 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3902 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3879
3880 for (int i = 0; i < blocks.Count; i++)
3881 packet.ObjectData[i] = blocks[i];
3882 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3883 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
3884 } 3903 }
3904
3905 #endregion Block Construction
3906 }
3907
3908 #region Packet Sending
3909
3910 const float TIME_DILATION = 1.0f;
3911 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
3912
3913 if (terseAgentUpdateBlocks.IsValueCreated)
3914 {
3915 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3916
3917 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
3918 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3919 packet.RegionData.TimeDilation = timeDilation;
3920 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3921
3922 for (int i = 0; i < blocks.Count; i++)
3923 packet.ObjectData[i] = blocks[i];
3924
3925 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
3926 }
3927
3928 if (objectUpdateBlocks.IsValueCreated)
3929 {
3930 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
3931
3932 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
3933 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3934 packet.RegionData.TimeDilation = timeDilation;
3935 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3936
3937 for (int i = 0; i < blocks.Count; i++)
3938 packet.ObjectData[i] = blocks[i];
3939
3940 OutPacket(packet, ThrottleOutPacketType.Task, true);
3941 }
3942
3943 if (compressedUpdateBlocks.IsValueCreated)
3944 {
3945 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
3946
3947 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
3948 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3949 packet.RegionData.TimeDilation = timeDilation;
3950 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
3951
3952 for (int i = 0; i < blocks.Count; i++)
3953 packet.ObjectData[i] = blocks[i];
3954
3955 OutPacket(packet, ThrottleOutPacketType.Task, true);
3956 }
3957
3958 if (terseUpdateBlocks.IsValueCreated)
3959 {
3960 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
3961
3962 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
3963 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3964 packet.RegionData.TimeDilation = timeDilation;
3965 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3966
3967 for (int i = 0; i < blocks.Count; i++)
3968 packet.ObjectData[i] = blocks[i];
3969
3970 OutPacket(packet, ThrottleOutPacketType.Task, true);
3885 } 3971 }
3886 3972
3887 #endregion Packet Sending 3973 #endregion Packet Sending
@@ -4174,11 +4260,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4174 4260
4175 // Pass in the delegate so that if this packet needs to be resent, we send the current properties 4261 // Pass in the delegate so that if this packet needs to be resent, we send the current properties
4176 // of the object rather than the properties when the packet was created 4262 // of the object rather than the properties when the packet was created
4177 OutPacket(packet, ThrottleOutPacketType.Task, true, 4263 // HACK : Remove intelligent resending until it's fixed in core
4178 delegate(OutgoingPacket oPacket) 4264 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4179 { 4265 // delegate(OutgoingPacket oPacket)
4180 ResendPropertyUpdates(updates, oPacket); 4266 // {
4181 }); 4267 // ResendPropertyUpdates(updates, oPacket);
4268 // });
4269 OutPacket(packet, ThrottleOutPacketType.Task, true);
4182 4270
4183 // pbcnt += blocks.Count; 4271 // pbcnt += blocks.Count;
4184 // ppcnt++; 4272 // ppcnt++;
@@ -4204,11 +4292,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4204 // of the object rather than the properties when the packet was created 4292 // of the object rather than the properties when the packet was created
4205 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); 4293 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>();
4206 updates.Add(familyUpdates.Value[i]); 4294 updates.Add(familyUpdates.Value[i]);
4207 OutPacket(packet, ThrottleOutPacketType.Task, true, 4295 // HACK : Remove intelligent resending until it's fixed in core
4208 delegate(OutgoingPacket oPacket) 4296 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4209 { 4297 // delegate(OutgoingPacket oPacket)
4210 ResendPropertyUpdates(updates, oPacket); 4298 // {
4211 }); 4299 // ResendPropertyUpdates(updates, oPacket);
4300 // });
4301 OutPacket(packet, ThrottleOutPacketType.Task, true);
4212 4302
4213 // fpcnt++; 4303 // fpcnt++;
4214 // fbcnt++; 4304 // fbcnt++;
@@ -4357,37 +4447,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4357 if (bl[i].BannedUserID == UUID.Zero) 4447 if (bl[i].BannedUserID == UUID.Zero)
4358 continue; 4448 continue;
4359 BannedUsers.Add(bl[i].BannedUserID); 4449 BannedUsers.Add(bl[i].BannedUserID);
4360 }
4361 4450
4362 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 4451 if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0))
4363 packet.AgentData.TransactionID = UUID.Random(); 4452 {
4364 packet.AgentData.AgentID = AgentId; 4453 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
4365 packet.AgentData.SessionID = SessionId; 4454 packet.AgentData.TransactionID = UUID.Random();
4366 packet.MethodData.Invoice = invoice; 4455 packet.AgentData.AgentID = AgentId;
4367 packet.MethodData.Method = Utils.StringToBytes("setaccess"); 4456 packet.AgentData.SessionID = SessionId;
4457 packet.MethodData.Invoice = invoice;
4458 packet.MethodData.Method = Utils.StringToBytes("setaccess");
4368 4459
4369 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; 4460 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
4370 4461
4371 for (int i = 0; i < (6 + BannedUsers.Count); i++) 4462 int j;
4372 { 4463 for (j = 0; j < (6 + BannedUsers.Count); j++)
4373 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); 4464 {
4374 } 4465 returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock();
4375 int j = 0; 4466 }
4467 j = 0;
4376 4468
4377 returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; 4469 returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
4378 returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; 4470 returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
4379 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 4471 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
4380 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 4472 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
4381 returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; 4473 returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++;
4382 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 4474 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
4383 4475
4384 foreach (UUID banned in BannedUsers) 4476 foreach (UUID banned in BannedUsers)
4385 { 4477 {
4386 returnblock[j].Parameter = banned.GetBytes(); j++; 4478 returnblock[j].Parameter = banned.GetBytes(); j++;
4479 }
4480 packet.ParamList = returnblock;
4481 packet.Header.Reliable = true;
4482 OutPacket(packet, ThrottleOutPacketType.Task);
4483
4484 BannedUsers.Clear();
4485 }
4387 } 4486 }
4388 packet.ParamList = returnblock; 4487
4389 packet.Header.Reliable = false;
4390 OutPacket(packet, ThrottleOutPacketType.Task);
4391 } 4488 }
4392 4489
4393 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) 4490 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
@@ -4573,7 +4670,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4573 4670
4574 if (landData.SimwideArea > 0) 4671 if (landData.SimwideArea > 0)
4575 { 4672 {
4576 int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 4673 int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L);
4674 // Never report more than sim total capacity
4675 if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity)
4676 simulatorCapacity = m_scene.RegionInfo.ObjectCapacity;
4577 updateMessage.SimWideMaxPrims = simulatorCapacity; 4677 updateMessage.SimWideMaxPrims = simulatorCapacity;
4578 } 4678 }
4579 else 4679 else
@@ -4702,14 +4802,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4702 4802
4703 if (notifyCount > 0) 4803 if (notifyCount > 0)
4704 { 4804 {
4705 if (notifyCount > 32) 4805// if (notifyCount > 32)
4706 { 4806// {
4707 m_log.InfoFormat( 4807// m_log.InfoFormat(
4708 "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" 4808// "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
4709 + " - a developer might want to investigate whether this is a hard limit", 32); 4809// + " - a developer might want to investigate whether this is a hard limit", 32);
4710 4810//
4711 notifyCount = 32; 4811// notifyCount = 32;
4712 } 4812// }
4713 4813
4714 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock 4814 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
4715 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; 4815 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
@@ -4764,9 +4864,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4764 { 4864 {
4765 ScenePresence presence = (ScenePresence)entity; 4865 ScenePresence presence = (ScenePresence)entity;
4766 4866
4867 position = presence.OffsetPosition;
4868 rotation = presence.Rotation;
4869
4870 if (presence.ParentID != 0)
4871 {
4872 SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID);
4873 if (part != null && part != part.ParentGroup.RootPart)
4874 {
4875 position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset;
4876 rotation = part.RotationOffset * presence.Rotation;
4877 }
4878 }
4879
4767 attachPoint = 0; 4880 attachPoint = 0;
4768 collisionPlane = presence.CollisionPlane; 4881 collisionPlane = presence.CollisionPlane;
4769 position = presence.OffsetPosition;
4770 velocity = presence.Velocity; 4882 velocity = presence.Velocity;
4771 acceleration = Vector3.Zero; 4883 acceleration = Vector3.Zero;
4772 4884
@@ -4776,7 +4888,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4776// acceleration = new Vector3(1, 0, 0); 4888// acceleration = new Vector3(1, 0, 0);
4777 4889
4778 angularVelocity = Vector3.Zero; 4890 angularVelocity = Vector3.Zero;
4779 rotation = presence.Rotation;
4780 4891
4781 if (sendTexture) 4892 if (sendTexture)
4782 textureEntry = presence.Appearance.Texture.GetBytes(); 4893 textureEntry = presence.Appearance.Texture.GetBytes();
@@ -4881,13 +4992,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4881 4992
4882 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) 4993 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data)
4883 { 4994 {
4995 Vector3 offsetPosition = data.OffsetPosition;
4996 Quaternion rotation = data.Rotation;
4997 uint parentID = data.ParentID;
4998
4999 if (parentID != 0)
5000 {
5001 SceneObjectPart part = m_scene.GetSceneObjectPart(parentID);
5002 if (part != null && part != part.ParentGroup.RootPart)
5003 {
5004 offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset;
5005 rotation = part.RotationOffset * data.Rotation;
5006 parentID = part.ParentGroup.RootPart.LocalId;
5007 }
5008 }
5009
4884 byte[] objectData = new byte[76]; 5010 byte[] objectData = new byte[76];
4885 5011
4886 data.CollisionPlane.ToBytes(objectData, 0); 5012 data.CollisionPlane.ToBytes(objectData, 0);
4887 data.OffsetPosition.ToBytes(objectData, 16); 5013 offsetPosition.ToBytes(objectData, 16);
4888// data.Velocity.ToBytes(objectData, 28); 5014// data.Velocity.ToBytes(objectData, 28);
4889// data.Acceleration.ToBytes(objectData, 40); 5015// data.Acceleration.ToBytes(objectData, 40);
4890 data.Rotation.ToBytes(objectData, 52); 5016 rotation.ToBytes(objectData, 52);
4891 //data.AngularVelocity.ToBytes(objectData, 64); 5017 //data.AngularVelocity.ToBytes(objectData, 64);
4892 5018
4893 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 5019 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
@@ -4901,7 +5027,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4901 update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + 5027 update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " +
4902 data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); 5028 data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle);
4903 update.ObjectData = objectData; 5029 update.ObjectData = objectData;
4904 update.ParentID = data.ParentID; 5030 update.ParentID = parentID;
4905 update.PathCurve = 16; 5031 update.PathCurve = 16;
4906 update.PathScaleX = 100; 5032 update.PathScaleX = 100;
4907 update.PathScaleY = 100; 5033 update.PathScaleY = 100;
@@ -5242,6 +5368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5242 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); 5368 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false);
5243 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); 5369 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false);
5244 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); 5370 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode);
5371 AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments);
5245 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); 5372 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false);
5246 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); 5373 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents);
5247 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); 5374 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery);
@@ -5308,6 +5435,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5308 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); 5435 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest);
5309 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); 5436 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
5310 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); 5437 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
5438 AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags);
5311 5439
5312 AddGenericPacketHandler("autopilot", HandleAutopilot); 5440 AddGenericPacketHandler("autopilot", HandleAutopilot);
5313 } 5441 }
@@ -5343,6 +5471,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5343 (x.CameraLeftAxis != lastarg.CameraLeftAxis) || 5471 (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
5344 (x.CameraUpAxis != lastarg.CameraUpAxis) || 5472 (x.CameraUpAxis != lastarg.CameraUpAxis) ||
5345 (x.ControlFlags != lastarg.ControlFlags) || 5473 (x.ControlFlags != lastarg.ControlFlags) ||
5474 (x.ControlFlags != 0) ||
5346 (x.Far != lastarg.Far) || 5475 (x.Far != lastarg.Far) ||
5347 (x.Flags != lastarg.Flags) || 5476 (x.Flags != lastarg.Flags) ||
5348 (x.State != lastarg.State) || 5477 (x.State != lastarg.State) ||
@@ -5720,7 +5849,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5720 args.Channel = ch; 5849 args.Channel = ch;
5721 args.From = String.Empty; 5850 args.From = String.Empty;
5722 args.Message = Utils.BytesToString(msg); 5851 args.Message = Utils.BytesToString(msg);
5723 args.Type = ChatTypeEnum.Shout; 5852 args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
5724 args.Position = new Vector3(); 5853 args.Position = new Vector3();
5725 args.Scene = Scene; 5854 args.Scene = Scene;
5726 args.Sender = this; 5855 args.Sender = this;
@@ -6906,10 +7035,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6906 // 46,47,48 are special positions within the packet 7035 // 46,47,48 are special positions within the packet
6907 // This may change so perhaps we need a better way 7036 // This may change so perhaps we need a better way
6908 // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) 7037 // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
6909 bool UsePhysics = (data[46] != 0) ? true : false; 7038 /*
6910 bool IsTemporary = (data[47] != 0) ? true : false; 7039 bool UsePhysics = (data[46] != 0) ? true : false;
6911 bool IsPhantom = (data[48] != 0) ? true : false; 7040 bool IsTemporary = (data[47] != 0) ? true : false;
6912 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); 7041 bool IsPhantom = (data[48] != 0) ? true : false;
7042 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
7043 */
7044 bool UsePhysics = flags.AgentData.UsePhysics;
7045 bool IsPhantom = flags.AgentData.IsPhantom;
7046 bool IsTemporary = flags.AgentData.IsTemporary;
7047 ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = flags.ExtraPhysics;
7048 ExtraPhysicsData physdata = new ExtraPhysicsData();
7049
7050 if (blocks == null || blocks.Length == 0)
7051 {
7052 physdata.PhysShapeType = PhysShapeType.invalid;
7053 }
7054 else
7055 {
7056 ObjectFlagUpdatePacket.ExtraPhysicsBlock phsblock = blocks[0];
7057 physdata.PhysShapeType = (PhysShapeType)phsblock.PhysicsShapeType;
7058 physdata.Bounce = phsblock.Restitution;
7059 physdata.Density = phsblock.Density;
7060 physdata.Friction = phsblock.Friction;
7061 physdata.GravitationModifier = phsblock.GravityMultiplier;
7062 }
7063
7064 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this);
6913 } 7065 }
6914 return true; 7066 return true;
6915 } 7067 }
@@ -9763,7 +9915,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9763 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, 9915 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID,
9764 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), 9916 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName),
9765 UpdateMuteListEntry.MuteData.MuteType, 9917 UpdateMuteListEntry.MuteData.MuteType,
9766 UpdateMuteListEntry.AgentData.AgentID); 9918 UpdateMuteListEntry.MuteData.MuteFlags);
9767 return true; 9919 return true;
9768 } 9920 }
9769 return false; 9921 return false;
@@ -9778,8 +9930,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9778 { 9930 {
9779 handlerRemoveMuteListEntry(this, 9931 handlerRemoveMuteListEntry(this,
9780 RemoveMuteListEntry.MuteData.MuteID, 9932 RemoveMuteListEntry.MuteData.MuteID,
9781 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), 9933 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName));
9782 RemoveMuteListEntry.AgentData.AgentID);
9783 return true; 9934 return true;
9784 } 9935 }
9785 return false; 9936 return false;
@@ -9823,10 +9974,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9823 return false; 9974 return false;
9824 } 9975 }
9825 9976
9977 private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet)
9978 {
9979 ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags =
9980 (ChangeInventoryItemFlagsPacket)packet;
9981 ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags;
9982 if (handlerChangeInventoryItemFlags != null)
9983 {
9984 foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData)
9985 handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags);
9986 return true;
9987 }
9988 return false;
9989 }
9990
9826 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) 9991 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack)
9827 { 9992 {
9828 return true; 9993 return true;
9829 } 9994 }
9995
9996 private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack)
9997 {
9998 CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack;
9999
10000 #region Packet Session and User Check
10001 if (m_checkPackets)
10002 {
10003 if (packet.AgentData.SessionID != SessionId ||
10004 packet.AgentData.AgentID != AgentId)
10005 return true;
10006 }
10007 #endregion
10008 MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null;
10009 List<InventoryItemBase> items = new List<InventoryItemBase>();
10010 foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData)
10011 {
10012 InventoryItemBase b = new InventoryItemBase();
10013 b.ID = n.OldItemID;
10014 b.Folder = n.OldFolderID;
10015 items.Add(b);
10016 }
10017
10018 handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy;
10019 if (handlerMoveItemsAndLeaveCopy != null)
10020 {
10021 handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID);
10022 }
10023
10024 return true;
10025 }
9830 10026
9831 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) 10027 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack)
9832 { 10028 {
@@ -10253,6 +10449,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10253 groupProfileReply.GroupData.MaturePublish = d.MaturePublish; 10449 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
10254 groupProfileReply.GroupData.OwnerRole = d.OwnerRole; 10450 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
10255 10451
10452 Scene scene = (Scene)m_scene;
10453 if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID)))
10454 {
10455 ScenePresence p;
10456 if (scene.TryGetScenePresence(sender.AgentId, out p))
10457 {
10458 if (p.GodLevel >= 200)
10459 {
10460 groupProfileReply.GroupData.OpenEnrollment = true;
10461 groupProfileReply.GroupData.MembershipFee = 0;
10462 }
10463 }
10464 }
10465
10256 OutPacket(groupProfileReply, ThrottleOutPacketType.Task); 10466 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
10257 } 10467 }
10258 return true; 10468 return true;
@@ -10826,11 +11036,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10826 11036
10827 StartLure handlerStartLure = OnStartLure; 11037 StartLure handlerStartLure = OnStartLure;
10828 if (handlerStartLure != null) 11038 if (handlerStartLure != null)
10829 handlerStartLure(startLureRequest.Info.LureType, 11039 {
10830 Utils.BytesToString( 11040 for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++)
10831 startLureRequest.Info.Message), 11041 {
10832 startLureRequest.TargetData[0].TargetID, 11042 handlerStartLure(startLureRequest.Info.LureType,
10833 this); 11043 Utils.BytesToString(
11044 startLureRequest.Info.Message),
11045 startLureRequest.TargetData[i].TargetID,
11046 this);
11047 }
11048 }
10834 return true; 11049 return true;
10835 } 11050 }
10836 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) 11051 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack)
@@ -10944,10 +11159,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10944 } 11159 }
10945 #endregion 11160 #endregion
10946 11161
10947 ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; 11162 ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete;
10948 if (handlerClassifiedGodDelete != null) 11163 if (handlerClassifiedGodDelete != null)
10949 handlerClassifiedGodDelete( 11164 handlerClassifiedGodDelete(
10950 classifiedGodDelete.Data.ClassifiedID, 11165 classifiedGodDelete.Data.ClassifiedID,
11166 classifiedGodDelete.Data.QueryID,
10951 this); 11167 this);
10952 return true; 11168 return true;
10953 } 11169 }
@@ -11313,209 +11529,149 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11313 } 11529 }
11314 else 11530 else
11315 { 11531 {
11316// m_log.DebugFormat( 11532 ClientChangeObject updatehandler = onClientChangeObject;
11317// "[CLIENT]: Processing block {0} type {1} for {2} {3}",
11318// i, block.Type, part.Name, part.LocalId);
11319 11533
11320// // Do this once since fetch parts creates a new array. 11534 if (updatehandler != null)
11321// SceneObjectPart[] parts = part.ParentGroup.Parts; 11535 {
11322// for (int j = 0; j < parts.Length; j++) 11536 ObjectChangeData udata = new ObjectChangeData();
11323// {
11324// part.StoreUndoState();
11325// parts[j].IgnoreUndoUpdate = true;
11326// }
11327 11537
11328 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; 11538 /*ubit from ll JIRA:
11539 * 0x01 position
11540 * 0x02 rotation
11541 * 0x04 scale
11542
11543 * 0x08 LINK_SET
11544 * 0x10 UNIFORM for scale
11545 */
11329 11546
11330 switch (block.Type) 11547 // translate to internal changes
11331 { 11548 // not all cases .. just the ones older code did
11332 case 1:
11333 Vector3 pos1 = new Vector3(block.Data, 0);
11334 11549
11335 UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 11550 switch (block.Type)
11336 if (handlerUpdatePrimSinglePosition != null) 11551 {
11337 { 11552 case 1: //change position sp
11338 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 11553 udata.position = new Vector3(block.Data, 0);
11339 handlerUpdatePrimSinglePosition(localId, pos1, this);
11340 }
11341 break;
11342 11554
11343 case 2: 11555 udata.change = ObjectChangeType.primP;
11344 Quaternion rot1 = new Quaternion(block.Data, 0, true); 11556 updatehandler(localId, udata, this);
11557 break;
11345 11558
11346 UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; 11559 case 2: // rotation sp
11347 if (handlerUpdatePrimSingleRotation != null) 11560 udata.rotation = new Quaternion(block.Data, 0, true);
11348 {
11349 // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W);
11350 handlerUpdatePrimSingleRotation(localId, rot1, this);
11351 }
11352 break;
11353 11561
11354 case 3: 11562 udata.change = ObjectChangeType.primR;
11355 Vector3 rotPos = new Vector3(block.Data, 0); 11563 updatehandler(localId, udata, this);
11356 Quaternion rot2 = new Quaternion(block.Data, 12, true); 11564 break;
11357 11565
11358 UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; 11566 case 3: // position plus rotation
11359 if (handlerUpdatePrimSingleRotationPosition != null) 11567 udata.position = new Vector3(block.Data, 0);
11360 { 11568 udata.rotation = new Quaternion(block.Data, 12, true);
11361 // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z);
11362 // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W);
11363 handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
11364 }
11365 break;
11366 11569
11367 case 4: 11570 udata.change = ObjectChangeType.primPR;
11368 case 20: 11571 updatehandler(localId, udata, this);
11369 Vector3 scale4 = new Vector3(block.Data, 0); 11572 break;
11370 11573
11371 UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; 11574 case 4: // scale sp
11372 if (handlerUpdatePrimScale != null) 11575 udata.scale = new Vector3(block.Data, 0);
11373 { 11576 udata.change = ObjectChangeType.primS;
11374 // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z);
11375 handlerUpdatePrimScale(localId, scale4, this);
11376 }
11377 break;
11378 11577
11379 case 5: 11578 updatehandler(localId, udata, this);
11380 Vector3 scale1 = new Vector3(block.Data, 12); 11579 break;
11381 Vector3 pos11 = new Vector3(block.Data, 0);
11382 11580
11383 handlerUpdatePrimScale = OnUpdatePrimScale; 11581 case 0x14: // uniform scale sp
11384 if (handlerUpdatePrimScale != null) 11582 udata.scale = new Vector3(block.Data, 0);
11385 {
11386 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11387 handlerUpdatePrimScale(localId, scale1, this);
11388 11583
11389 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 11584 udata.change = ObjectChangeType.primUS;
11390 if (handlerUpdatePrimSinglePosition != null) 11585 updatehandler(localId, udata, this);
11391 { 11586 break;
11392 handlerUpdatePrimSinglePosition(localId, pos11, this);
11393 }
11394 }
11395 break;
11396 11587
11397 case 9: 11588 case 5: // scale and position sp
11398 Vector3 pos2 = new Vector3(block.Data, 0); 11589 udata.position = new Vector3(block.Data, 0);
11590 udata.scale = new Vector3(block.Data, 12);
11399 11591
11400 UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; 11592 udata.change = ObjectChangeType.primPS;
11593 updatehandler(localId, udata, this);
11594 break;
11401 11595
11402 if (handlerUpdateVector != null) 11596 case 0x15: //uniform scale and position
11403 { 11597 udata.position = new Vector3(block.Data, 0);
11404 handlerUpdateVector(localId, pos2, this); 11598 udata.scale = new Vector3(block.Data, 12);
11405 }
11406 break;
11407 11599
11408 case 10: 11600 udata.change = ObjectChangeType.primPUS;
11409 Quaternion rot3 = new Quaternion(block.Data, 0, true); 11601 updatehandler(localId, udata, this);
11602 break;
11410 11603
11411 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; 11604 // now group related (bit 4)
11412 if (handlerUpdatePrimRotation != null) 11605 case 9: //( 8 + 1 )group position
11413 { 11606 udata.position = new Vector3(block.Data, 0);
11414 // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W);
11415 handlerUpdatePrimRotation(localId, rot3, this);
11416 }
11417 break;
11418 11607
11419 case 11: 11608 udata.change = ObjectChangeType.groupP;
11420 Vector3 pos3 = new Vector3(block.Data, 0); 11609 updatehandler(localId, udata, this);
11421 Quaternion rot4 = new Quaternion(block.Data, 12, true); 11610 break;
11422 11611
11423 handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; 11612 case 0x0A: // (8 + 2) group rotation
11424 if (handlerUpdatePrimGroupRotation != null) 11613 udata.rotation = new Quaternion(block.Data, 0, true);
11425 {
11426 // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
11427 // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W);
11428 handlerUpdatePrimGroupRotation(localId, pos3, rot4, this);
11429 }
11430 break;
11431 case 12:
11432 case 28:
11433 Vector3 scale7 = new Vector3(block.Data, 0);
11434 11614
11435 UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 11615 udata.change = ObjectChangeType.groupR;
11436 if (handlerUpdatePrimGroupScale != null) 11616 updatehandler(localId, udata, this);
11437 { 11617 break;
11438 // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z);
11439 handlerUpdatePrimGroupScale(localId, scale7, this);
11440 }
11441 break;
11442 11618
11443 case 13: 11619 case 0x0B: //( 8 + 2 + 1) group rotation and position
11444 Vector3 scale2 = new Vector3(block.Data, 12); 11620 udata.position = new Vector3(block.Data, 0);
11445 Vector3 pos4 = new Vector3(block.Data, 0); 11621 udata.rotation = new Quaternion(block.Data, 12, true);
11446 11622
11447 handlerUpdatePrimScale = OnUpdatePrimScale; 11623 udata.change = ObjectChangeType.groupPR;
11448 if (handlerUpdatePrimScale != null) 11624 updatehandler(localId, udata, this);
11449 { 11625 break;
11450 //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11451 handlerUpdatePrimScale(localId, scale2, this);
11452 11626
11453 // Change the position based on scale (for bug number 246) 11627 case 0x0C: // (8 + 4) group scale
11454 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 11628 // only afects root prim and only sent by viewer editor object tab scaling
11455 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 11629 // mouse edition only allows uniform scaling
11456 if (handlerUpdatePrimSinglePosition != null) 11630 // SL MAY CHANGE THIS in viewers
11457 {
11458 handlerUpdatePrimSinglePosition(localId, pos4, this);
11459 }
11460 }
11461 break;
11462 11631
11463 case 29: 11632 udata.scale = new Vector3(block.Data, 0);
11464 Vector3 scale5 = new Vector3(block.Data, 12);
11465 Vector3 pos5 = new Vector3(block.Data, 0);
11466 11633
11467 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 11634 // udata.change = ObjectChangeType.groupS;
11468 if (handlerUpdatePrimGroupScale != null) 11635 udata.change = ObjectChangeType.primS; // to conform to current SL
11469 { 11636 updatehandler(localId, udata, this);
11470 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11471 part.StoreUndoState(true);
11472 part.IgnoreUndoUpdate = true;
11473 handlerUpdatePrimGroupScale(localId, scale5, this);
11474 handlerUpdateVector = OnUpdatePrimGroupPosition;
11475 11637
11476 if (handlerUpdateVector != null) 11638 break;
11477 {
11478 handlerUpdateVector(localId, pos5, this);
11479 }
11480 11639
11481 part.IgnoreUndoUpdate = false; 11640 case 0x0D: //(8 + 4 + 1) group scale and position
11482 } 11641 // exception as above
11483 11642
11484 break; 11643 udata.position = new Vector3(block.Data, 0);
11644 udata.scale = new Vector3(block.Data, 12);
11485 11645
11486 case 21: 11646 // udata.change = ObjectChangeType.groupPS;
11487 Vector3 scale6 = new Vector3(block.Data, 12); 11647 udata.change = ObjectChangeType.primPS; // to conform to current SL
11488 Vector3 pos6 = new Vector3(block.Data, 0); 11648 updatehandler(localId, udata, this);
11649 break;
11489 11650
11490 handlerUpdatePrimScale = OnUpdatePrimScale; 11651 case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM
11491 if (handlerUpdatePrimScale != null) 11652 udata.scale = new Vector3(block.Data, 0);
11492 {
11493 part.StoreUndoState(false);
11494 part.IgnoreUndoUpdate = true;
11495 11653
11496 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 11654 udata.change = ObjectChangeType.groupUS;
11497 handlerUpdatePrimScale(localId, scale6, this); 11655 updatehandler(localId, udata, this);
11498 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 11656 break;
11499 if (handlerUpdatePrimSinglePosition != null)
11500 {
11501 handlerUpdatePrimSinglePosition(localId, pos6, this);
11502 }
11503 11657
11504 part.IgnoreUndoUpdate = false; 11658 case 0x1D: // (UNIFORM + GROUP + SCALE + POS)
11505 } 11659 udata.position = new Vector3(block.Data, 0);
11506 break; 11660 udata.scale = new Vector3(block.Data, 12);
11507 11661
11508 default: 11662 udata.change = ObjectChangeType.groupPUS;
11509 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); 11663 updatehandler(localId, udata, this);
11510 break; 11664 break;
11665
11666 default:
11667 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
11668 break;
11669 }
11511 } 11670 }
11512 11671
11513// for (int j = 0; j < parts.Length; j++)
11514// parts[j].IgnoreUndoUpdate = false;
11515 } 11672 }
11516 } 11673 }
11517 } 11674 }
11518
11519 return true; 11675 return true;
11520 } 11676 }
11521 11677
@@ -11971,7 +12127,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11971 12127
11972// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 12128// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
11973 12129
12130
12131 //Note, the bool returned from the below function is useless since it is always false.
11974 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 12132 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
12133
11975 } 12134 }
11976 12135
11977 /// <summary> 12136 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index ffa3be4..ae72175 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -158,6 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
158 158
159 private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC 159 private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC
160 private int m_maxRTO = 60000; 160 private int m_maxRTO = 60000;
161 public bool m_deliverPackets = true;
161 162
162 /// <summary> 163 /// <summary>
163 /// Default constructor 164 /// Default constructor
@@ -439,6 +440,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
439 if (category >= 0 && category < m_packetOutboxes.Length) 440 if (category >= 0 && category < m_packetOutboxes.Length)
440 { 441 {
441 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; 442 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
443
444 if (m_deliverPackets == false)
445 {
446 queue.Enqueue(packet);
447 return true;
448 }
449
442 TokenBucket bucket = m_throttleCategories[category]; 450 TokenBucket bucket = m_throttleCategories[category];
443 451
444 // Don't send this packet if there is already a packet waiting in the queue 452 // Don't send this packet if there is already a packet waiting in the queue
@@ -488,7 +496,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
488 /// <returns>True if any packets were sent, otherwise false</returns> 496 /// <returns>True if any packets were sent, otherwise false</returns>
489 public bool DequeueOutgoing() 497 public bool DequeueOutgoing()
490 { 498 {
491 OutgoingPacket packet; 499 if (m_deliverPackets == false) return false;
500
501 OutgoingPacket packet = null;
492 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; 502 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
493 TokenBucket bucket; 503 TokenBucket bucket;
494 bool packetSent = false; 504 bool packetSent = false;
@@ -520,32 +530,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP
520 // No dequeued packet waiting to be sent, try to pull one off 530 // No dequeued packet waiting to be sent, try to pull one off
521 // this queue 531 // this queue
522 queue = m_packetOutboxes[i]; 532 queue = m_packetOutboxes[i];
523 if (queue.Dequeue(out packet)) 533 if (queue != null)
524 { 534 {
525 // A packet was pulled off the queue. See if we have 535 bool success = false;
526 // enough tokens in the bucket to send it out 536 try
527 if (bucket.RemoveTokens(packet.Buffer.DataLength))
528 { 537 {
529 // Send the packet 538 success = queue.Dequeue(out packet);
530 m_udpServer.SendPacketFinal(packet);
531 packetSent = true;
532 } 539 }
533 else 540 catch
534 { 541 {
535 // Save the dequeued packet for the next iteration 542 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
536 m_nextPackets[i] = packet;
537 } 543 }
538 544 if (success)
539 // If the queue is empty after this dequeue, fire the queue 545 {
540 // empty callback now so it has a chance to fill before we 546 // A packet was pulled off the queue. See if we have
541 // get back here 547 // enough tokens in the bucket to send it out
542 if (queue.Count == 0) 548 if (bucket.RemoveTokens(packet.Buffer.DataLength))
549 {
550 // Send the packet
551 m_udpServer.SendPacketFinal(packet);
552 packetSent = true;
553 }
554 else
555 {
556 // Save the dequeued packet for the next iteration
557 m_nextPackets[i] = packet;
558 }
559
560 // If the queue is empty after this dequeue, fire the queue
561 // empty callback now so it has a chance to fill before we
562 // get back here
563 if (queue.Count == 0)
564 emptyCategories |= CategoryToFlag(i);
565 }
566 else
567 {
568 // No packets in this queue. Fire the queue empty callback
569 // if it has not been called recently
543 emptyCategories |= CategoryToFlag(i); 570 emptyCategories |= CategoryToFlag(i);
571 }
544 } 572 }
545 else 573 else
546 { 574 {
547 // No packets in this queue. Fire the queue empty callback 575 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
548 // if it has not been called recently
549 emptyCategories |= CategoryToFlag(i); 576 emptyCategories |= CategoryToFlag(i);
550 } 577 }
551 } 578 }
@@ -703,4 +730,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
703 } 730 }
704 } 731 }
705 } 732 }
706} \ No newline at end of file 733}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index fb6b11e..75f783b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1051,7 +1051,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1051 if (m_scene.TryGetClient(udpClient.AgentID, out client)) 1051 if (m_scene.TryGetClient(udpClient.AgentID, out client))
1052 { 1052 {
1053 client.IsLoggingOut = true; 1053 client.IsLoggingOut = true;
1054 client.Close(); 1054 client.Close(false);
1055 } 1055 }
1056 } 1056 }
1057 1057
@@ -1063,6 +1063,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1063 1063
1064 while (base.IsRunning) 1064 while (base.IsRunning)
1065 { 1065 {
1066 m_scene.ThreadAlive(1);
1066 try 1067 try
1067 { 1068 {
1068 IncomingPacket incomingPacket = null; 1069 IncomingPacket incomingPacket = null;
@@ -1105,6 +1106,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1105 1106
1106 while (base.IsRunning) 1107 while (base.IsRunning)
1107 { 1108 {
1109 m_scene.ThreadAlive(2);
1108 try 1110 try
1109 { 1111 {
1110 m_packetSent = false; 1112 m_packetSent = false;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
index 039379d..cfe7c9d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
@@ -100,10 +100,6 @@ namespace OpenMetaverse
100 const int SIO_UDP_CONNRESET = -1744830452; 100 const int SIO_UDP_CONNRESET = -1744830452;
101 101
102 IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort); 102 IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort);
103
104 m_log.DebugFormat(
105 "[UDPBASE]: Binding UDP listener using internal IP address config {0}:{1}",
106 ipep.Address, ipep.Port);
107 103
108 m_udpSocket = new Socket( 104 m_udpSocket = new Socket(
109 AddressFamily.InterNetwork, 105 AddressFamily.InterNetwork,