diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 148 |
1 files changed, 89 insertions, 59 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index fc5bb28..b2df0bd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -339,6 +339,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
339 | private AgentUpdateArgs lastarg; | 339 | private AgentUpdateArgs lastarg; |
340 | private bool m_IsActive = true; | 340 | private bool m_IsActive = true; |
341 | private bool m_IsLoggingOut = false; | 341 | private bool m_IsLoggingOut = false; |
342 | private bool m_IsPresenceReady = false; | ||
342 | 343 | ||
343 | protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); | 344 | protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); |
344 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers | 345 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers |
@@ -362,6 +363,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
362 | 363 | ||
363 | private Timer m_propertiesPacketTimer; | 364 | private Timer m_propertiesPacketTimer; |
364 | private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); | 365 | private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); |
366 | private List<Packet> m_pendingPackets; | ||
365 | 367 | ||
366 | #endregion Class Members | 368 | #endregion Class Members |
367 | 369 | ||
@@ -402,6 +404,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
402 | get { return m_IsActive; } | 404 | get { return m_IsActive; } |
403 | set { m_IsActive = value; } | 405 | set { m_IsActive = value; } |
404 | } | 406 | } |
407 | |||
405 | public bool IsLoggingOut | 408 | public bool IsLoggingOut |
406 | { | 409 | { |
407 | get { return m_IsLoggingOut; } | 410 | get { return m_IsLoggingOut; } |
@@ -466,18 +469,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
466 | 469 | ||
467 | #region Client Methods | 470 | #region Client Methods |
468 | 471 | ||
472 | |||
469 | /// <summary> | 473 | /// <summary> |
470 | /// Shut down the client view | 474 | /// Shut down the client view |
471 | /// </summary> | 475 | /// </summary> |
472 | public void Close() | 476 | public void Close() |
473 | { | 477 | { |
478 | Close(true); | ||
479 | } | ||
480 | |||
481 | /// <summary> | ||
482 | /// Shut down the client view | ||
483 | /// </summary> | ||
484 | public void Close(bool sendStop) | ||
485 | { | ||
474 | m_log.DebugFormat( | 486 | m_log.DebugFormat( |
475 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 487 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
476 | Name, m_scene.RegionInfo.RegionName); | 488 | Name, m_scene.RegionInfo.RegionName); |
477 | 489 | ||
478 | // Send the STOP packet | 490 | if (sendStop) |
479 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | 491 | { |
480 | OutPacket(disable, ThrottleOutPacketType.Unknown); | 492 | // Send the STOP packet |
493 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
494 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
495 | } | ||
481 | 496 | ||
482 | IsActive = false; | 497 | IsActive = false; |
483 | 498 | ||
@@ -1043,6 +1058,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1043 | public virtual void SendLayerData(float[] map) | 1058 | public virtual void SendLayerData(float[] map) |
1044 | { | 1059 | { |
1045 | Util.FireAndForget(DoSendLayerData, map); | 1060 | Util.FireAndForget(DoSendLayerData, map); |
1061 | |||
1062 | // Send it sync, and async. It's not that much data | ||
1063 | // and it improves user experience just so much! | ||
1064 | DoSendLayerData(map); | ||
1046 | } | 1065 | } |
1047 | 1066 | ||
1048 | /// <summary> | 1067 | /// <summary> |
@@ -1055,16 +1074,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1055 | 1074 | ||
1056 | try | 1075 | try |
1057 | { | 1076 | { |
1058 | //for (int y = 0; y < 16; y++) | 1077 | for (int y = 0; y < 16; y++) |
1059 | //{ | 1078 | { |
1060 | // for (int x = 0; x < 16; x++) | 1079 | for (int x = 0; x < 16; x+=4) |
1061 | // { | 1080 | { |
1062 | // SendLayerData(x, y, map); | 1081 | SendLayerPacket(x, y, map); |
1063 | // } | 1082 | } |
1064 | //} | 1083 | } |
1065 | |||
1066 | // Send LayerData in a spiral pattern. Fun! | ||
1067 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1068 | } | 1084 | } |
1069 | catch (Exception e) | 1085 | catch (Exception e) |
1070 | { | 1086 | { |
@@ -1072,51 +1088,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1072 | } | 1088 | } |
1073 | } | 1089 | } |
1074 | 1090 | ||
1075 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1076 | { | ||
1077 | // Row | ||
1078 | for (int i = x1; i <= x2; i++) | ||
1079 | SendLayerData(i, y1, map); | ||
1080 | |||
1081 | // Column | ||
1082 | for (int j = y1 + 1; j <= y2; j++) | ||
1083 | SendLayerData(x2, j, map); | ||
1084 | |||
1085 | if (x2 - x1 > 0) | ||
1086 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1087 | } | ||
1088 | |||
1089 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1090 | { | ||
1091 | // Row in reverse | ||
1092 | for (int i = x2; i >= x1; i--) | ||
1093 | SendLayerData(i, y2, map); | ||
1094 | |||
1095 | // Column in reverse | ||
1096 | for (int j = y2 - 1; j >= y1; j--) | ||
1097 | SendLayerData(x1, j, map); | ||
1098 | |||
1099 | if (x2 - x1 > 0) | ||
1100 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1101 | } | ||
1102 | |||
1103 | /// <summary> | 1091 | /// <summary> |
1104 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1092 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1105 | /// </summary> | 1093 | /// </summary> |
1106 | /// <param name="map">heightmap</param> | 1094 | /// <param name="map">heightmap</param> |
1107 | /// <param name="px">X coordinate for patches 0..12</param> | 1095 | /// <param name="px">X coordinate for patches 0..12</param> |
1108 | /// <param name="py">Y coordinate for patches 0..15</param> | 1096 | /// <param name="py">Y coordinate for patches 0..15</param> |
1109 | // private void SendLayerPacket(float[] map, int y, int x) | 1097 | private void SendLayerPacket(int x, int y, float[] map) |
1110 | // { | 1098 | { |
1111 | // int[] patches = new int[4]; | 1099 | int[] patches = new int[4]; |
1112 | // patches[0] = x + 0 + y * 16; | 1100 | patches[0] = x + 0 + y * 16; |
1113 | // patches[1] = x + 1 + y * 16; | 1101 | patches[1] = x + 1 + y * 16; |
1114 | // patches[2] = x + 2 + y * 16; | 1102 | patches[2] = x + 2 + y * 16; |
1115 | // patches[3] = x + 3 + y * 16; | 1103 | patches[3] = x + 3 + y * 16; |
1116 | 1104 | ||
1117 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1105 | float[] heightmap = (map.Length == 65536) ? |
1118 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1106 | map : |
1119 | // } | 1107 | LLHeightFieldMoronize(map); |
1108 | |||
1109 | try | ||
1110 | { | ||
1111 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1112 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1113 | } | ||
1114 | catch | ||
1115 | { | ||
1116 | for (int px = x ; px < x + 4 ; px++) | ||
1117 | SendLayerData(px, y, map); | ||
1118 | } | ||
1119 | } | ||
1120 | 1120 | ||
1121 | /// <summary> | 1121 | /// <summary> |
1122 | /// Sends a specified patch to a client | 1122 | /// Sends a specified patch to a client |
@@ -1136,7 +1136,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1136 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1136 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1137 | layerpack.Header.Reliable = true; | 1137 | layerpack.Header.Reliable = true; |
1138 | 1138 | ||
1139 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1139 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1140 | } | 1140 | } |
1141 | catch (Exception e) | 1141 | catch (Exception e) |
1142 | { | 1142 | { |
@@ -3935,6 +3935,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3935 | { | 3935 | { |
3936 | m_propertiesPacketTimer.Stop(); | 3936 | m_propertiesPacketTimer.Stop(); |
3937 | 3937 | ||
3938 | if (m_propertiesBlocks.Count == 0) | ||
3939 | return; | ||
3940 | |||
3938 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; | 3941 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; |
3939 | 3942 | ||
3940 | int index = 0; | 3943 | int index = 0; |
@@ -4926,6 +4929,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4926 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || | 4929 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || |
4927 | (x.CameraUpAxis != lastarg.CameraUpAxis) || | 4930 | (x.CameraUpAxis != lastarg.CameraUpAxis) || |
4928 | (x.ControlFlags != lastarg.ControlFlags) || | 4931 | (x.ControlFlags != lastarg.ControlFlags) || |
4932 | (x.ControlFlags != 0) || | ||
4929 | (x.Far != lastarg.Far) || | 4933 | (x.Far != lastarg.Far) || |
4930 | (x.Flags != lastarg.Flags) || | 4934 | (x.Flags != lastarg.Flags) || |
4931 | (x.State != lastarg.State) || | 4935 | (x.State != lastarg.State) || |
@@ -5297,7 +5301,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5297 | args.Channel = ch; | 5301 | args.Channel = ch; |
5298 | args.From = String.Empty; | 5302 | args.From = String.Empty; |
5299 | args.Message = Utils.BytesToString(msg); | 5303 | args.Message = Utils.BytesToString(msg); |
5300 | args.Type = ChatTypeEnum.Shout; | 5304 | args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance |
5301 | args.Position = new Vector3(); | 5305 | args.Position = new Vector3(); |
5302 | args.Scene = Scene; | 5306 | args.Scene = Scene; |
5303 | args.Sender = this; | 5307 | args.Sender = this; |
@@ -11215,18 +11219,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11215 | } | 11219 | } |
11216 | 11220 | ||
11217 | /// <summary> | 11221 | /// <summary> |
11222 | /// This processes packets which have accumulated while the presence was still in the process of initialising. | ||
11223 | /// </summary> | ||
11224 | public void ProcessPendingPackets() | ||
11225 | { | ||
11226 | m_IsPresenceReady = true; | ||
11227 | if (m_pendingPackets == null) | ||
11228 | return; | ||
11229 | foreach (Packet p in m_pendingPackets) | ||
11230 | { | ||
11231 | ProcessInPacket(p); | ||
11232 | } | ||
11233 | m_pendingPackets.Clear(); | ||
11234 | } | ||
11235 | |||
11236 | /// <summary> | ||
11218 | /// Entryway from the client to the simulator. All UDP packets from the client will end up here | 11237 | /// Entryway from the client to the simulator. All UDP packets from the client will end up here |
11219 | /// </summary> | 11238 | /// </summary> |
11220 | /// <param name="Pack">OpenMetaverse.packet</param> | 11239 | /// <param name="Pack">OpenMetaverse.packet</param> |
11221 | public void ProcessInPacket(Packet Pack) | 11240 | public void ProcessInPacket(Packet Pack) |
11222 | { | 11241 | { |
11223 | if (m_debugPacketLevel >= 255) | 11242 | if (!m_IsPresenceReady) |
11224 | m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); | 11243 | { |
11244 | if (m_pendingPackets == null) | ||
11245 | { | ||
11246 | m_pendingPackets = new List<Packet>(); | ||
11247 | } | ||
11248 | m_pendingPackets.Add(Pack); | ||
11249 | } | ||
11250 | else | ||
11251 | { | ||
11252 | if (m_debugPacketLevel >= 255) | ||
11253 | m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); | ||
11225 | 11254 | ||
11226 | if (!ProcessPacketMethod(Pack)) | 11255 | if (!ProcessPacketMethod(Pack)) |
11227 | m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); | 11256 | m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); |
11228 | 11257 | ||
11229 | PacketPool.Instance.ReturnPacket(Pack); | 11258 | PacketPool.Instance.ReturnPacket(Pack); |
11259 | } | ||
11230 | } | 11260 | } |
11231 | 11261 | ||
11232 | private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) | 11262 | private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) |