aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorTeravus Ovares2008-09-26 17:25:22 +0000
committerTeravus Ovares2008-09-26 17:25:22 +0000
commit16b6738cdadc70966a93b6d025ae469738955dcb (patch)
tree7a3c0075e9ee5fd04d972bc52be38aec4d51f648 /OpenSim/Region/ClientStack
parentDNE code cleanups (diff)
downloadopensim-SC_OLD-16b6738cdadc70966a93b6d025ae469738955dcb.zip
opensim-SC_OLD-16b6738cdadc70966a93b6d025ae469738955dcb.tar.gz
opensim-SC_OLD-16b6738cdadc70966a93b6d025ae469738955dcb.tar.bz2
opensim-SC_OLD-16b6738cdadc70966a93b6d025ae469738955dcb.tar.xz
* Patch from JHurliman
* Updates to libomv r2243, * Remove lots of unnecessary typecasts * Improves SendWindData() Thanks jhurliman. * Will update OpenSim-libs in 10 minutes..
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs110
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs10
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs5
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs1
4 files changed, 45 insertions, 81 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 4027377..5a48c90 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1232,43 +1232,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1232 /// <summary> 1232 /// <summary>
1233 /// Send the region heightmap to the client 1233 /// Send the region heightmap to the client
1234 /// </summary> 1234 /// </summary>
1235 /// <param name="map">heightmap</param> 1235 /// <param name="windSpeeds">16x16 array of wind speeds</param>
1236 public virtual void SendWindData(float[] map) 1236 public virtual void SendWindData(Vector2[] windSpeeds)
1237 { 1237 {
1238 //ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)map); 1238 ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)windSpeeds);
1239 } 1239 }
1240 1240
1241 /// <summary> 1241 /// <summary>
1242 /// Send terrain layer information to the client. 1242 /// Send terrain layer information to the client.
1243 /// </summary> 1243 /// </summary>
1244 /// <param name="o"></param> 1244 /// <param name="o"></param>
1245 //private void DoSendWindData(object o) 1245 private void DoSendWindData(object o)
1246 //{ 1246 {
1247 //float[] map = (float[])o; 1247 Vector2[] windSpeeds = (Vector2[])o;
1248 1248
1249 //try 1249 TerrainPatch[] patches = new TerrainPatch[2];
1250 //{ 1250 patches[0] = new TerrainPatch();
1251 //for (int y = 0; y < 16; y++) 1251 patches[0].Data = new float[16 * 16];
1252 //{ 1252 patches[1] = new TerrainPatch();
1253 // For some terrains, sending more than one terrain patch at once results in a libsecondlife exception 1253 patches[1].Data = new float[16 * 16];
1254 // see http://opensimulator.org/mantis/view.php?id=1662 1254
1255 //for (int x = 0; x < 16; x += 4) 1255 for (int y = 0; y < 16; y++)
1256 //{ 1256 {
1257 // SendLayerPacket(map, y, x); 1257 for (int x = 0; x < 16; x++)
1258 // Thread.Sleep(150); 1258 {
1259 //} 1259 patches[0].Data[y * 16 + x] = windSpeeds[y * 16 + x].X;
1260 // for (int x = 0; x < 16; x++) 1260 patches[1].Data[y * 16 + x] = windSpeeds[y * 16 + x].Y;
1261 //{ 1261 }
1262 //SendWindData(x, y, map); 1262 }
1263 //Thread.Sleep(35); 1263
1264 //} 1264 LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, TerrainPatch.LayerType.Wind);
1265 //} 1265 layerpack.Header.Zerocoded = true;
1266 //} 1266
1267 //catch (Exception e) 1267 OutPacket(layerpack, ThrottleOutPacketType.Wind);
1268 //{ 1268 }
1269 // m_log.Warn("[CLIENT]: ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
1270 // }
1271 //}
1272 1269
1273 /// <summary> 1270 /// <summary>
1274 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1271 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
@@ -1289,41 +1286,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1289 // } 1286 // }
1290 1287
1291 /// <summary> 1288 /// <summary>
1292 /// Sends a specified patch to a client
1293 /// </summary>
1294 /// <param name="px">Patch coordinate (x) 0..15</param>
1295 /// <param name="py">Patch coordinate (y) 0..15</param>
1296 /// <param name="map">heightmap</param>
1297 public void SendWindData(int p1x, int p1y, int p2x, int p2y, float[] map)
1298 {
1299 try
1300 {
1301 int[] patches = new int[2];
1302 int patch1x, patch1y, patch2x, patch2y;
1303 patch1x = p1x;
1304 patch1y = p1y;
1305 patch2x = p2x;
1306 patch2y = p2y;
1307
1308
1309 patches[0] = patch1x + 0 + patch1y * 16;
1310 patches[1] = patch2x + 0 + patch2y * 16;
1311
1312 LayerDataPacket layerpack = TerrainCompressor.CreateWindPacket(map, patches);
1313 layerpack.Header.Zerocoded = true;
1314
1315 OutPacket(layerpack, ThrottleOutPacketType.Wind);
1316
1317 }
1318 catch (Exception e)
1319 {
1320 m_log.Warn("[client]: ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
1321 }
1322 }
1323
1324
1325
1326 /// <summary>
1327 /// Tell the client that the given neighbour region is ready to receive a child agent. 1289 /// Tell the client that the given neighbour region is ready to receive a child agent.
1328 /// </summary> 1290 /// </summary>
1329 /// <param name="neighbourHandle"></param> 1291 /// <param name="neighbourHandle"></param>
@@ -2940,13 +2902,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2940 updatePacket.ParcelData.PassPrice = landData.PassPrice; 2902 updatePacket.ParcelData.PassPrice = landData.PassPrice;
2941 updatePacket.ParcelData.PublicCount = 0; //unemplemented 2903 updatePacket.ParcelData.PublicCount = 0; //unemplemented
2942 2904
2943 updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > 2905 updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint)RegionFlags.DenyAnonymous) >
2944 0); 2906 0);
2945 updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > 2907 updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint)RegionFlags.DenyIdentified) >
2946 0); 2908 0);
2947 updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > 2909 updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint)RegionFlags.DenyTransacted) >
2948 0); 2910 0);
2949 updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > 2911 updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint)RegionFlags.RestrictPushObject) >
2950 0); 2912 0);
2951 2913
2952 updatePacket.ParcelData.RentPrice = 0; 2914 updatePacket.ParcelData.RentPrice = 0;
@@ -3586,7 +3548,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3586 { 3548 {
3587 string name = (string)nod.Attributes["name"].Value.ToLower(); 3549 string name = (string)nod.Attributes["name"].Value.ToLower();
3588 string id = (string)nod.InnerText; 3550 string id = (string)nod.InnerText;
3589 m_defaultAnimations.Add(name, id); 3551 m_defaultAnimations.Add(name, (UUID)id);
3590 } 3552 }
3591 } 3553 }
3592 } 3554 }
@@ -4936,9 +4898,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4936 // 4898 //
4937 if (transfer.TransferInfo.SourceType == 3) 4899 if (transfer.TransferInfo.SourceType == 3)
4938 { 4900 {
4939 UUID taskID = null; 4901 UUID taskID = UUID.Zero;
4940 UUID itemID = null; 4902 UUID itemID = UUID.Zero;
4941 UUID requestID = null; 4903 UUID requestID = UUID.Zero;
4942 taskID = new UUID(transfer.TransferInfo.Params, 48); 4904 taskID = new UUID(transfer.TransferInfo.Params, 48);
4943 itemID = new UUID(transfer.TransferInfo.Params, 64); 4905 itemID = new UUID(transfer.TransferInfo.Params, 64);
4944 requestID = new UUID(transfer.TransferInfo.Params, 80); 4906 requestID = new UUID(transfer.TransferInfo.Params, 80);
@@ -5569,7 +5531,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5569 { 5531 {
5570 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 5532 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
5571 entry.AgentID = block.ID; 5533 entry.AgentID = block.ID;
5572 entry.Flags = (ParcelManager.AccessList)block.Flags; 5534 entry.Flags = (AccessList)block.Flags;
5573 entry.Time = new DateTime(); 5535 entry.Time = new DateTime();
5574 entries.Add(entry); 5536 entries.Add(entry);
5575 } 5537 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
index d885e3b..149fa9a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
@@ -109,6 +109,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
109 109
110 public Packet Packet; 110 public Packet Packet;
111 public Object Identifier; 111 public Object Identifier;
112 public int TickCount;
112 } 113 }
113 114
114 private Dictionary<uint, AckData> m_NeedAck = 115 private Dictionary<uint, AckData> m_NeedAck =
@@ -293,12 +294,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
293 Packet packet, ThrottleOutPacketType throttlePacketType, 294 Packet packet, ThrottleOutPacketType throttlePacketType,
294 Object id) 295 Object id)
295 { 296 {
296 packet.TickCount = System.Environment.TickCount;
297
298 LLQueItem item = new LLQueItem(); 297 LLQueItem item = new LLQueItem();
299 item.Packet = packet; 298 item.Packet = packet;
300 item.Incoming = false; 299 item.Incoming = false;
301 item.throttleType = throttlePacketType; 300 item.throttleType = throttlePacketType;
301 item.TickCount = System.Environment.TickCount;
302 item.Identifier = id; 302 item.Identifier = id;
303 303
304 m_PacketQueue.Enqueue(item); 304 m_PacketQueue.Enqueue(item);
@@ -341,7 +341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
341 341
342 // Packets this old get resent 342 // Packets this old get resent
343 // 343 //
344 if ((now - packet.TickCount) > m_ResendTimeout) 344 if ((now - data.TickCount) > m_ResendTimeout)
345 { 345 {
346 // Resend the packet. Set the packet's tick count to 346 // Resend the packet. Set the packet's tick count to
347 // now, and keep it marked as resent. 347 // now, and keep it marked as resent.
@@ -357,7 +357,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
357 // pipes. Most likely, the client is gone 357 // pipes. Most likely, the client is gone
358 // Drop the packets 358 // Drop the packets
359 // 359 //
360 if ((now - packet.TickCount) > m_DiscardTimeout) 360 if ((now - data.TickCount) > m_DiscardTimeout)
361 { 361 {
362 if (!m_ImportantPackets.Contains(packet.Type)) 362 if (!m_ImportantPackets.Contains(packet.Type))
363 m_NeedAck.Remove(packet.Header.Sequence); 363 m_NeedAck.Remove(packet.Header.Sequence);
@@ -729,7 +729,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
729 Packet packet = item.Packet; 729 Packet packet = item.Packet;
730 730
731 // Keep track of when this packet was sent out 731 // Keep track of when this packet was sent out
732 packet.TickCount = System.Environment.TickCount; 732 item.TickCount = System.Environment.TickCount;
733 733
734 // Assign sequence number here to prevent out of order packets 734 // Assign sequence number here to prevent out of order packets
735 if (packet.Header.Sequence == 0) 735 if (packet.Header.Sequence == 0)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
index 32b4bc1..81c789a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework.Statistics;
36using OpenSim.Framework.Statistics.Interfaces; 36using OpenSim.Framework.Statistics.Interfaces;
37using Timer=System.Timers.Timer; 37using Timer=System.Timers.Timer;
38 38
39
39namespace OpenSim.Region.ClientStack.LindenUDP 40namespace OpenSim.Region.ClientStack.LindenUDP
40{ 41{
41 public class LLPacketQueue : IPullStatsProvider 42 public class LLPacketQueue : IPullStatsProvider
@@ -45,7 +46,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
45 46
46 private bool m_enabled = true; 47 private bool m_enabled = true;
47 48
48 private BlockingQueue<LLQueItem> SendQueue; 49 private OpenSim.Framework.BlockingQueue<LLQueItem> SendQueue;
49 50
50 private Queue<LLQueItem> IncomingPacketQueue; 51 private Queue<LLQueItem> IncomingPacketQueue;
51 private Queue<LLQueItem> OutgoingPacketQueue; 52 private Queue<LLQueItem> OutgoingPacketQueue;
@@ -91,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
91 // in it to process. it's an on-purpose threadlock though because 92 // in it to process. it's an on-purpose threadlock though because
92 // without it, the clientloop will suck up all sim resources. 93 // without it, the clientloop will suck up all sim resources.
93 94
94 SendQueue = new BlockingQueue<LLQueItem>(); 95 SendQueue = new OpenSim.Framework.BlockingQueue<LLQueItem>();
95 96
96 IncomingPacketQueue = new Queue<LLQueItem>(); 97 IncomingPacketQueue = new Queue<LLQueItem>();
97 OutgoingPacketQueue = new Queue<LLQueItem>(); 98 OutgoingPacketQueue = new Queue<LLQueItem>();
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs b/OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs
index 3bb0b7a..494d62b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLQueItem.cs
@@ -40,6 +40,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
40 public Packet Packet; 40 public Packet Packet;
41 public bool Incoming; 41 public bool Incoming;
42 public ThrottleOutPacketType throttleType; 42 public ThrottleOutPacketType throttleType;
43 public int TickCount;
43 public Object Identifier; 44 public Object Identifier;
44 } 45 }
45} 46}