diff options
author | Mic Bowman | 2011-08-05 11:13:02 -0700 |
---|---|---|
committer | Mic Bowman | 2011-08-05 11:13:02 -0700 |
commit | c3f579046c4de7a5a65e71e4c02958425fd7998a (patch) | |
tree | b725d9eaa66d5eb7cf1f87ddbb4fa0f4284f71f5 /OpenSim/Region/ClientStack | |
parent | BulletSim: Parameters settable from ini file. Linksets. Physical property val... (diff) | |
parent | remove the largely unused copy/pasted HandleAgentRequestSit() method (diff) | |
download | opensim-SC_OLD-c3f579046c4de7a5a65e71e4c02958425fd7998a.zip opensim-SC_OLD-c3f579046c4de7a5a65e71e4c02958425fd7998a.tar.gz opensim-SC_OLD-c3f579046c4de7a5a65e71e4c02958425fd7998a.tar.bz2 opensim-SC_OLD-c3f579046c4de7a5a65e71e4c02958425fd7998a.tar.xz |
Merge branch 'master' into bulletsim
Diffstat (limited to 'OpenSim/Region/ClientStack')
5 files changed, 63 insertions, 55 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs index 14160ae..66b865f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs | |||
@@ -48,8 +48,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
49 | public class BunchOfCapsModule : INonSharedRegionModule | 49 | public class BunchOfCapsModule : INonSharedRegionModule |
50 | { | 50 | { |
51 | private static readonly ILog m_log = | 51 | // private static readonly ILog m_log = |
52 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | private Scene m_Scene; | 54 | private Scene m_Scene; |
55 | 55 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs index 29a9199..18c7eae 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs | |||
@@ -48,8 +48,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
49 | public class MeshUploadFlagModule : INonSharedRegionModule | 49 | public class MeshUploadFlagModule : INonSharedRegionModule |
50 | { | 50 | { |
51 | private static readonly ILog m_log = | 51 | // private static readonly ILog m_log = |
52 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// Is this module enabled? | 55 | /// Is this module enabled? |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a34ad62..4a36b5d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -231,7 +231,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
231 | public event ScriptReset OnScriptReset; | 231 | public event ScriptReset OnScriptReset; |
232 | public event GetScriptRunning OnGetScriptRunning; | 232 | public event GetScriptRunning OnGetScriptRunning; |
233 | public event SetScriptRunning OnSetScriptRunning; | 233 | public event SetScriptRunning OnSetScriptRunning; |
234 | public event UpdateVector OnAutoPilotGo; | 234 | public event Action<Vector3> OnAutoPilotGo; |
235 | public event TerrainUnacked OnUnackedTerrain; | 235 | public event TerrainUnacked OnUnackedTerrain; |
236 | public event ActivateGesture OnActivateGesture; | 236 | public event ActivateGesture OnActivateGesture; |
237 | public event DeactivateGesture OnDeactivateGesture; | 237 | public event DeactivateGesture OnDeactivateGesture; |
@@ -5266,6 +5266,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5266 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); | 5266 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); |
5267 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); | 5267 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); |
5268 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); | 5268 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); |
5269 | |||
5270 | AddGenericPacketHandler("autopilot", HandleAutopilot); | ||
5269 | } | 5271 | } |
5270 | 5272 | ||
5271 | #region Packet Handlers | 5273 | #region Packet Handlers |
@@ -5308,7 +5310,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5308 | ); | 5310 | ); |
5309 | } | 5311 | } |
5310 | else | 5312 | else |
5313 | { | ||
5311 | update = true; | 5314 | update = true; |
5315 | } | ||
5312 | 5316 | ||
5313 | // These should be ordered from most-likely to | 5317 | // These should be ordered from most-likely to |
5314 | // least likely to change. I've made an initial | 5318 | // least likely to change. I've made an initial |
@@ -5316,6 +5320,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5316 | 5320 | ||
5317 | if (update) | 5321 | if (update) |
5318 | { | 5322 | { |
5323 | // m_log.DebugFormat("[LLCLIENTVIEW]: Triggered AgentUpdate for {0}", sener.Name); | ||
5324 | |||
5319 | AgentUpdateArgs arg = new AgentUpdateArgs(); | 5325 | AgentUpdateArgs arg = new AgentUpdateArgs(); |
5320 | arg.AgentID = x.AgentID; | 5326 | arg.AgentID = x.AgentID; |
5321 | arg.BodyRotation = x.BodyRotation; | 5327 | arg.BodyRotation = x.BodyRotation; |
@@ -11609,55 +11615,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11609 | return false; | 11615 | return false; |
11610 | } | 11616 | } |
11611 | 11617 | ||
11612 | /// <summary> | 11618 | protected void HandleAutopilot(Object sender, string method, List<String> args) |
11613 | /// Breaks down the genericMessagePacket into specific events | ||
11614 | /// </summary> | ||
11615 | /// <param name="gmMethod"></param> | ||
11616 | /// <param name="gmInvoice"></param> | ||
11617 | /// <param name="gmParams"></param> | ||
11618 | public void DecipherGenericMessage(string gmMethod, UUID gmInvoice, GenericMessagePacket.ParamListBlock[] gmParams) | ||
11619 | { | 11619 | { |
11620 | switch (gmMethod) | 11620 | float locx = 0; |
11621 | { | 11621 | float locy = 0; |
11622 | case "autopilot": | 11622 | float locz = 0; |
11623 | float locx; | 11623 | uint regionX = 0; |
11624 | float locy; | 11624 | uint regionY = 0; |
11625 | float locz; | ||
11626 | |||
11627 | try | ||
11628 | { | ||
11629 | uint regionX; | ||
11630 | uint regionY; | ||
11631 | Utils.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY); | ||
11632 | locx = Convert.ToSingle(Utils.BytesToString(gmParams[0].Parameter)) - regionX; | ||
11633 | locy = Convert.ToSingle(Utils.BytesToString(gmParams[1].Parameter)) - regionY; | ||
11634 | locz = Convert.ToSingle(Utils.BytesToString(gmParams[2].Parameter)); | ||
11635 | } | ||
11636 | catch (InvalidCastException) | ||
11637 | { | ||
11638 | m_log.Error("[CLIENT]: Invalid autopilot request"); | ||
11639 | return; | ||
11640 | } | ||
11641 | |||
11642 | UpdateVector handlerAutoPilotGo = OnAutoPilotGo; | ||
11643 | if (handlerAutoPilotGo != null) | ||
11644 | { | ||
11645 | handlerAutoPilotGo(0, new Vector3(locx, locy, locz), this); | ||
11646 | } | ||
11647 | m_log.InfoFormat("[CLIENT]: Client Requests autopilot to position <{0},{1},{2}>", locx, locy, locz); | ||
11648 | 11625 | ||
11626 | Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out regionX, out regionY); | ||
11627 | locx = Convert.ToSingle(args[0]) - (float)regionX; | ||
11628 | locy = Convert.ToSingle(args[1]) - (float)regionY; | ||
11629 | locz = Convert.ToSingle(args[2]); | ||
11649 | 11630 | ||
11650 | break; | 11631 | Action<Vector3> handlerAutoPilotGo = OnAutoPilotGo; |
11651 | default: | 11632 | if (handlerAutoPilotGo != null) |
11652 | m_log.Debug("[CLIENT]: Unknown Generic Message, Method: " + gmMethod + ". Invoice: " + gmInvoice + ". Dumping Params:"); | 11633 | handlerAutoPilotGo(new Vector3(locx, locy, locz)); |
11653 | for (int hi = 0; hi < gmParams.Length; hi++) | ||
11654 | { | ||
11655 | Console.WriteLine(gmParams[hi].ToString()); | ||
11656 | } | ||
11657 | //gmpack.MethodData. | ||
11658 | break; | ||
11659 | |||
11660 | } | ||
11661 | } | 11634 | } |
11662 | 11635 | ||
11663 | /// <summary> | 11636 | /// <summary> |
@@ -12083,7 +12056,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12083 | OutPacket(packet, ThrottleOutPacketType.Task); | 12056 | OutPacket(packet, ThrottleOutPacketType.Task); |
12084 | } | 12057 | } |
12085 | 12058 | ||
12086 | public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) | 12059 | public void SendTextBoxRequest(string message, int chatChannel, string objectname, UUID ownerID, string ownerFirstName, string ownerLastName, UUID objectId) |
12087 | { | 12060 | { |
12088 | ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); | 12061 | ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); |
12089 | dialog.Data.ObjectID = objectId; | 12062 | dialog.Data.ObjectID = objectId; |
@@ -12099,6 +12072,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12099 | buttons[0] = new ScriptDialogPacket.ButtonsBlock(); | 12072 | buttons[0] = new ScriptDialogPacket.ButtonsBlock(); |
12100 | buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); | 12073 | buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); |
12101 | dialog.Buttons = buttons; | 12074 | dialog.Buttons = buttons; |
12075 | |||
12076 | dialog.OwnerData = new ScriptDialogPacket.OwnerDataBlock[1]; | ||
12077 | dialog.OwnerData[0] = new ScriptDialogPacket.OwnerDataBlock(); | ||
12078 | dialog.OwnerData[0].OwnerID = ownerID; | ||
12079 | |||
12102 | OutPacket(dialog, ThrottleOutPacketType.Task); | 12080 | OutPacket(dialog, ThrottleOutPacketType.Task); |
12103 | } | 12081 | } |
12104 | 12082 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index aff90c5..f2388cd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -160,6 +160,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
160 | 160 | ||
161 | public Socket Server { get { return null; } } | 161 | public Socket Server { get { return null; } } |
162 | 162 | ||
163 | private int m_malformedCount = 0; // Guard against a spamming attack | ||
164 | |||
163 | public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) | 165 | public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) |
164 | : base(listenIP, (int)port) | 166 | : base(listenIP, (int)port) |
165 | { | 167 | { |
@@ -612,6 +614,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
612 | 614 | ||
613 | #region Decoding | 615 | #region Decoding |
614 | 616 | ||
617 | if (buffer.DataLength < 7) | ||
618 | return; // Drop undersizd packet | ||
619 | |||
620 | int headerLen = 7; | ||
621 | if (buffer.Data[6] == 0xFF) | ||
622 | { | ||
623 | if (buffer.Data[7] == 0xFF) | ||
624 | headerLen = 10; | ||
625 | else | ||
626 | headerLen = 8; | ||
627 | } | ||
628 | |||
629 | if (buffer.DataLength < headerLen) | ||
630 | return; // Malformed header | ||
631 | |||
615 | try | 632 | try |
616 | { | 633 | { |
617 | packet = Packet.BuildPacket(buffer.Data, ref packetEnd, | 634 | packet = Packet.BuildPacket(buffer.Data, ref packetEnd, |
@@ -621,6 +638,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
621 | catch (MalformedDataException) | 638 | catch (MalformedDataException) |
622 | { | 639 | { |
623 | } | 640 | } |
641 | catch (IndexOutOfRangeException) | ||
642 | { | ||
643 | return; // Drop short packet | ||
644 | } | ||
645 | catch(Exception e) | ||
646 | { | ||
647 | if (m_malformedCount < 100) | ||
648 | m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); | ||
649 | m_malformedCount++; | ||
650 | if ((m_malformedCount % 100000) == 0) | ||
651 | m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount); | ||
652 | } | ||
624 | 653 | ||
625 | // Fail-safe check | 654 | // Fail-safe check |
626 | if (packet == null) | 655 | if (packet == null) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 29fd1a4..4c33db5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | private static Int32 m_counter = 0; | 45 | private static Int32 m_counter = 0; |
46 | 46 | ||
47 | private Int32 m_identifier; | 47 | // private Int32 m_identifier; |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Number of ticks (ms) per quantum, drip rate and max burst | 50 | /// Number of ticks (ms) per quantum, drip rate and max burst |
@@ -173,7 +173,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
173 | /// second. If zero, the bucket always remains full</param> | 173 | /// second. If zero, the bucket always remains full</param> |
174 | public TokenBucket(TokenBucket parent, Int64 dripRate) | 174 | public TokenBucket(TokenBucket parent, Int64 dripRate) |
175 | { | 175 | { |
176 | m_identifier = m_counter++; | 176 | // m_identifier = m_counter++; |
177 | m_counter++; | ||
177 | 178 | ||
178 | Parent = parent; | 179 | Parent = parent; |
179 | RequestedDripRate = dripRate; | 180 | RequestedDripRate = dripRate; |
@@ -320,7 +321,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
320 | 321 | ||
321 | public class AdaptiveTokenBucket : TokenBucket | 322 | public class AdaptiveTokenBucket : TokenBucket |
322 | { | 323 | { |
323 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 324 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
324 | 325 | ||
325 | /// <summary> | 326 | /// <summary> |
326 | /// The minimum rate for flow control. Minimum drip rate is one | 327 | /// The minimum rate for flow control. Minimum drip rate is one |