From 811cd3e0bf1c9984e9c9710dc27a606a8a689091 Mon Sep 17 00:00:00 2001
From: MW
Date: Thu, 22 May 2008 19:44:57 +0000
Subject: change to how initial terrain data is sent. Instead of sending the 64
packets in rapid fire as quickly as possible. The terrain data sending is now
done in a threadpool worker thread over ~10 seconds with a thread.sleep
between each packet sending. this hasn't been tested thoroughly, so it might
not actually help with the atom bomb terrain (missing patches) but its a
simple thing to revert if it makes things worse for anyone. 10 seconds is
roughly the time between the region handshake completing and you being in
world where you can see your avatar. So normally the terrain still should
have loaded by time you get in the region, although it is possible that
sometimes you might see the very end of the terrain load just after you
arrive.
---
.../Region/ClientStack/LindenUDP/LLClientView.cs | 56 ++++++++++++++++++----
1 file changed, 46 insertions(+), 10 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 809822d..c23369c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1002,31 +1002,67 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// heightmap
public virtual void SendLayerData(float[] map)
{
+ ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendLayerData), (object)map);
+ //try
+ //{
+ // int[] patches = new int[4];
+
+ // for (int y = 0; y < 16; y++)
+ // {
+ // for (int x = 0; x < 16; x += 4)
+ // {
+ // patches[0] = x + 0 + y * 16;
+ // patches[1] = x + 1 + y * 16;
+ // patches[2] = x + 2 + y * 16;
+ // patches[3] = x + 3 + y * 16;
+
+ // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
+ // OutPacket(layerpack, ThrottleOutPacketType.Land);
+ // }
+ // }
+ //}
+ //catch (Exception e)
+ //{
+ // m_log.Warn("[client]: " +
+ // "ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
+ //}
+ }
+
+
+ private void DoSendLayerData(object o)
+ {
+ float[] map = (float[])o;
try
{
- int[] patches = new int[4];
-
for (int y = 0; y < 16; y++)
{
for (int x = 0; x < 16; x += 4)
{
- patches[0] = x + 0 + y * 16;
- patches[1] = x + 1 + y * 16;
- patches[2] = x + 2 + y * 16;
- patches[3] = x + 3 + y * 16;
-
- Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
- OutPacket(layerpack, ThrottleOutPacketType.Land);
+ SendLayerPacket(map, y, x);
+ Thread.Sleep(150);
}
}
}
catch (Exception e)
{
m_log.Warn("[client]: " +
- "ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
+ "ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
}
}
+ private void SendLayerPacket(float[] map, int y, int x)
+ {
+ int[] patches = new int[4];
+ patches[0] = x + 0 + y * 16;
+ patches[1] = x + 1 + y * 16;
+ patches[2] = x + 2 + y * 16;
+ patches[3] = x + 3 + y * 16;
+
+ Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
+ OutPacket(layerpack, ThrottleOutPacketType.Land);
+ }
+
+
///
/// Sends a specified patch to a client
///
--
cgit v1.1