aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2013-08-09 08:31:30 -0700
committerDiva Canto2013-08-09 08:31:30 -0700
commit2cdcf62b48fde64d1ad11a4db46afeddff1a0770 (patch)
tree76d2f53def5e6cd05b9b9e5f3e3e1e759c29e87e /OpenSim
parentGo easy on enforcing session ids in position updates (diff)
parentBulletSim: adjust avatar position when the avatar's size is changed. (diff)
downloadopensim-SC_OLD-2cdcf62b48fde64d1ad11a4db46afeddff1a0770.zip
opensim-SC_OLD-2cdcf62b48fde64d1ad11a4db46afeddff1a0770.tar.gz
opensim-SC_OLD-2cdcf62b48fde64d1ad11a4db46afeddff1a0770.tar.bz2
opensim-SC_OLD-2cdcf62b48fde64d1ad11a4db46afeddff1a0770.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs6
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs37
-rw-r--r--OpenSim/Framework/Tests/LocationTest.cs7
-rw-r--r--OpenSim/Framework/Tests/UtilTest.cs82
-rw-r--r--OpenSim/Framework/Util.cs4
-rw-r--r--OpenSim/Region/Application/OpenSim.cs47
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs33
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs31
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs12
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs4
15 files changed, 293 insertions, 81 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 1c5f558..18d008c 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -287,6 +287,12 @@ namespace OpenSim.Framework
287 public Vector3 AtAxis; 287 public Vector3 AtAxis;
288 public Vector3 LeftAxis; 288 public Vector3 LeftAxis;
289 public Vector3 UpAxis; 289 public Vector3 UpAxis;
290
291 /// <summary>
292 /// Signal on a V2 teleport that Scene.IncomingChildAgentDataUpdate(AgentData ad) should wait for the
293 /// scene presence to become root (triggered when the viewer sends a CompleteAgentMovement UDP packet after
294 /// establishing the connection triggered by it's receipt of a TeleportFinish EQ message).
295 /// </summary>
290 public bool SenderWantsToWaitForRoot; 296 public bool SenderWantsToWaitForRoot;
291 297
292 public float Far; 298 public float Far;
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index c8e838c..7cf1fa7 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -26,10 +26,12 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Linq; 31using System.Linq;
31using System.Text; 32using System.Text;
32 33
34using OpenSim.Framework;
33using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
34 36
35namespace OpenSim.Framework.Monitoring 37namespace OpenSim.Framework.Monitoring
@@ -262,6 +264,41 @@ namespace OpenSim.Framework.Monitoring
262 return map; 264 return map;
263 } 265 }
264 266
267 public static Hashtable HandleStatsRequest(Hashtable request)
268 {
269 Hashtable responsedata = new Hashtable();
270 string regpath = request["uri"].ToString();
271 int response_code = 200;
272 string contenttype = "text/json";
273
274 string pCategoryName = StatsManager.AllSubCommand;
275 string pContainerName = StatsManager.AllSubCommand;
276 string pStatName = StatsManager.AllSubCommand;
277
278 if (request.ContainsKey("cat")) pCategoryName = request["cat"].ToString();
279 if (request.ContainsKey("cont")) pContainerName = request["cat"].ToString();
280 if (request.ContainsKey("stat")) pStatName = request["cat"].ToString();
281
282 string strOut = StatsManager.GetStatsAsOSDMap(pCategoryName, pContainerName, pStatName).ToString();
283
284 // If requestor wants it as a callback function, build response as a function rather than just the JSON string.
285 if (request.ContainsKey("callback"))
286 {
287 strOut = request["callback"].ToString() + "(" + strOut + ");";
288 }
289
290 // m_log.DebugFormat("{0} StatFetch: uri={1}, cat={2}, cont={3}, stat={4}, resp={5}",
291 // LogHeader, regpath, pCategoryName, pContainerName, pStatName, strOut);
292
293 responsedata["int_response_code"] = response_code;
294 responsedata["content_type"] = contenttype;
295 responsedata["keepalive"] = false;
296 responsedata["str_response_string"] = strOut;
297 responsedata["access_control_allow_origin"] = "*";
298
299 return responsedata;
300 }
301
265// /// <summary> 302// /// <summary>
266// /// Start collecting statistics related to assets. 303// /// Start collecting statistics related to assets.
267// /// Should only be called once. 304// /// Should only be called once.
diff --git a/OpenSim/Framework/Tests/LocationTest.cs b/OpenSim/Framework/Tests/LocationTest.cs
index af5f164..3d5d1d2 100644
--- a/OpenSim/Framework/Tests/LocationTest.cs
+++ b/OpenSim/Framework/Tests/LocationTest.cs
@@ -55,11 +55,18 @@ namespace OpenSim.Framework.Tests
55 Location TestLocation2 = new Location(1095216660736000); 55 Location TestLocation2 = new Location(1095216660736000);
56 Assert.That(TestLocation1 == TestLocation2); 56 Assert.That(TestLocation1 == TestLocation2);
57 57
58 Assert.That(TestLocation1.X == 255000 && TestLocation1.Y == 256000, "Test xy location doesn't match position in the constructor");
58 Assert.That(TestLocation2.X == 255000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided"); 59 Assert.That(TestLocation2.X == 255000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided");
59 60
60 Assert.That(TestLocation2.RegionHandle == 1095216660736000, 61 Assert.That(TestLocation2.RegionHandle == 1095216660736000,
61 "Location RegionHandle Property didn't match regionhandle provided in constructor"); 62 "Location RegionHandle Property didn't match regionhandle provided in constructor");
62 63
64 ulong RegionHandle = TestLocation1.RegionHandle;
65 Assert.That(RegionHandle.Equals(1095216660736000), "Equals(regionhandle) failed to match the position in the constructor");
66
67 TestLocation2 = new Location(RegionHandle);
68 Assert.That(TestLocation2.Equals(255000, 256000), "Decoded regionhandle failed to match the original position in the constructor");
69
63 70
64 TestLocation1 = new Location(255001, 256001); 71 TestLocation1 = new Location(255001, 256001);
65 TestLocation2 = new Location(1095216660736000); 72 TestLocation2 = new Location(1095216660736000);
diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs
index 11ca068..3b7f252 100644
--- a/OpenSim/Framework/Tests/UtilTest.cs
+++ b/OpenSim/Framework/Tests/UtilTest.cs
@@ -282,5 +282,87 @@ namespace OpenSim.Framework.Tests
282 String.Format("Incorrect InventoryType mapped from Content-Type {0}", invcontenttypes[i])); 282 String.Format("Incorrect InventoryType mapped from Content-Type {0}", invcontenttypes[i]));
283 } 283 }
284 } 284 }
285
286 [Test]
287 public void FakeParcelIDTests()
288 {
289 byte[] hexBytes8 = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 };
290 byte[] hexBytes16 = {
291 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
292 0x77, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f };
293 UInt64 var64Bit = (UInt64)0xfedcba9876543210;
294
295 //Region handle is for location 255000,256000.
296 ulong regionHandle1 = 1095216660736000;
297 uint x1 = 100;
298 uint y1 = 200;
299 uint z1 = 22;
300 ulong regionHandle2;
301 uint x2, y2, z2;
302 UUID fakeParcelID1, fakeParcelID2, uuid;
303
304 ulong bigInt64 = Util.BytesToUInt64Big(hexBytes8);
305 Assert.AreEqual(var64Bit, bigInt64,
306 "BytesToUint64Bit conversion of 8 bytes to UInt64 failed.");
307
308 //Test building and decoding using some typical input values
309 fakeParcelID1 = Util.BuildFakeParcelID(regionHandle1, x1, y1);
310 Util.ParseFakeParcelID(fakeParcelID1, out regionHandle2, out x2, out y2);
311 Assert.AreEqual(regionHandle1, regionHandle2,
312 "region handle decoded from FakeParcelID wth X/Y failed.");
313 Assert.AreEqual(x1, x2,
314 "X coordinate decoded from FakeParcelID wth X/Y failed.");
315 Assert.AreEqual(y1, y2,
316 "Y coordinate decoded from FakeParcelID wth X/Y failed.");
317
318 fakeParcelID1 = Util.BuildFakeParcelID(regionHandle1, x1, y1, z1);
319 Util.ParseFakeParcelID(fakeParcelID1, out regionHandle2, out x2, out y2, out z2);
320 Assert.AreEqual(regionHandle1, regionHandle2,
321 "region handle decoded from FakeParcelID with X/Y/Z failed.");
322 Assert.AreEqual(x1, x2,
323 "X coordinate decoded from FakeParcelID with X/Y/Z failed.");
324 Assert.AreEqual(y1, y2,
325 "Y coordinate decoded from FakeParcelID with X/Y/Z failed.");
326 Assert.AreEqual(z1, z2,
327 "Z coordinate decoded from FakeParcelID with X/Y/Z failed.");
328
329 //Do some more extreme tests to check the encoding and decoding
330 x1 = 0x55aa;
331 y1 = 0x9966;
332 z1 = 0x5a96;
333
334 fakeParcelID1 = Util.BuildFakeParcelID(var64Bit, x1, y1);
335 Util.ParseFakeParcelID(fakeParcelID1, out regionHandle2, out x2, out y2);
336 Assert.AreEqual(var64Bit, regionHandle2,
337 "region handle decoded from FakeParcelID with X/Y/Z failed.");
338 Assert.AreEqual(x1, x2,
339 "X coordinate decoded from FakeParcelID with X/Y/Z failed.");
340 Assert.AreEqual(y1, y2,
341 "Y coordinate decoded from FakeParcelID with X/Y/Z failed.");
342
343 fakeParcelID1 = Util.BuildFakeParcelID(var64Bit, x1, y1, z1);
344 Util.ParseFakeParcelID(fakeParcelID1, out regionHandle2, out x2, out y2, out z2);
345 Assert.AreEqual(var64Bit, regionHandle2,
346 "region handle decoded from FakeParcelID with X/Y/Z failed.");
347 Assert.AreEqual(x1, x2,
348 "X coordinate decoded from FakeParcelID with X/Y/Z failed.");
349 Assert.AreEqual(y1, y2,
350 "Y coordinate decoded from FakeParcelID with X/Y/Z failed.");
351 Assert.AreEqual(z1, z2,
352 "Z coordinate decoded from FakeParcelID with X/Y/Z failed.");
353
354
355 x1 = 64;
356 y1 = 192;
357 fakeParcelID1 = Util.BuildFakeParcelID(regionHandle1, x1, y1);
358 Util.FakeParcelIDToGlobalPosition(fakeParcelID1, out x2, out y2);
359 Assert.AreEqual(255000+x1, x2,
360 "Global X coordinate decoded from regionHandle failed.");
361 Assert.AreEqual(256000+y1, y2,
362 "Global Y coordinate decoded from regionHandle failed.");
363
364 uuid = new UUID("00dd0700-00d1-0700-3800-000032000000");
365 Util.FakeParcelIDToGlobalPosition(uuid, out x2, out y2);
366 }
285 } 367 }
286} 368}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 6a15734..f0e5bc1 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1247,7 +1247,7 @@ namespace OpenSim.Framework
1247 byte[] bytes = 1247 byte[] bytes =
1248 { 1248 {
1249 (byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24), 1249 (byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24),
1250 (byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle << 56), 1250 (byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle >> 56),
1251 (byte)x, (byte)(x >> 8), 0, 0, 1251 (byte)x, (byte)(x >> 8), 0, 0,
1252 (byte)y, (byte)(y >> 8), 0, 0 }; 1252 (byte)y, (byte)(y >> 8), 0, 0 };
1253 return new UUID(bytes, 0); 1253 return new UUID(bytes, 0);
@@ -1258,7 +1258,7 @@ namespace OpenSim.Framework
1258 byte[] bytes = 1258 byte[] bytes =
1259 { 1259 {
1260 (byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24), 1260 (byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24),
1261 (byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle << 56), 1261 (byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle >> 56),
1262 (byte)x, (byte)(x >> 8), (byte)z, (byte)(z >> 8), 1262 (byte)x, (byte)(x >> 8), (byte)z, (byte)(z >> 8),
1263 (byte)y, (byte)(y >> 8), 0, 0 }; 1263 (byte)y, (byte)(y >> 8), 0, 0 };
1264 return new UUID(bytes, 0); 1264 return new UUID(bytes, 0);
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 9dcc8da..1cdd868 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -172,6 +172,13 @@ namespace OpenSim
172 if (userStatsURI != String.Empty) 172 if (userStatsURI != String.Empty)
173 MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this)); 173 MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this));
174 174
175 if (managedStatsURI != String.Empty)
176 {
177 string urlBase = String.Format("/{0}/", managedStatsURI);
178 MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest);
179 m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase);
180 }
181
175 if (m_console is RemoteConsole) 182 if (m_console is RemoteConsole)
176 { 183 {
177 if (m_consolePort == 0) 184 if (m_consolePort == 0)
@@ -348,18 +355,6 @@ namespace OpenSim
348 m_console.Commands.AddCommand("Regions", false, "delete-region", 355 m_console.Commands.AddCommand("Regions", false, "delete-region",
349 "delete-region <name>", 356 "delete-region <name>",
350 "Delete a region from disk", RunCommand); 357 "Delete a region from disk", RunCommand);
351
352 m_console.Commands.AddCommand("General", false, "modules list",
353 "modules list",
354 "List modules", HandleModules);
355
356 m_console.Commands.AddCommand("General", false, "modules load",
357 "modules load <name>",
358 "Load a module", HandleModules);
359
360 m_console.Commands.AddCommand("General", false, "modules unload",
361 "modules unload <name>",
362 "Unload a module", HandleModules);
363 } 358 }
364 359
365 protected override void ShutdownSpecific() 360 protected override void ShutdownSpecific()
@@ -557,34 +552,6 @@ namespace OpenSim
557 } 552 }
558 553
559 /// <summary> 554 /// <summary>
560 /// Load, Unload, and list Region modules in use
561 /// </summary>
562 /// <param name="module"></param>
563 /// <param name="cmd"></param>
564 private void HandleModules(string module, string[] cmd)
565 {
566 List<string> args = new List<string>(cmd);
567 args.RemoveAt(0);
568 string[] cmdparams = args.ToArray();
569
570 if (cmdparams.Length > 0)
571 {
572 switch (cmdparams[0].ToLower())
573 {
574 case "list":
575 //TODO: Convert to new region modules
576 break;
577 case "unload":
578 //TODO: Convert to new region modules
579 break;
580 case "load":
581 //TODO: Convert to new region modules
582 break;
583 }
584 }
585 }
586
587 /// <summary>
588 /// Runs commands issued by the server console from the operator 555 /// Runs commands issued by the server console from the operator
589 /// </summary> 556 /// </summary>
590 /// <param name="command">The first argument of the parameter (the command)</param> 557 /// <param name="command">The first argument of the parameter (the command)</param>
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index f0c088a..b032e7f 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -75,6 +75,7 @@ namespace OpenSim
75 protected int proxyOffset = 0; 75 protected int proxyOffset = 0;
76 76
77 public string userStatsURI = String.Empty; 77 public string userStatsURI = String.Empty;
78 public string managedStatsURI = String.Empty;
78 79
79 protected bool m_autoCreateClientStack = true; 80 protected bool m_autoCreateClientStack = true;
80 81
@@ -188,6 +189,7 @@ namespace OpenSim
188 CreatePIDFile(pidFile); 189 CreatePIDFile(pidFile);
189 190
190 userStatsURI = startupConfig.GetString("Stats_URI", String.Empty); 191 userStatsURI = startupConfig.GetString("Stats_URI", String.Empty);
192 managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
191 } 193 }
192 194
193 // Load the simulation data service 195 // Load the simulation data service
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 8b2440a..0dbce2f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
327 private PriorityQueue m_entityProps; 327 private PriorityQueue m_entityProps;
328 private Prioritizer m_prioritizer; 328 private Prioritizer m_prioritizer;
329 private bool m_disableFacelights = false; 329 private bool m_disableFacelights = false;
330 330 private volatile bool m_justEditedTerrain = false;
331 /// <value> 331 /// <value>
332 /// List used in construction of data blocks for an object update packet. This is to stop us having to 332 /// List used in construction of data blocks for an object update packet. This is to stop us having to
333 /// continually recreate it. 333 /// continually recreate it.
@@ -1239,9 +1239,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1239 LLHeightFieldMoronize(map); 1239 LLHeightFieldMoronize(map);
1240 1240
1241 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); 1241 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1242 layerpack.Header.Reliable = true; 1242
1243 // When a user edits the terrain, so much data is sent, the data queues up fast and presents a sub optimal editing experience.
1244 // To alleviate this issue, when the user edits the terrain, we start skipping the queues until they're done editing the terrain.
1245 // We also make them unreliable because it's extremely likely that multiple packets will be sent for a terrain patch area
1246 // invalidating previous packets for that area.
1243 1247
1244 OutPacket(layerpack, ThrottleOutPacketType.Land); 1248 // It's possible for an editing user to flood themselves with edited packets but the majority of use cases are such that only a
1249 // tiny percentage of users will be editing the terrain. Other, non-editing users will see the edits much slower.
1250
1251 // One last note on this topic, by the time users are going to be editing the terrain, it's extremely likely that the sim will
1252 // have rezzed already and therefore this is not likely going to cause any additional issues with lost packets, objects or terrain
1253 // patches.
1254
1255 // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we only have one cache miss.
1256 if (m_justEditedTerrain)
1257 {
1258 layerpack.Header.Reliable = false;
1259 OutPacket(layerpack,
1260 ThrottleOutPacketType.Unknown );
1261 }
1262 else
1263 {
1264 layerpack.Header.Reliable = true;
1265 OutPacket(layerpack,
1266 ThrottleOutPacketType.Land);
1267 }
1245 } 1268 }
1246 catch (Exception e) 1269 catch (Exception e)
1247 { 1270 {
@@ -6263,6 +6286,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6263 //m_log.Info("[LAND]: LAND:" + modify.ToString()); 6286 //m_log.Info("[LAND]: LAND:" + modify.ToString());
6264 if (modify.ParcelData.Length > 0) 6287 if (modify.ParcelData.Length > 0)
6265 { 6288 {
6289 // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore,
6290 // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit.
6291 m_justEditedTerrain = true; // Prevent terrain packet (Land layer) from being queued, make it unreliable
6266 if (OnModifyTerrain != null) 6292 if (OnModifyTerrain != null)
6267 { 6293 {
6268 for (int i = 0; i < modify.ParcelData.Length; i++) 6294 for (int i = 0; i < modify.ParcelData.Length; i++)
@@ -6278,6 +6304,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6278 } 6304 }
6279 } 6305 }
6280 } 6306 }
6307 m_justEditedTerrain = false; // Queue terrain packet (Land layer) if necessary, make it reliable again
6281 } 6308 }
6282 6309
6283 return true; 6310 return true;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 96cd6b9..01ef710 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -688,8 +688,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
688 if (version.Equals("SIMULATION/0.2")) 688 if (version.Equals("SIMULATION/0.2"))
689 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); 689 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
690 else 690 else
691 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); 691 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
692
693 } 692 }
694 693
695 private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, 694 private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination,
@@ -698,7 +697,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
698 ulong destinationHandle = finalDestination.RegionHandle; 697 ulong destinationHandle = finalDestination.RegionHandle;
699 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 698 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
700 699
701 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Using TP V1"); 700 m_log.DebugFormat(
701 "[ENTITY TRANSFER MODULE]: Using TP V1 for {0} going from {1} to {2}",
702 sp.Name, Scene.Name, finalDestination.RegionName);
703
702 // Let's create an agent there if one doesn't exist yet. 704 // Let's create an agent there if one doesn't exist yet.
703 // NOTE: logout will always be false for a non-HG teleport. 705 // NOTE: logout will always be false for a non-HG teleport.
704 bool logout = false; 706 bool logout = false;
@@ -956,6 +958,27 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
956 return; 958 return;
957 } 959 }
958 960
961 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
962 {
963 m_interRegionTeleportCancels.Value++;
964
965 m_log.DebugFormat(
966 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request",
967 sp.Name, finalDestination.RegionName, sp.Scene.Name);
968
969 return;
970 }
971 else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
972 {
973 m_interRegionTeleportAborts.Value++;
974
975 m_log.DebugFormat(
976 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.",
977 sp.Name, finalDestination.RegionName, sp.Scene.Name);
978
979 return;
980 }
981
959 // Past this point we have to attempt clean up if the teleport fails, so update transfer state. 982 // Past this point we have to attempt clean up if the teleport fails, so update transfer state.
960 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); 983 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
961 984
@@ -1058,20 +1081,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1058 if (!sp.DoNotCloseAfterTeleport) 1081 if (!sp.DoNotCloseAfterTeleport)
1059 { 1082 {
1060 // OK, it got this agent. Let's close everything 1083 // OK, it got this agent. Let's close everything
1061 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Closing in agent {0} in region {1}", sp.Name, Scene.RegionInfo.RegionName); 1084 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Closing in agent {0} in region {1}", sp.Name, Scene.Name);
1062 sp.CloseChildAgents(newRegionX, newRegionY); 1085 sp.CloseChildAgents(newRegionX, newRegionY);
1063 sp.Scene.IncomingCloseAgent(sp.UUID, false); 1086 sp.Scene.IncomingCloseAgent(sp.UUID, false);
1064 1087
1065 } 1088 }
1066 else 1089 else
1067 { 1090 {
1068 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Not closing agent {0}, user is back in {0}", sp.Name, Scene.RegionInfo.RegionName); 1091 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Not closing agent {0}, user is back in {0}", sp.Name, Scene.Name);
1069 sp.DoNotCloseAfterTeleport = false; 1092 sp.DoNotCloseAfterTeleport = false;
1070 } 1093 }
1071 } 1094 }
1072 else 1095 else
1096 {
1073 // now we have a child agent in this region. 1097 // now we have a child agent in this region.
1074 sp.Reset(); 1098 sp.Reset();
1099 }
1075 } 1100 }
1076 1101
1077 /// <summary> 1102 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
index a515346..6da2222 100644
--- a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
@@ -45,6 +45,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 private static string LogHeader = "[MODULE COMMS]";
48 49
49 private Dictionary<string,object> m_constants = new Dictionary<string,object>(); 50 private Dictionary<string,object> m_constants = new Dictionary<string,object>();
50 51
@@ -148,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
148 MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth, true); 149 MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth, true);
149 if (mi == null) 150 if (mi == null)
150 { 151 {
151 m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", meth); 152 m_log.WarnFormat("{0} Failed to register method {1}", LogHeader, meth);
152 return; 153 return;
153 } 154 }
154 155
@@ -165,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
165 { 166 {
166// m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, (target is Type) ? ((Type)target).Name : target.GetType().Name); 167// m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, (target is Type) ? ((Type)target).Name : target.GetType().Name);
167 168
168 Type delegateType; 169 Type delegateType = typeof(void);
169 List<Type> typeArgs = mi.GetParameters() 170 List<Type> typeArgs = mi.GetParameters()
170 .Select(p => p.ParameterType) 171 .Select(p => p.ParameterType)
171 .ToList(); 172 .ToList();
@@ -176,8 +177,16 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
176 } 177 }
177 else 178 else
178 { 179 {
179 typeArgs.Add(mi.ReturnType); 180 try
180 delegateType = Expression.GetFuncType(typeArgs.ToArray()); 181 {
182 typeArgs.Add(mi.ReturnType);
183 delegateType = Expression.GetFuncType(typeArgs.ToArray());
184 }
185 catch (Exception e)
186 {
187 m_log.ErrorFormat("{0} Failed to create function signature. Most likely more than 5 parameters. Method={1}. Error={2}",
188 LogHeader, mi.Name, e);
189 }
181 } 190 }
182 191
183 Delegate fcall; 192 Delegate fcall;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
index 4d49794..173b603 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -76,6 +76,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
76 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3, all corners = -1.", 76 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3, all corners = -1.",
77 consoleSetTerrainHeights); 77 consoleSetTerrainHeights);
78 78
79 m_module.Scene.AddCommand("Regions", m_module, "set water height",
80 "set water height <height> [<x>] [<y>]",
81 "Sets the water height in meters. If <x> and <y> are specified, it will only set it on regions with a matching coordinate. " +
82 "Specify -1 in <x> or <y> to wildcard that coordinate.",
83 consoleSetWaterHeight);
84
85
79 m_module.Scene.AddCommand( 86 m_module.Scene.AddCommand(
80 "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand); 87 "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand);
81 } 88 }
@@ -121,7 +128,29 @@ namespace OpenSim.Region.CoreModules.World.Estate
121 } 128 }
122 } 129 }
123 } 130 }
124 131 protected void consoleSetWaterHeight(string module, string[] args)
132 {
133 string heightstring = args[3];
134
135 int x = (args.Length > 4 ? int.Parse(args[4]) : -1);
136 int y = (args.Length > 5 ? int.Parse(args[5]) : -1);
137
138 if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x)
139 {
140 if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y)
141 {
142 double selectedheight = double.Parse(heightstring);
143
144 m_log.Debug("[ESTATEMODULE]: Setting water height in " + m_module.Scene.RegionInfo.RegionName + " to " +
145 string.Format(" {0}", selectedheight));
146 m_module.Scene.RegionInfo.RegionSettings.WaterHeight = selectedheight;
147
148 m_module.Scene.RegionInfo.RegionSettings.Save();
149 m_module.TriggerRegionInfoChange();
150 m_module.sendRegionHandshakeToAll();
151 }
152 }
153 }
125 protected void consoleSetTerrainHeights(string module, string[] args) 154 protected void consoleSetTerrainHeights(string module, string[] args)
126 { 155 {
127 string num = args[3]; 156 string num = args[3];
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1633e07..b97a0f6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4222,36 +4222,42 @@ namespace OpenSim.Region.Framework.Scenes
4222 } 4222 }
4223 4223
4224 // We have to wait until the viewer contacts this region 4224 // We have to wait until the viewer contacts this region
4225 // after receiving the EnableSimulator HTTP Event Queue message. This triggers the viewer to send 4225 // after receiving the EnableSimulator HTTP Event Queue message (for the v1 teleport protocol)
4226 // or TeleportFinish (for the v2 teleport protocol). This triggers the viewer to send
4226 // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence. 4227 // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence.
4227 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); 4228 ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID);
4228 4229
4229 if (childAgentUpdate != null) 4230 if (sp != null)
4230 { 4231 {
4231 if (cAgentData.SessionID != childAgentUpdate.ControllingClient.SessionId) 4232 if (cAgentData.SessionID != sp.ControllingClient.SessionId)
4232 { 4233 {
4233 m_log.WarnFormat("[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).", childAgentUpdate.UUID, cAgentData.SessionID); 4234 m_log.WarnFormat(
4235 "[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).",
4236 sp.UUID, cAgentData.SessionID);
4237
4234 Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}", 4238 Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}",
4235 childAgentUpdate.UUID, childAgentUpdate.ControllingClient.SessionId, cAgentData.SessionID)); 4239 sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID));
4236 } 4240 }
4237 4241
4238 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 4242 sp.ChildAgentDataUpdate(cAgentData);
4239 4243
4240 int ntimes = 20; 4244 int ntimes = 20;
4241 if (cAgentData.SenderWantsToWaitForRoot) 4245 if (cAgentData.SenderWantsToWaitForRoot)
4242 { 4246 {
4243 while (childAgentUpdate.IsChildAgent && ntimes-- > 0) 4247 while (sp.IsChildAgent && ntimes-- > 0)
4244 Thread.Sleep(1000); 4248 Thread.Sleep(1000);
4245 4249
4246 m_log.DebugFormat( 4250 m_log.DebugFormat(
4247 "[SCENE]: Found presence {0} {1} {2} in {3} after {4} waits", 4251 "[SCENE]: Found presence {0} {1} {2} in {3} after {4} waits",
4248 childAgentUpdate.Name, childAgentUpdate.UUID, childAgentUpdate.IsChildAgent ? "child" : "root", RegionInfo.RegionName, 20 - ntimes); 4252 sp.Name, sp.UUID, sp.IsChildAgent ? "child" : "root", Name, 20 - ntimes);
4249 4253
4250 if (childAgentUpdate.IsChildAgent) 4254 if (sp.IsChildAgent)
4251 return false; 4255 return false;
4252 } 4256 }
4257
4253 return true; 4258 return true;
4254 } 4259 }
4260
4255 return false; 4261 return false;
4256 } 4262 }
4257 4263
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0ba2dab..1b8c276 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -285,9 +285,23 @@ namespace OpenSim.Region.Framework.Scenes
285 /// </summary> 285 /// </summary>
286 private Vector3 posLastSignificantMove; 286 private Vector3 posLastSignificantMove;
287 287
288 // For teleports and crossings callbacks 288 #region For teleports and crossings callbacks
289 string m_callbackURI; 289
290 UUID m_originRegionID; 290 /// <summary>
291 /// In the V1 teleport protocol, the destination simulator sends ReleaseAgent to this address.
292 /// </summary>
293 private string m_callbackURI;
294
295 public UUID m_originRegionID;
296
297 /// <summary>
298 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
299 /// teleport is reusing the connection.
300 /// </summary>
301 /// <remarks>May be refactored or move somewhere else soon.</remarks>
302 public bool DoNotCloseAfterTeleport { get; set; }
303
304 #endregion
291 305
292 /// <value> 306 /// <value>
293 /// Script engines present in the scene 307 /// Script engines present in the scene
@@ -717,13 +731,6 @@ namespace OpenSim.Region.Framework.Scenes
717 } 731 }
718 } 732 }
719 733
720 /// <summary>
721 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
722 /// teleport is reusing the connection.
723 /// </summary>
724 /// <remarks>May be refactored or move somewhere else soon.</remarks>
725 public bool DoNotCloseAfterTeleport { get; set; }
726
727 private float m_speedModifier = 1.0f; 734 private float m_speedModifier = 1.0f;
728 735
729 public float SpeedModifier 736 public float SpeedModifier
@@ -1325,14 +1332,14 @@ namespace OpenSim.Region.Framework.Scenes
1325 int count = 20; 1332 int count = 20;
1326 while (m_originRegionID.Equals(UUID.Zero) && count-- > 0) 1333 while (m_originRegionID.Equals(UUID.Zero) && count-- > 0)
1327 { 1334 {
1328 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.RegionInfo.RegionName); 1335 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name);
1329 Thread.Sleep(200); 1336 Thread.Sleep(200);
1330 } 1337 }
1331 1338
1332 if (m_originRegionID.Equals(UUID.Zero)) 1339 if (m_originRegionID.Equals(UUID.Zero))
1333 { 1340 {
1334 // Movement into region will fail 1341 // Movement into region will fail
1335 m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived", client.Name); 1342 m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived in {1}", client.Name, Scene.Name);
1336 return false; 1343 return false;
1337 } 1344 }
1338 1345
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 58a417e..9af3dce 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -96,8 +96,8 @@ public sealed class BSCharacter : BSPhysObject
96 m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName); 96 m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName);
97 PhysicalActors.Add(AvatarMoveActorName, m_moveActor); 97 PhysicalActors.Add(AvatarMoveActorName, m_moveActor);
98 98
99 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", 99 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6}",
100 LocalID, _size, Scale, Density, _avatarVolume, RawMass); 100 LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos);
101 101
102 // do actual creation in taint time 102 // do actual creation in taint time
103 PhysScene.TaintedObject("BSCharacter.create", delegate() 103 PhysScene.TaintedObject("BSCharacter.create", delegate()
@@ -190,6 +190,10 @@ public sealed class BSCharacter : BSPhysObject
190 } 190 }
191 191
192 set { 192 set {
193 // This is how much the avatar size is changing. Positive means getting bigger.
194 // The avatar altitude must be adjusted for this change.
195 float heightChange = value.Z - _size.Z;
196
193 _size = value; 197 _size = value;
194 // Old versions of ScenePresence passed only the height. If width and/or depth are zero, 198 // Old versions of ScenePresence passed only the height. If width and/or depth are zero,
195 // replace with the default values. 199 // replace with the default values.
@@ -207,6 +211,10 @@ public sealed class BSCharacter : BSPhysObject
207 { 211 {
208 PhysScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale); 212 PhysScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale);
209 UpdatePhysicalMassProperties(RawMass, true); 213 UpdatePhysicalMassProperties(RawMass, true);
214
215 // Adjust the avatar's position to account for the increase/decrease in size
216 ForcePosition = new OMV.Vector3(RawPosition.X, RawPosition.Y, RawPosition.Z + heightChange / 2f);
217
210 // Make sure this change appears as a property update event 218 // Make sure this change appears as a property update event
211 PhysScene.PE.PushUpdate(PhysBody); 219 PhysScene.PE.PushUpdate(PhysBody);
212 } 220 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 4520171..fcb892a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -570,9 +570,9 @@ public static class BSParam
570 new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", 570 new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground",
571 -0.2f ), 571 -0.2f ),
572 new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", 572 new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground",
573 0.1f ), 573 0.2f ),
574 new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", 574 new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground",
575 0.1f ), 575 0.2f ),
576 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 576 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
577 0.1f ), 577 0.1f ),
578 new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", 578 new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",