diff options
Diffstat (limited to '')
5 files changed, 175 insertions, 54 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index b53a2fb..9869a99 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | |||
@@ -31,7 +31,6 @@ using OpenMetaverse; | |||
31 | using OpenMetaverse.Imaging; | 31 | using OpenMetaverse.Imaging; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes.Hypergrid; | ||
35 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
36 | using log4net; | 35 | using log4net; |
37 | using System.Reflection; | 36 | using System.Reflection; |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index ebcdd62..773baf5 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -40,11 +40,9 @@ using OpenMetaverse.Packets; | |||
40 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.Client; | 42 | using OpenSim.Framework.Client; |
43 | using OpenSim.Framework.Communications.Cache; | ||
44 | using OpenSim.Framework.Statistics; | 43 | using OpenSim.Framework.Statistics; |
45 | using OpenSim.Region.Framework.Interfaces; | 44 | using OpenSim.Region.Framework.Interfaces; |
46 | using OpenSim.Region.Framework.Scenes; | 45 | using OpenSim.Region.Framework.Scenes; |
47 | using OpenSim.Region.Framework.Scenes.Hypergrid; | ||
48 | using OpenSim.Services.Interfaces; | 46 | using OpenSim.Services.Interfaces; |
49 | using Timer = System.Timers.Timer; | 47 | using Timer = System.Timers.Timer; |
50 | using AssetLandmark = OpenSim.Framework.AssetLandmark; | 48 | using AssetLandmark = OpenSim.Framework.AssetLandmark; |
@@ -98,6 +96,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
98 | /// </summary> | 96 | /// </summary> |
99 | public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector | 97 | public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector |
100 | { | 98 | { |
99 | /// <value> | ||
100 | /// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets). | ||
101 | /// </value> | ||
102 | protected int m_debugPacketLevel = 0; | ||
103 | |||
101 | #region Events | 104 | #region Events |
102 | 105 | ||
103 | public event GenericMessage OnGenericMessage; | 106 | public event GenericMessage OnGenericMessage; |
@@ -122,7 +125,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
122 | public event ObjectAttach OnObjectAttach; | 125 | public event ObjectAttach OnObjectAttach; |
123 | public event ObjectDeselect OnObjectDetach; | 126 | public event ObjectDeselect OnObjectDetach; |
124 | public event ObjectDrop OnObjectDrop; | 127 | public event ObjectDrop OnObjectDrop; |
125 | public event GenericCall2 OnCompleteMovementToRegion; | 128 | public event GenericCall1 OnCompleteMovementToRegion; |
129 | public event UpdateAgent OnPreAgentUpdate; | ||
126 | public event UpdateAgent OnAgentUpdate; | 130 | public event UpdateAgent OnAgentUpdate; |
127 | public event AgentRequestSit OnAgentRequestSit; | 131 | public event AgentRequestSit OnAgentRequestSit; |
128 | public event AgentSit OnAgentSit; | 132 | public event AgentSit OnAgentSit; |
@@ -348,11 +352,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
348 | protected PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates; | 352 | protected PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates; |
349 | private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates; | 353 | private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates; |
350 | private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates; | 354 | private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates; |
355 | |||
356 | /// <value> | ||
357 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | ||
358 | /// continually recreate it. | ||
359 | /// </value> | ||
360 | protected List<ObjectUpdatePacket.ObjectDataBlock> m_fullUpdateDataBlocksBuilder; | ||
361 | |||
362 | /// <value> | ||
363 | /// Maintain a record of all the objects killed. This allows us to stop an update being sent from the | ||
364 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | ||
365 | /// ownerless phantom. | ||
366 | /// | ||
367 | /// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock | ||
368 | /// | ||
369 | /// </value> | ||
370 | protected HashSet<uint> m_killRecord; | ||
371 | |||
351 | private int m_moneyBalance; | 372 | private int m_moneyBalance; |
352 | private int m_animationSequenceNumber = 1; | 373 | private int m_animationSequenceNumber = 1; |
353 | private bool m_SendLogoutPacketWhenClosing = true; | 374 | private bool m_SendLogoutPacketWhenClosing = true; |
354 | private AgentUpdateArgs lastarg; | 375 | private AgentUpdateArgs lastarg; |
355 | private bool m_IsActive = true; | 376 | private bool m_IsActive = true; |
377 | private bool m_IsLoggingOut = false; | ||
356 | 378 | ||
357 | protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); | 379 | protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); |
358 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers | 380 | protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers |
@@ -416,6 +438,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
416 | get { return m_IsActive; } | 438 | get { return m_IsActive; } |
417 | set { m_IsActive = value; } | 439 | set { m_IsActive = value; } |
418 | } | 440 | } |
441 | public bool IsLoggingOut | ||
442 | { | ||
443 | get { return m_IsLoggingOut; } | ||
444 | set { m_IsLoggingOut = value; } | ||
445 | } | ||
446 | |||
419 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } | 447 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } |
420 | 448 | ||
421 | #endregion Properties | 449 | #endregion Properties |
@@ -437,6 +465,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
437 | m_avatarTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); | 465 | m_avatarTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); |
438 | m_primTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); | 466 | m_primTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); |
439 | m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count); | 467 | m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count); |
468 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); | ||
469 | m_killRecord = new HashSet<uint>(); | ||
440 | 470 | ||
441 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 471 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
442 | m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); | 472 | m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); |
@@ -466,6 +496,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
466 | 496 | ||
467 | public void SetDebugPacketLevel(int newDebug) | 497 | public void SetDebugPacketLevel(int newDebug) |
468 | { | 498 | { |
499 | m_debugPacketLevel = newDebug; | ||
469 | } | 500 | } |
470 | 501 | ||
471 | #region Client Methods | 502 | #region Client Methods |
@@ -825,6 +856,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
825 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); | 856 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); |
826 | gmp.ParamList[i++].Parameter = val; | 857 | gmp.ParamList[i++].Parameter = val; |
827 | } | 858 | } |
859 | |||
828 | OutPacket(gmp, ThrottleOutPacketType.Task); | 860 | OutPacket(gmp, ThrottleOutPacketType.Task); |
829 | } | 861 | } |
830 | 862 | ||
@@ -1461,7 +1493,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1461 | kill.ObjectData[0].ID = localID; | 1493 | kill.ObjectData[0].ID = localID; |
1462 | kill.Header.Reliable = true; | 1494 | kill.Header.Reliable = true; |
1463 | kill.Header.Zerocoded = true; | 1495 | kill.Header.Zerocoded = true; |
1464 | OutPacket(kill, ThrottleOutPacketType.State); | 1496 | |
1497 | lock (m_primFullUpdates.SyncRoot) | ||
1498 | { | ||
1499 | m_killRecord.Add(localID); | ||
1500 | OutPacket(kill, ThrottleOutPacketType.State); | ||
1501 | } | ||
1465 | } | 1502 | } |
1466 | 1503 | ||
1467 | /// <summary> | 1504 | /// <summary> |
@@ -2512,6 +2549,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2512 | 2549 | ||
2513 | public void SendAsset(AssetRequestToClient req) | 2550 | public void SendAsset(AssetRequestToClient req) |
2514 | { | 2551 | { |
2552 | if (req.AssetInf.Data == null) | ||
2553 | { | ||
2554 | m_log.ErrorFormat("Cannot send asset {0} ({1}), asset data is null", | ||
2555 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | ||
2556 | return; | ||
2557 | } | ||
2558 | |||
2515 | //m_log.Debug("sending asset " + req.RequestAssetID); | 2559 | //m_log.Debug("sending asset " + req.RequestAssetID); |
2516 | TransferInfoPacket Transfer = new TransferInfoPacket(); | 2560 | TransferInfoPacket Transfer = new TransferInfoPacket(); |
2517 | Transfer.TransferInfo.ChannelType = 2; | 2561 | Transfer.TransferInfo.ChannelType = 2; |
@@ -3501,21 +3545,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3501 | if (count == 0) | 3545 | if (count == 0) |
3502 | return; | 3546 | return; |
3503 | 3547 | ||
3504 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; | 3548 | m_fullUpdateDataBlocksBuilder.Clear(); |
3549 | |||
3505 | for (int i = 0; i < count; i++) | 3550 | for (int i = 0; i < count; i++) |
3506 | { | 3551 | { |
3507 | outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); | 3552 | ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue(); |
3508 | 3553 | ||
3554 | if (!m_killRecord.Contains(block.ID)) | ||
3555 | { | ||
3556 | m_fullUpdateDataBlocksBuilder.Add(block); | ||
3557 | |||
3509 | // string text = Util.FieldToString(outPacket.ObjectData[i].Text); | 3558 | // string text = Util.FieldToString(outPacket.ObjectData[i].Text); |
3510 | // if (text.IndexOf("\n") >= 0) | 3559 | // if (text.IndexOf("\n") >= 0) |
3511 | // text = text.Remove(text.IndexOf("\n")); | 3560 | // text = text.Remove(text.IndexOf("\n")); |
3512 | // m_log.DebugFormat( | 3561 | // m_log.DebugFormat( |
3513 | // "[CLIENT]: Sending full info about prim {0} text {1} to client {2}", | 3562 | // "[CLIENT]: Sending full info about prim {0} text {1} to client {2}", |
3514 | // outPacket.ObjectData[i].ID, text, Name); | 3563 | // outPacket.ObjectData[i].ID, text, Name); |
3564 | } | ||
3565 | // else | ||
3566 | // { | ||
3567 | // m_log.WarnFormat( | ||
3568 | // "[CLIENT]: Preventing full update for {0} after kill to {1}", block.ID, Name); | ||
3569 | // } | ||
3515 | } | 3570 | } |
3516 | } | ||
3517 | 3571 | ||
3518 | OutPacket(outPacket, ThrottleOutPacketType.State); | 3572 | outPacket.ObjectData = m_fullUpdateDataBlocksBuilder.ToArray(); |
3573 | |||
3574 | OutPacket(outPacket, ThrottleOutPacketType.State); | ||
3575 | } | ||
3519 | } | 3576 | } |
3520 | 3577 | ||
3521 | public void SendPrimTerseUpdate(SendPrimitiveTerseData data) | 3578 | public void SendPrimTerseUpdate(SendPrimitiveTerseData data) |
@@ -4051,10 +4108,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4051 | EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); | 4108 | EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); |
4052 | edata.CovenantID = covenant; | 4109 | edata.CovenantID = covenant; |
4053 | edata.CovenantTimestamp = 0; | 4110 | edata.CovenantTimestamp = 0; |
4054 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) | 4111 | edata.EstateOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
4055 | edata.EstateOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
4056 | else | ||
4057 | edata.EstateOwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; | ||
4058 | edata.EstateName = Utils.StringToBytes(m_scene.RegionInfo.EstateSettings.EstateName); | 4112 | edata.EstateName = Utils.StringToBytes(m_scene.RegionInfo.EstateSettings.EstateName); |
4059 | einfopack.Data = edata; | 4113 | einfopack.Data = edata; |
4060 | OutPacket(einfopack, ThrottleOutPacketType.Task); | 4114 | OutPacket(einfopack, ThrottleOutPacketType.Task); |
@@ -4075,8 +4129,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4075 | 4129 | ||
4076 | //Sending Estate Settings | 4130 | //Sending Estate Settings |
4077 | returnblock[0].Parameter = Utils.StringToBytes(estateName); | 4131 | returnblock[0].Parameter = Utils.StringToBytes(estateName); |
4078 | // TODO: remove this cruft once MasterAvatar is fully deprecated | ||
4079 | // | ||
4080 | returnblock[1].Parameter = Utils.StringToBytes(estateOwner.ToString()); | 4132 | returnblock[1].Parameter = Utils.StringToBytes(estateOwner.ToString()); |
4081 | returnblock[2].Parameter = Utils.StringToBytes(estateID.ToString()); | 4133 | returnblock[2].Parameter = Utils.StringToBytes(estateID.ToString()); |
4082 | 4134 | ||
@@ -4866,7 +4918,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4866 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; | 4918 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; |
4867 | lastarg = arg; // save this set of arguments for nexttime | 4919 | lastarg = arg; // save this set of arguments for nexttime |
4868 | if (handlerAgentUpdate != null) | 4920 | if (handlerAgentUpdate != null) |
4921 | { | ||
4922 | OnPreAgentUpdate(this, arg); | ||
4869 | OnAgentUpdate(this, arg); | 4923 | OnAgentUpdate(this, arg); |
4924 | } | ||
4870 | 4925 | ||
4871 | handlerAgentUpdate = null; | 4926 | handlerAgentUpdate = null; |
4872 | } | 4927 | } |
@@ -5505,6 +5560,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5505 | // for the client session anyway, in order to protect ourselves against bad code in plugins | 5560 | // for the client session anyway, in order to protect ourselves against bad code in plugins |
5506 | try | 5561 | try |
5507 | { | 5562 | { |
5563 | |||
5508 | byte[] visualparams = new byte[appear.VisualParam.Length]; | 5564 | byte[] visualparams = new byte[appear.VisualParam.Length]; |
5509 | for (int i = 0; i < appear.VisualParam.Length; i++) | 5565 | for (int i = 0; i < appear.VisualParam.Length; i++) |
5510 | visualparams[i] = appear.VisualParam[i].ParamValue; | 5566 | visualparams[i] = appear.VisualParam[i].ParamValue; |
@@ -5715,10 +5771,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5715 | 5771 | ||
5716 | private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) | 5772 | private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) |
5717 | { | 5773 | { |
5718 | GenericCall2 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; | 5774 | GenericCall1 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; |
5719 | if (handlerCompleteMovementToRegion != null) | 5775 | if (handlerCompleteMovementToRegion != null) |
5720 | { | 5776 | { |
5721 | handlerCompleteMovementToRegion(); | 5777 | handlerCompleteMovementToRegion(sender); |
5722 | } | 5778 | } |
5723 | handlerCompleteMovementToRegion = null; | 5779 | handlerCompleteMovementToRegion = null; |
5724 | 5780 | ||
@@ -5946,7 +6002,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5946 | || avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f) | 6002 | || avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f) |
5947 | { | 6003 | { |
5948 | ScenePresence avatar = null; | 6004 | ScenePresence avatar = null; |
5949 | if (((Scene)m_scene).TryGetAvatar(AgentId, out avatar)) | 6005 | if (((Scene)m_scene).TryGetScenePresence(AgentId, out avatar)) |
5950 | { | 6006 | { |
5951 | if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f) | 6007 | if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f) |
5952 | { | 6008 | { |
@@ -7038,7 +7094,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7038 | assetRequestItem = invService.GetItem(assetRequestItem); | 7094 | assetRequestItem = invService.GetItem(assetRequestItem); |
7039 | if (assetRequestItem == null) | 7095 | if (assetRequestItem == null) |
7040 | { | 7096 | { |
7041 | assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); | 7097 | ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>(); |
7098 | if (lib != null) | ||
7099 | assetRequestItem = lib.LibraryRootFolder.FindItem(itemID); | ||
7042 | if (assetRequestItem == null) | 7100 | if (assetRequestItem == null) |
7043 | return true; | 7101 | return true; |
7044 | } | 7102 | } |
@@ -10928,7 +10986,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10928 | LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length); | 10986 | LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length); |
10929 | #endregion BinaryStats | 10987 | #endregion BinaryStats |
10930 | 10988 | ||
10931 | m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true); | 10989 | OutPacket(packet, throttlePacketType, true); |
10932 | } | 10990 | } |
10933 | 10991 | ||
10934 | /// <summary> | 10992 | /// <summary> |
@@ -10941,6 +10999,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10941 | /// handles splitting manually</param> | 10999 | /// handles splitting manually</param> |
10942 | protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) | 11000 | protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) |
10943 | { | 11001 | { |
11002 | if (m_debugPacketLevel >= 255) | ||
11003 | m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); | ||
11004 | |||
10944 | m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); | 11005 | m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); |
10945 | } | 11006 | } |
10946 | 11007 | ||
@@ -11012,10 +11073,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11012 | /// <param name="Pack">OpenMetaverse.packet</param> | 11073 | /// <param name="Pack">OpenMetaverse.packet</param> |
11013 | public void ProcessInPacket(Packet Pack) | 11074 | public void ProcessInPacket(Packet Pack) |
11014 | { | 11075 | { |
11015 | // m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack); | 11076 | if (m_debugPacketLevel >= 255) |
11077 | m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); | ||
11016 | 11078 | ||
11017 | if (!ProcessPacketMethod(Pack)) | 11079 | if (!ProcessPacketMethod(Pack)) |
11018 | m_log.Warn("[CLIENT]: unhandled packet " + Pack); | 11080 | m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); |
11019 | 11081 | ||
11020 | PacketPool.Instance.ReturnPacket(Pack); | 11082 | PacketPool.Instance.ReturnPacket(Pack); |
11021 | } | 11083 | } |
@@ -11333,6 +11395,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11333 | const uint m_maxPacketSize = 600; | 11395 | const uint m_maxPacketSize = 600; |
11334 | int numPackets = 1; | 11396 | int numPackets = 1; |
11335 | 11397 | ||
11398 | if (data == null) | ||
11399 | return 0; | ||
11400 | |||
11336 | if (data.LongLength > m_maxPacketSize) | 11401 | if (data.LongLength > m_maxPacketSize) |
11337 | { | 11402 | { |
11338 | // over max number of bytes so split up file | 11403 | // over max number of bytes so split up file |
@@ -11578,5 +11643,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11578 | packet.PropertiesData.LanguagesText = Utils.StringToBytes(languages); | 11643 | packet.PropertiesData.LanguagesText = Utils.StringToBytes(languages); |
11579 | OutPacket(packet, ThrottleOutPacketType.Task); | 11644 | OutPacket(packet, ThrottleOutPacketType.Task); |
11580 | } | 11645 | } |
11646 | |||
11647 | public void SendChangeUserRights(UUID agentID, UUID friendID, int rights) | ||
11648 | { | ||
11649 | ChangeUserRightsPacket packet = (ChangeUserRightsPacket)PacketPool.Instance.GetPacket(PacketType.ChangeUserRights); | ||
11650 | |||
11651 | packet.AgentData = new ChangeUserRightsPacket.AgentDataBlock(); | ||
11652 | packet.AgentData.AgentID = agentID; | ||
11653 | |||
11654 | packet.Rights = new ChangeUserRightsPacket.RightsBlock[1]; | ||
11655 | packet.Rights[0] = new ChangeUserRightsPacket.RightsBlock(); | ||
11656 | packet.Rights[0].AgentRelated = friendID; | ||
11657 | packet.Rights[0].RelatedRights = rights; | ||
11658 | |||
11659 | OutPacket(packet, ThrottleOutPacketType.Task); | ||
11660 | } | ||
11661 | |||
11662 | public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) | ||
11663 | { | ||
11664 | ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); | ||
11665 | dialog.Data.ObjectID = objectId; | ||
11666 | dialog.Data.ChatChannel = chatChannel; | ||
11667 | dialog.Data.ImageID = UUID.Zero; | ||
11668 | dialog.Data.ObjectName = Util.StringToBytes256(objectname); | ||
11669 | // this is the username of the *owner* | ||
11670 | dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); | ||
11671 | dialog.Data.LastName = Util.StringToBytes256(ownerLastName); | ||
11672 | dialog.Data.Message = Util.StringToBytes256(message); | ||
11673 | |||
11674 | |||
11675 | ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1]; | ||
11676 | buttons[0] = new ScriptDialogPacket.ButtonsBlock(); | ||
11677 | buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); | ||
11678 | dialog.Buttons = buttons; | ||
11679 | OutPacket(dialog, ThrottleOutPacketType.Task); | ||
11680 | } | ||
11581 | } | 11681 | } |
11582 | } | 11682 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs index adf171e..10e5a95 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs | |||
@@ -197,7 +197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
197 | 197 | ||
198 | private void Initialise(UUID fileID, string fileName) | 198 | private void Initialise(UUID fileID, string fileName) |
199 | { | 199 | { |
200 | m_asset = new AssetBase(fileID, fileName, type); | 200 | m_asset = new AssetBase(fileID, fileName, type, UUID.Zero.ToString()); |
201 | m_asset.Data = new byte[0]; | 201 | m_asset.Data = new byte[0]; |
202 | m_asset.Description = "empty"; | 202 | m_asset.Description = "empty"; |
203 | m_asset.Local = true; | 203 | m_asset.Local = true; |
@@ -212,6 +212,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
212 | 212 | ||
213 | public void RequestStartXfer(IClientAPI pRemoteClient) | 213 | public void RequestStartXfer(IClientAPI pRemoteClient) |
214 | { | 214 | { |
215 | m_asset.Metadata.CreatorID = pRemoteClient.AgentId.ToString(); | ||
216 | |||
215 | if (!String.IsNullOrEmpty(m_asset.Name)) | 217 | if (!String.IsNullOrEmpty(m_asset.Name)) |
216 | { | 218 | { |
217 | pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); | 219 | pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 55d9c9c..6232c48 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |||
@@ -144,6 +144,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
144 | /// <summary>A reference to the LLUDPServer that is managing this client</summary> | 144 | /// <summary>A reference to the LLUDPServer that is managing this client</summary> |
145 | private readonly LLUDPServer m_udpServer; | 145 | private readonly LLUDPServer m_udpServer; |
146 | 146 | ||
147 | /// <summary>Caches packed throttle information</summary> | ||
148 | private byte[] m_packedThrottles; | ||
149 | |||
147 | private int m_defaultRTO = 3000; | 150 | private int m_defaultRTO = 3000; |
148 | private int m_maxRTO = 60000; | 151 | private int m_maxRTO = 60000; |
149 | 152 | ||
@@ -350,21 +353,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
350 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; | 353 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; |
351 | bucket.DripRate = texture; | 354 | bucket.DripRate = texture; |
352 | bucket.MaxBurst = texture; | 355 | bucket.MaxBurst = texture; |
356 | |||
357 | // Reset the packed throttles cached data | ||
358 | m_packedThrottles = null; | ||
353 | } | 359 | } |
354 | 360 | ||
355 | public byte[] GetThrottlesPacked() | 361 | public byte[] GetThrottlesPacked() |
356 | { | 362 | { |
357 | byte[] data = new byte[7 * 4]; | 363 | byte[] data = m_packedThrottles; |
358 | int i = 0; | 364 | |
359 | 365 | if (data == null) | |
360 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate), 0, data, i, 4); i += 4; | 366 | { |
361 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate), 0, data, i, 4); i += 4; | 367 | data = new byte[7 * 4]; |
362 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate), 0, data, i, 4); i += 4; | 368 | int i = 0; |
363 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate), 0, data, i, 4); i += 4; | 369 | |
364 | Buffer.BlockCopy(Utils.FloatToBytes((float)(m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate) + | 370 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate), 0, data, i, 4); i += 4; |
365 | m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate), 0, data, i, 4); i += 4; | 371 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate), 0, data, i, 4); i += 4; |
366 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate), 0, data, i, 4); i += 4; | 372 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate), 0, data, i, 4); i += 4; |
367 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate), 0, data, i, 4); i += 4; | 373 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate), 0, data, i, 4); i += 4; |
374 | Buffer.BlockCopy(Utils.FloatToBytes((float)(m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate) + | ||
375 | m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate), 0, data, i, 4); i += 4; | ||
376 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate), 0, data, i, 4); i += 4; | ||
377 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate), 0, data, i, 4); i += 4; | ||
378 | |||
379 | m_packedThrottles = data; | ||
380 | } | ||
368 | 381 | ||
369 | return data; | 382 | return data; |
370 | } | 383 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 3c4fa72..41e41e4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -513,6 +513,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
513 | byte flags = buffer.Data[0]; | 513 | byte flags = buffer.Data[0]; |
514 | bool isResend = (flags & Helpers.MSG_RESENT) != 0; | 514 | bool isResend = (flags & Helpers.MSG_RESENT) != 0; |
515 | bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; | 515 | bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; |
516 | bool isZerocoded = (flags & Helpers.MSG_ZEROCODED) != 0; | ||
516 | LLUDPClient udpClient = outgoingPacket.Client; | 517 | LLUDPClient udpClient = outgoingPacket.Client; |
517 | 518 | ||
518 | if (!udpClient.IsConnected) | 519 | if (!udpClient.IsConnected) |
@@ -522,23 +523,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
522 | 523 | ||
523 | int dataLength = buffer.DataLength; | 524 | int dataLength = buffer.DataLength; |
524 | 525 | ||
525 | // Keep appending ACKs until there is no room left in the buffer or there are | 526 | // NOTE: I'm seeing problems with some viewers when ACKs are appended to zerocoded packets so I've disabled that here |
526 | // no more ACKs to append | 527 | if (!isZerocoded) |
527 | uint ackCount = 0; | ||
528 | uint ack; | ||
529 | while (dataLength + 5 < buffer.Data.Length && udpClient.PendingAcks.Dequeue(out ack)) | ||
530 | { | 528 | { |
531 | Utils.UIntToBytesBig(ack, buffer.Data, dataLength); | 529 | // Keep appending ACKs until there is no room left in the buffer or there are |
532 | dataLength += 4; | 530 | // no more ACKs to append |
533 | ++ackCount; | 531 | uint ackCount = 0; |
534 | } | 532 | uint ack; |
533 | while (dataLength + 5 < buffer.Data.Length && udpClient.PendingAcks.Dequeue(out ack)) | ||
534 | { | ||
535 | Utils.UIntToBytesBig(ack, buffer.Data, dataLength); | ||
536 | dataLength += 4; | ||
537 | ++ackCount; | ||
538 | } | ||
535 | 539 | ||
536 | if (ackCount > 0) | 540 | if (ackCount > 0) |
537 | { | 541 | { |
538 | // Set the last byte of the packet equal to the number of appended ACKs | 542 | // Set the last byte of the packet equal to the number of appended ACKs |
539 | buffer.Data[dataLength++] = (byte)ackCount; | 543 | buffer.Data[dataLength++] = (byte)ackCount; |
540 | // Set the appended ACKs flag on this packet | 544 | // Set the appended ACKs flag on this packet |
541 | buffer.Data[0] = (byte)(buffer.Data[0] | Helpers.MSG_APPENDED_ACKS); | 545 | buffer.Data[0] = (byte)(buffer.Data[0] | Helpers.MSG_APPENDED_ACKS); |
546 | } | ||
542 | } | 547 | } |
543 | 548 | ||
544 | buffer.DataLength = dataLength; | 549 | buffer.DataLength = dataLength; |
@@ -596,15 +601,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
596 | } | 601 | } |
597 | catch (MalformedDataException) | 602 | catch (MalformedDataException) |
598 | { | 603 | { |
599 | m_log.ErrorFormat("[LLUDPSERVER]: Malformed data, cannot parse packet from {0}:\n{1}", | ||
600 | buffer.RemoteEndPoint, Utils.BytesToHexString(buffer.Data, buffer.DataLength, null)); | ||
601 | } | 604 | } |
602 | 605 | ||
603 | // Fail-safe check | 606 | // Fail-safe check |
604 | if (packet == null) | 607 | if (packet == null) |
605 | { | 608 | { |
606 | m_log.Warn("[LLUDPSERVER]: Couldn't build a message from incoming data " + buffer.DataLength + | 609 | m_log.ErrorFormat("[LLUDPSERVER]: Malformed data, cannot parse {0} byte packet from {1}:", |
607 | " bytes long from " + buffer.RemoteEndPoint); | 610 | buffer.DataLength, buffer.RemoteEndPoint); |
611 | m_log.Error(Utils.BytesToHexString(buffer.Data, buffer.DataLength, null)); | ||
608 | return; | 612 | return; |
609 | } | 613 | } |
610 | 614 | ||
@@ -919,7 +923,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
919 | // Remove this client from the scene | 923 | // Remove this client from the scene |
920 | IClientAPI client; | 924 | IClientAPI client; |
921 | if (m_scene.TryGetClient(udpClient.AgentID, out client)) | 925 | if (m_scene.TryGetClient(udpClient.AgentID, out client)) |
926 | { | ||
927 | client.IsLoggingOut = true; | ||
922 | client.Close(); | 928 | client.Close(); |
929 | } | ||
923 | } | 930 | } |
924 | 931 | ||
925 | private void IncomingPacketHandler() | 932 | private void IncomingPacketHandler() |
@@ -1018,7 +1025,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1018 | 1025 | ||
1019 | // Handle outgoing packets, resends, acknowledgements, and pings for each | 1026 | // Handle outgoing packets, resends, acknowledgements, and pings for each |
1020 | // client. m_packetSent will be set to true if a packet is sent | 1027 | // client. m_packetSent will be set to true if a packet is sent |
1021 | m_scene.ForEachClient(clientPacketHandler, false); | 1028 | m_scene.ForEachClient(clientPacketHandler); |
1022 | 1029 | ||
1023 | // If nothing was sent, sleep for the minimum amount of time before a | 1030 | // If nothing was sent, sleep for the minimum amount of time before a |
1024 | // token bucket could get more tokens | 1031 | // token bucket could get more tokens |