diff options
Diffstat (limited to '')
-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 c8a542b..b2a80be 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -348,6 +348,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
348 | private AgentUpdateArgs lastarg; | 348 | private AgentUpdateArgs lastarg; |
349 | private bool m_IsActive = true; | 349 | private bool m_IsActive = true; |
350 | private bool m_IsLoggingOut = false; | 350 | private bool m_IsLoggingOut = false; |
351 | private bool m_IsPresenceReady = false; | ||
351 | 352 | ||
352 | protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); | 353 | protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); |
353 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers | 354 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers |
@@ -371,6 +372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
371 | 372 | ||
372 | private Timer m_propertiesPacketTimer; | 373 | private Timer m_propertiesPacketTimer; |
373 | private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); | 374 | private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); |
375 | private List<Packet> m_pendingPackets; | ||
374 | 376 | ||
375 | #endregion Class Members | 377 | #endregion Class Members |
376 | 378 | ||
@@ -411,6 +413,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
411 | get { return m_IsActive; } | 413 | get { return m_IsActive; } |
412 | set { m_IsActive = value; } | 414 | set { m_IsActive = value; } |
413 | } | 415 | } |
416 | |||
414 | public bool IsLoggingOut | 417 | public bool IsLoggingOut |
415 | { | 418 | { |
416 | get { return m_IsLoggingOut; } | 419 | get { return m_IsLoggingOut; } |
@@ -472,18 +475,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
472 | 475 | ||
473 | #region Client Methods | 476 | #region Client Methods |
474 | 477 | ||
478 | |||
475 | /// <summary> | 479 | /// <summary> |
476 | /// Shut down the client view | 480 | /// Shut down the client view |
477 | /// </summary> | 481 | /// </summary> |
478 | public void Close() | 482 | public void Close() |
479 | { | 483 | { |
484 | Close(true); | ||
485 | } | ||
486 | |||
487 | /// <summary> | ||
488 | /// Shut down the client view | ||
489 | /// </summary> | ||
490 | public void Close(bool sendStop) | ||
491 | { | ||
480 | m_log.DebugFormat( | 492 | m_log.DebugFormat( |
481 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 493 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
482 | Name, m_scene.RegionInfo.RegionName); | 494 | Name, m_scene.RegionInfo.RegionName); |
483 | 495 | ||
484 | // Send the STOP packet | 496 | if (sendStop) |
485 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | 497 | { |
486 | OutPacket(disable, ThrottleOutPacketType.Unknown); | 498 | // Send the STOP packet |
499 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
500 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
501 | } | ||
487 | 502 | ||
488 | IsActive = false; | 503 | IsActive = false; |
489 | 504 | ||
@@ -1034,6 +1049,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1034 | public virtual void SendLayerData(float[] map) | 1049 | public virtual void SendLayerData(float[] map) |
1035 | { | 1050 | { |
1036 | Util.FireAndForget(DoSendLayerData, map); | 1051 | Util.FireAndForget(DoSendLayerData, map); |
1052 | |||
1053 | // Send it sync, and async. It's not that much data | ||
1054 | // and it improves user experience just so much! | ||
1055 | DoSendLayerData(map); | ||
1037 | } | 1056 | } |
1038 | 1057 | ||
1039 | /// <summary> | 1058 | /// <summary> |
@@ -1046,16 +1065,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1046 | 1065 | ||
1047 | try | 1066 | try |
1048 | { | 1067 | { |
1049 | //for (int y = 0; y < 16; y++) | 1068 | for (int y = 0; y < 16; y++) |
1050 | //{ | 1069 | { |
1051 | // for (int x = 0; x < 16; x++) | 1070 | for (int x = 0; x < 16; x+=4) |
1052 | // { | 1071 | { |
1053 | // SendLayerData(x, y, map); | 1072 | SendLayerPacket(x, y, map); |
1054 | // } | 1073 | } |
1055 | //} | 1074 | } |
1056 | |||
1057 | // Send LayerData in a spiral pattern. Fun! | ||
1058 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1059 | } | 1075 | } |
1060 | catch (Exception e) | 1076 | catch (Exception e) |
1061 | { | 1077 | { |
@@ -1063,51 +1079,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1063 | } | 1079 | } |
1064 | } | 1080 | } |
1065 | 1081 | ||
1066 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1067 | { | ||
1068 | // Row | ||
1069 | for (int i = x1; i <= x2; i++) | ||
1070 | SendLayerData(i, y1, map); | ||
1071 | |||
1072 | // Column | ||
1073 | for (int j = y1 + 1; j <= y2; j++) | ||
1074 | SendLayerData(x2, j, map); | ||
1075 | |||
1076 | if (x2 - x1 > 0) | ||
1077 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1078 | } | ||
1079 | |||
1080 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1081 | { | ||
1082 | // Row in reverse | ||
1083 | for (int i = x2; i >= x1; i--) | ||
1084 | SendLayerData(i, y2, map); | ||
1085 | |||
1086 | // Column in reverse | ||
1087 | for (int j = y2 - 1; j >= y1; j--) | ||
1088 | SendLayerData(x1, j, map); | ||
1089 | |||
1090 | if (x2 - x1 > 0) | ||
1091 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1092 | } | ||
1093 | |||
1094 | /// <summary> | 1082 | /// <summary> |
1095 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1083 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1096 | /// </summary> | 1084 | /// </summary> |
1097 | /// <param name="map">heightmap</param> | 1085 | /// <param name="map">heightmap</param> |
1098 | /// <param name="px">X coordinate for patches 0..12</param> | 1086 | /// <param name="px">X coordinate for patches 0..12</param> |
1099 | /// <param name="py">Y coordinate for patches 0..15</param> | 1087 | /// <param name="py">Y coordinate for patches 0..15</param> |
1100 | // private void SendLayerPacket(float[] map, int y, int x) | 1088 | private void SendLayerPacket(int x, int y, float[] map) |
1101 | // { | 1089 | { |
1102 | // int[] patches = new int[4]; | 1090 | int[] patches = new int[4]; |
1103 | // patches[0] = x + 0 + y * 16; | 1091 | patches[0] = x + 0 + y * 16; |
1104 | // patches[1] = x + 1 + y * 16; | 1092 | patches[1] = x + 1 + y * 16; |
1105 | // patches[2] = x + 2 + y * 16; | 1093 | patches[2] = x + 2 + y * 16; |
1106 | // patches[3] = x + 3 + y * 16; | 1094 | patches[3] = x + 3 + y * 16; |
1107 | 1095 | ||
1108 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1096 | float[] heightmap = (map.Length == 65536) ? |
1109 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1097 | map : |
1110 | // } | 1098 | LLHeightFieldMoronize(map); |
1099 | |||
1100 | try | ||
1101 | { | ||
1102 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1103 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1104 | } | ||
1105 | catch | ||
1106 | { | ||
1107 | for (int px = x ; px < x + 4 ; px++) | ||
1108 | SendLayerData(px, y, map); | ||
1109 | } | ||
1110 | } | ||
1111 | 1111 | ||
1112 | /// <summary> | 1112 | /// <summary> |
1113 | /// Sends a specified patch to a client | 1113 | /// Sends a specified patch to a client |
@@ -1127,7 +1127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1127 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1127 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1128 | layerpack.Header.Reliable = true; | 1128 | layerpack.Header.Reliable = true; |
1129 | 1129 | ||
1130 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1130 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1131 | } | 1131 | } |
1132 | catch (Exception e) | 1132 | catch (Exception e) |
1133 | { | 1133 | { |
@@ -3893,6 +3893,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3893 | { | 3893 | { |
3894 | m_propertiesPacketTimer.Stop(); | 3894 | m_propertiesPacketTimer.Stop(); |
3895 | 3895 | ||
3896 | if (m_propertiesBlocks.Count == 0) | ||
3897 | return; | ||
3898 | |||
3896 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; | 3899 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; |
3897 | 3900 | ||
3898 | int index = 0; | 3901 | int index = 0; |
@@ -4884,6 +4887,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4884 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || | 4887 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || |
4885 | (x.CameraUpAxis != lastarg.CameraUpAxis) || | 4888 | (x.CameraUpAxis != lastarg.CameraUpAxis) || |
4886 | (x.ControlFlags != lastarg.ControlFlags) || | 4889 | (x.ControlFlags != lastarg.ControlFlags) || |
4890 | (x.ControlFlags != 0) || | ||
4887 | (x.Far != lastarg.Far) || | 4891 | (x.Far != lastarg.Far) || |
4888 | (x.Flags != lastarg.Flags) || | 4892 | (x.Flags != lastarg.Flags) || |
4889 | (x.State != lastarg.State) || | 4893 | (x.State != lastarg.State) || |
@@ -5254,7 +5258,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5254 | args.Channel = ch; | 5258 | args.Channel = ch; |
5255 | args.From = String.Empty; | 5259 | args.From = String.Empty; |
5256 | args.Message = Utils.BytesToString(msg); | 5260 | args.Message = Utils.BytesToString(msg); |
5257 | args.Type = ChatTypeEnum.Shout; | 5261 | args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance |
5258 | args.Position = new Vector3(); | 5262 | args.Position = new Vector3(); |
5259 | args.Scene = Scene; | 5263 | args.Scene = Scene; |
5260 | args.Sender = this; | 5264 | args.Sender = this; |
@@ -11172,18 +11176,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11172 | } | 11176 | } |
11173 | 11177 | ||
11174 | /// <summary> | 11178 | /// <summary> |
11179 | /// This processes packets which have accumulated while the presence was still in the process of initialising. | ||
11180 | /// </summary> | ||
11181 | public void ProcessPendingPackets() | ||
11182 | { | ||
11183 | m_IsPresenceReady = true; | ||
11184 | if (m_pendingPackets == null) | ||
11185 | return; | ||
11186 | foreach (Packet p in m_pendingPackets) | ||
11187 | { | ||
11188 | ProcessInPacket(p); | ||
11189 | } | ||
11190 | m_pendingPackets.Clear(); | ||
11191 | } | ||
11192 | |||
11193 | /// <summary> | ||
11175 | /// Entryway from the client to the simulator. All UDP packets from the client will end up here | 11194 | /// Entryway from the client to the simulator. All UDP packets from the client will end up here |
11176 | /// </summary> | 11195 | /// </summary> |
11177 | /// <param name="Pack">OpenMetaverse.packet</param> | 11196 | /// <param name="Pack">OpenMetaverse.packet</param> |
11178 | public void ProcessInPacket(Packet Pack) | 11197 | public void ProcessInPacket(Packet Pack) |
11179 | { | 11198 | { |
11180 | if (m_debugPacketLevel >= 255) | 11199 | if (!m_IsPresenceReady) |
11181 | m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); | 11200 | { |
11201 | if (m_pendingPackets == null) | ||
11202 | { | ||
11203 | m_pendingPackets = new List<Packet>(); | ||
11204 | } | ||
11205 | m_pendingPackets.Add(Pack); | ||
11206 | } | ||
11207 | else | ||
11208 | { | ||
11209 | if (m_debugPacketLevel >= 255) | ||
11210 | m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); | ||
11182 | 11211 | ||
11183 | if (!ProcessPacketMethod(Pack)) | 11212 | if (!ProcessPacketMethod(Pack)) |
11184 | m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); | 11213 | m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); |
11185 | 11214 | ||
11186 | PacketPool.Instance.ReturnPacket(Pack); | 11215 | PacketPool.Instance.ReturnPacket(Pack); |
11216 | } | ||
11187 | } | 11217 | } |
11188 | 11218 | ||
11189 | private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) | 11219 | private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) |