diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 169 |
1 files changed, 110 insertions, 59 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0aec01a..a9f9d60 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -334,11 +334,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
334 | // protected HashSet<uint> m_attachmentsSent; | 334 | // protected HashSet<uint> m_attachmentsSent; |
335 | 335 | ||
336 | private int m_moneyBalance; | 336 | private int m_moneyBalance; |
337 | private bool m_deliverPackets = true; | ||
337 | private int m_animationSequenceNumber = 1; | 338 | private int m_animationSequenceNumber = 1; |
338 | private bool m_SendLogoutPacketWhenClosing = true; | 339 | private bool m_SendLogoutPacketWhenClosing = true; |
339 | private AgentUpdateArgs lastarg; | 340 | private AgentUpdateArgs lastarg; |
340 | private bool m_IsActive = true; | 341 | private bool m_IsActive = true; |
341 | private bool m_IsLoggingOut = false; | 342 | private bool m_IsLoggingOut = false; |
343 | private bool m_IsPresenceReady = false; | ||
342 | 344 | ||
343 | protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); | 345 | 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 | 346 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers |
@@ -361,6 +363,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
361 | 363 | ||
362 | private Timer m_propertiesPacketTimer; | 364 | private Timer m_propertiesPacketTimer; |
363 | 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; | ||
364 | 367 | ||
365 | #endregion Class Members | 368 | #endregion Class Members |
366 | 369 | ||
@@ -376,6 +379,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
376 | get { return m_startpos; } | 379 | get { return m_startpos; } |
377 | set { m_startpos = value; } | 380 | set { m_startpos = value; } |
378 | } | 381 | } |
382 | public bool DeliverPackets | ||
383 | { | ||
384 | get { return m_deliverPackets; } | ||
385 | set { | ||
386 | m_deliverPackets = value; | ||
387 | m_udpClient.m_deliverPackets = value; | ||
388 | } | ||
389 | } | ||
379 | public UUID AgentId { get { return m_agentId; } } | 390 | public UUID AgentId { get { return m_agentId; } } |
380 | public UUID ActiveGroupId { get { return m_activeGroupID; } } | 391 | public UUID ActiveGroupId { get { return m_activeGroupID; } } |
381 | public string ActiveGroupName { get { return m_activeGroupName; } } | 392 | public string ActiveGroupName { get { return m_activeGroupName; } } |
@@ -401,6 +412,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
401 | get { return m_IsActive; } | 412 | get { return m_IsActive; } |
402 | set { m_IsActive = value; } | 413 | set { m_IsActive = value; } |
403 | } | 414 | } |
415 | |||
404 | public bool IsLoggingOut | 416 | public bool IsLoggingOut |
405 | { | 417 | { |
406 | get { return m_IsLoggingOut; } | 418 | get { return m_IsLoggingOut; } |
@@ -464,18 +476,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
464 | 476 | ||
465 | #region Client Methods | 477 | #region Client Methods |
466 | 478 | ||
479 | |||
467 | /// <summary> | 480 | /// <summary> |
468 | /// Shut down the client view | 481 | /// Shut down the client view |
469 | /// </summary> | 482 | /// </summary> |
470 | public void Close() | 483 | public void Close() |
471 | { | 484 | { |
485 | Close(true); | ||
486 | } | ||
487 | |||
488 | /// <summary> | ||
489 | /// Shut down the client view | ||
490 | /// </summary> | ||
491 | public void Close(bool sendStop) | ||
492 | { | ||
472 | m_log.DebugFormat( | 493 | m_log.DebugFormat( |
473 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 494 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
474 | Name, m_scene.RegionInfo.RegionName); | 495 | Name, m_scene.RegionInfo.RegionName); |
475 | 496 | ||
476 | // Send the STOP packet | 497 | if (sendStop) |
477 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | 498 | { |
478 | OutPacket(disable, ThrottleOutPacketType.Unknown); | 499 | // Send the STOP packet |
500 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
501 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
502 | } | ||
479 | 503 | ||
480 | IsActive = false; | 504 | IsActive = false; |
481 | 505 | ||
@@ -1041,6 +1065,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1041 | public virtual void SendLayerData(float[] map) | 1065 | public virtual void SendLayerData(float[] map) |
1042 | { | 1066 | { |
1043 | Util.FireAndForget(DoSendLayerData, map); | 1067 | Util.FireAndForget(DoSendLayerData, map); |
1068 | |||
1069 | // Send it sync, and async. It's not that much data | ||
1070 | // and it improves user experience just so much! | ||
1071 | DoSendLayerData(map); | ||
1044 | } | 1072 | } |
1045 | 1073 | ||
1046 | /// <summary> | 1074 | /// <summary> |
@@ -1053,16 +1081,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1053 | 1081 | ||
1054 | try | 1082 | try |
1055 | { | 1083 | { |
1056 | //for (int y = 0; y < 16; y++) | 1084 | for (int y = 0; y < 16; y++) |
1057 | //{ | 1085 | { |
1058 | // for (int x = 0; x < 16; x++) | 1086 | for (int x = 0; x < 16; x+=4) |
1059 | // { | 1087 | { |
1060 | // SendLayerData(x, y, map); | 1088 | SendLayerPacket(x, y, map); |
1061 | // } | 1089 | } |
1062 | //} | 1090 | } |
1063 | |||
1064 | // Send LayerData in a spiral pattern. Fun! | ||
1065 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1066 | } | 1091 | } |
1067 | catch (Exception e) | 1092 | catch (Exception e) |
1068 | { | 1093 | { |
@@ -1070,51 +1095,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1070 | } | 1095 | } |
1071 | } | 1096 | } |
1072 | 1097 | ||
1073 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1074 | { | ||
1075 | // Row | ||
1076 | for (int i = x1; i <= x2; i++) | ||
1077 | SendLayerData(i, y1, map); | ||
1078 | |||
1079 | // Column | ||
1080 | for (int j = y1 + 1; j <= y2; j++) | ||
1081 | SendLayerData(x2, j, map); | ||
1082 | |||
1083 | if (x2 - x1 > 0) | ||
1084 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1085 | } | ||
1086 | |||
1087 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1088 | { | ||
1089 | // Row in reverse | ||
1090 | for (int i = x2; i >= x1; i--) | ||
1091 | SendLayerData(i, y2, map); | ||
1092 | |||
1093 | // Column in reverse | ||
1094 | for (int j = y2 - 1; j >= y1; j--) | ||
1095 | SendLayerData(x1, j, map); | ||
1096 | |||
1097 | if (x2 - x1 > 0) | ||
1098 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1099 | } | ||
1100 | |||
1101 | /// <summary> | 1098 | /// <summary> |
1102 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1099 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1103 | /// </summary> | 1100 | /// </summary> |
1104 | /// <param name="map">heightmap</param> | 1101 | /// <param name="map">heightmap</param> |
1105 | /// <param name="px">X coordinate for patches 0..12</param> | 1102 | /// <param name="px">X coordinate for patches 0..12</param> |
1106 | /// <param name="py">Y coordinate for patches 0..15</param> | 1103 | /// <param name="py">Y coordinate for patches 0..15</param> |
1107 | // private void SendLayerPacket(float[] map, int y, int x) | 1104 | private void SendLayerPacket(int x, int y, float[] map) |
1108 | // { | 1105 | { |
1109 | // int[] patches = new int[4]; | 1106 | int[] patches = new int[4]; |
1110 | // patches[0] = x + 0 + y * 16; | 1107 | patches[0] = x + 0 + y * 16; |
1111 | // patches[1] = x + 1 + y * 16; | 1108 | patches[1] = x + 1 + y * 16; |
1112 | // patches[2] = x + 2 + y * 16; | 1109 | patches[2] = x + 2 + y * 16; |
1113 | // patches[3] = x + 3 + y * 16; | 1110 | patches[3] = x + 3 + y * 16; |
1114 | 1111 | ||
1115 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1112 | float[] heightmap = (map.Length == 65536) ? |
1116 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1113 | map : |
1117 | // } | 1114 | LLHeightFieldMoronize(map); |
1115 | |||
1116 | try | ||
1117 | { | ||
1118 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1119 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1120 | } | ||
1121 | catch | ||
1122 | { | ||
1123 | for (int px = x ; px < x + 4 ; px++) | ||
1124 | SendLayerData(px, y, map); | ||
1125 | } | ||
1126 | } | ||
1118 | 1127 | ||
1119 | /// <summary> | 1128 | /// <summary> |
1120 | /// Sends a specified patch to a client | 1129 | /// Sends a specified patch to a client |
@@ -1134,7 +1143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1134 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1143 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1135 | layerpack.Header.Reliable = true; | 1144 | layerpack.Header.Reliable = true; |
1136 | 1145 | ||
1137 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1146 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1138 | } | 1147 | } |
1139 | catch (Exception e) | 1148 | catch (Exception e) |
1140 | { | 1149 | { |
@@ -2206,6 +2215,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2206 | OutPacket(sound, ThrottleOutPacketType.Task); | 2215 | OutPacket(sound, ThrottleOutPacketType.Task); |
2207 | } | 2216 | } |
2208 | 2217 | ||
2218 | public void SendTransferAbort(TransferRequestPacket transferRequest) | ||
2219 | { | ||
2220 | TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); | ||
2221 | abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; | ||
2222 | abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; | ||
2223 | m_log.Debug("[Assets] Aborting transfer; asset request failed"); | ||
2224 | OutPacket(abort, ThrottleOutPacketType.Task); | ||
2225 | } | ||
2226 | |||
2209 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) | 2227 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) |
2210 | { | 2228 | { |
2211 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); | 2229 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); |
@@ -3909,6 +3927,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3909 | { | 3927 | { |
3910 | m_propertiesPacketTimer.Stop(); | 3928 | m_propertiesPacketTimer.Stop(); |
3911 | 3929 | ||
3930 | if (m_propertiesBlocks.Count == 0) | ||
3931 | return; | ||
3932 | |||
3912 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; | 3933 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; |
3913 | 3934 | ||
3914 | int index = 0; | 3935 | int index = 0; |
@@ -4900,6 +4921,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4900 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || | 4921 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || |
4901 | (x.CameraUpAxis != lastarg.CameraUpAxis) || | 4922 | (x.CameraUpAxis != lastarg.CameraUpAxis) || |
4902 | (x.ControlFlags != lastarg.ControlFlags) || | 4923 | (x.ControlFlags != lastarg.ControlFlags) || |
4924 | (x.ControlFlags != 0) || | ||
4903 | (x.Far != lastarg.Far) || | 4925 | (x.Far != lastarg.Far) || |
4904 | (x.Flags != lastarg.Flags) || | 4926 | (x.Flags != lastarg.Flags) || |
4905 | (x.State != lastarg.State) || | 4927 | (x.State != lastarg.State) || |
@@ -5271,7 +5293,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5271 | args.Channel = ch; | 5293 | args.Channel = ch; |
5272 | args.From = String.Empty; | 5294 | args.From = String.Empty; |
5273 | args.Message = Utils.BytesToString(msg); | 5295 | args.Message = Utils.BytesToString(msg); |
5274 | args.Type = ChatTypeEnum.Shout; | 5296 | args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance |
5275 | args.Position = new Vector3(); | 5297 | args.Position = new Vector3(); |
5276 | args.Scene = Scene; | 5298 | args.Scene = Scene; |
5277 | args.Sender = this; | 5299 | args.Sender = this; |
@@ -11152,18 +11174,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11152 | } | 11174 | } |
11153 | 11175 | ||
11154 | /// <summary> | 11176 | /// <summary> |
11177 | /// This processes packets which have accumulated while the presence was still in the process of initialising. | ||
11178 | /// </summary> | ||
11179 | public void ProcessPendingPackets() | ||
11180 | { | ||
11181 | m_IsPresenceReady = true; | ||
11182 | if (m_pendingPackets == null) | ||
11183 | return; | ||
11184 | foreach (Packet p in m_pendingPackets) | ||
11185 | { | ||
11186 | ProcessInPacket(p); | ||
11187 | } | ||
11188 | m_pendingPackets.Clear(); | ||
11189 | } | ||
11190 | |||
11191 | /// <summary> | ||
11155 | /// Entryway from the client to the simulator. All UDP packets from the client will end up here | 11192 | /// Entryway from the client to the simulator. All UDP packets from the client will end up here |
11156 | /// </summary> | 11193 | /// </summary> |
11157 | /// <param name="Pack">OpenMetaverse.packet</param> | 11194 | /// <param name="Pack">OpenMetaverse.packet</param> |
11158 | public void ProcessInPacket(Packet Pack) | 11195 | public void ProcessInPacket(Packet Pack) |
11159 | { | 11196 | { |
11160 | if (m_debugPacketLevel >= 255) | 11197 | if (!m_IsPresenceReady) |
11161 | m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); | 11198 | { |
11199 | if (m_pendingPackets == null) | ||
11200 | { | ||
11201 | m_pendingPackets = new List<Packet>(); | ||
11202 | } | ||
11203 | m_pendingPackets.Add(Pack); | ||
11204 | } | ||
11205 | else | ||
11206 | { | ||
11207 | if (m_debugPacketLevel >= 255) | ||
11208 | m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); | ||
11162 | 11209 | ||
11163 | if (!ProcessPacketMethod(Pack)) | 11210 | if (!ProcessPacketMethod(Pack)) |
11164 | m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); | 11211 | m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); |
11165 | 11212 | ||
11166 | PacketPool.Instance.ReturnPacket(Pack); | 11213 | PacketPool.Instance.ReturnPacket(Pack); |
11214 | } | ||
11167 | } | 11215 | } |
11168 | 11216 | ||
11169 | private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) | 11217 | private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) |
@@ -11400,7 +11448,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11400 | 11448 | ||
11401 | // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); | 11449 | // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); |
11402 | 11450 | ||
11451 | |||
11452 | //Note, the bool returned from the below function is useless since it is always false. | ||
11403 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 11453 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
11454 | |||
11404 | } | 11455 | } |
11405 | 11456 | ||
11406 | /// <summary> | 11457 | /// <summary> |