aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-02-19 14:20:53 +0100
committerMelanie2012-02-19 14:20:53 +0100
commit185bf55804af69390f54650f238d126614062e87 (patch)
tree3371a66f758745ae0694f8199054c3fa3d8548e6 /OpenSim
parentNow if chode prim.cs detects out of bounds it requests a update and blocks mo... (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-185bf55804af69390f54650f238d126614062e87.zip
opensim-SC_OLD-185bf55804af69390f54650f238d126614062e87.tar.gz
opensim-SC_OLD-185bf55804af69390f54650f238d126614062e87.tar.bz2
opensim-SC_OLD-185bf55804af69390f54650f238d126614062e87.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations24
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs105
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs4
-rw-r--r--OpenSim/Framework/Util.cs38
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs89
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs34
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs133
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs82
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs41
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs4
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs3
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs27
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs17
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs2
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs8
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs3
-rw-r--r--OpenSim/Tests/Torture/ObjectTortureTests.cs21
31 files changed, 688 insertions, 90 deletions
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index 0f40cdc..1ceddf9 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -541,4 +541,26 @@ CREATE TABLE regionwindlight (
541 cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0', 541 cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0',
542 draw_classic_clouds INTEGER NOT NULL DEFAULT '1'); 542 draw_classic_clouds INTEGER NOT NULL DEFAULT '1');
543 543
544COMMIT; \ No newline at end of file 544COMMIT;
545
546
547:VERSION 24
548
549BEGIN;
550
551CREATE TABLE IF NOT EXISTS `spawn_points` (
552 `RegionID` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
553 `Yaw` float NOT NULL,
554 `Pitch` float NOT NULL,
555 `Distance` float NOT NULL
556);
557
558ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
559
560COMMIT;
561
562:VERSION 25
563
564BEGIN;
565ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
566COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index ce1b7b4..6295113 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -61,6 +61,7 @@ namespace OpenSim.Data.SQLite
61 private const string regionbanListSelect = "select * from regionban"; 61 private const string regionbanListSelect = "select * from regionban";
62 private const string regionSettingsSelect = "select * from regionsettings"; 62 private const string regionSettingsSelect = "select * from regionsettings";
63 private const string regionWindlightSelect = "select * from regionwindlight"; 63 private const string regionWindlightSelect = "select * from regionwindlight";
64 private const string regionSpawnPointsSelect = "select * from spawn_points";
64 65
65 private DataSet ds; 66 private DataSet ds;
66 private SqliteDataAdapter primDa; 67 private SqliteDataAdapter primDa;
@@ -71,6 +72,7 @@ namespace OpenSim.Data.SQLite
71 private SqliteDataAdapter landAccessListDa; 72 private SqliteDataAdapter landAccessListDa;
72 private SqliteDataAdapter regionSettingsDa; 73 private SqliteDataAdapter regionSettingsDa;
73 private SqliteDataAdapter regionWindlightDa; 74 private SqliteDataAdapter regionWindlightDa;
75 private SqliteDataAdapter regionSpawnPointsDa;
74 76
75 private SqliteConnection m_conn; 77 private SqliteConnection m_conn;
76 private String m_connectionString; 78 private String m_connectionString;
@@ -140,6 +142,10 @@ namespace OpenSim.Data.SQLite
140 142
141 SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn); 143 SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn);
142 regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd); 144 regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd);
145
146 SqliteCommand regionSpawnPointsSelectCmd = new SqliteCommand(regionSpawnPointsSelect, m_conn);
147 regionSpawnPointsDa = new SqliteDataAdapter(regionSpawnPointsSelectCmd);
148
143 // This actually does the roll forward assembly stuff 149 // This actually does the roll forward assembly stuff
144 Migration m = new Migration(m_conn, Assembly, "RegionStore"); 150 Migration m = new Migration(m_conn, Assembly, "RegionStore");
145 m.Update(); 151 m.Update();
@@ -170,6 +176,9 @@ namespace OpenSim.Data.SQLite
170 ds.Tables.Add(createRegionWindlightTable()); 176 ds.Tables.Add(createRegionWindlightTable());
171 setupRegionWindlightCommands(regionWindlightDa, m_conn); 177 setupRegionWindlightCommands(regionWindlightDa, m_conn);
172 178
179 ds.Tables.Add(createRegionSpawnPointsTable());
180 setupRegionSpawnPointsCommands(regionSpawnPointsDa, m_conn);
181
173 // WORKAROUND: This is a work around for sqlite on 182 // WORKAROUND: This is a work around for sqlite on
174 // windows, which gets really unhappy with blob columns 183 // windows, which gets really unhappy with blob columns
175 // that have no sample data in them. At some point we 184 // that have no sample data in them. At some point we
@@ -246,6 +255,15 @@ namespace OpenSim.Data.SQLite
246 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message); 255 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message);
247 } 256 }
248 257
258 try
259 {
260 regionSpawnPointsDa.Fill(ds.Tables["spawn_points"]);
261 }
262 catch (Exception e)
263 {
264 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on spawn_points table :{0}", e.Message);
265 }
266
249 // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! 267 // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
250 // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 268 // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409
251 // Possibly because we manually set up our own DataTables before connecting to the database 269 // Possibly because we manually set up our own DataTables before connecting to the database
@@ -257,6 +275,7 @@ namespace OpenSim.Data.SQLite
257 CreateDataSetMapping(landAccessListDa, "landaccesslist"); 275 CreateDataSetMapping(landAccessListDa, "landaccesslist");
258 CreateDataSetMapping(regionSettingsDa, "regionsettings"); 276 CreateDataSetMapping(regionSettingsDa, "regionsettings");
259 CreateDataSetMapping(regionWindlightDa, "regionwindlight"); 277 CreateDataSetMapping(regionWindlightDa, "regionwindlight");
278 CreateDataSetMapping(regionSpawnPointsDa, "spawn_points");
260 } 279 }
261 } 280 }
262 catch (Exception e) 281 catch (Exception e)
@@ -319,6 +338,11 @@ namespace OpenSim.Data.SQLite
319 regionWindlightDa.Dispose(); 338 regionWindlightDa.Dispose();
320 regionWindlightDa = null; 339 regionWindlightDa = null;
321 } 340 }
341 if (regionSpawnPointsDa != null)
342 {
343 regionSpawnPointsDa.Dispose();
344 regionWindlightDa = null;
345 }
322 } 346 }
323 347
324 public void StoreRegionSettings(RegionSettings rs) 348 public void StoreRegionSettings(RegionSettings rs)
@@ -339,8 +363,43 @@ namespace OpenSim.Data.SQLite
339 fillRegionSettingsRow(settingsRow, rs); 363 fillRegionSettingsRow(settingsRow, rs);
340 } 364 }
341 365
366 StoreSpawnPoints(rs);
367
342 Commit(); 368 Commit();
343 } 369 }
370
371 }
372
373 public void StoreSpawnPoints(RegionSettings rs)
374 {
375 lock (ds)
376 {
377 // DataTable spawnpoints = ds.Tables["spawn_points"];
378
379 // remove region's spawnpoints
380 using (
381 SqliteCommand cmd =
382 new SqliteCommand("delete from spawn_points where RegionID=:RegionID",
383 m_conn))
384 {
385
386 cmd.Parameters.Add(new SqliteParameter(":RegionID", rs.RegionUUID.ToString()));
387 cmd.ExecuteNonQuery();
388 }
389 }
390
391 foreach (SpawnPoint sp in rs.SpawnPoints())
392 {
393 using (SqliteCommand cmd = new SqliteCommand("insert into spawn_points(RegionID, Yaw, Pitch, Distance)" +
394 "values ( :RegionID, :Yaw, :Pitch, :Distance)", m_conn))
395 {
396 cmd.Parameters.Add(new SqliteParameter(":RegionID", rs.RegionUUID.ToString()));
397 cmd.Parameters.Add(new SqliteParameter(":Yaw", sp.Yaw));
398 cmd.Parameters.Add(new SqliteParameter(":Pitch", sp.Pitch));
399 cmd.Parameters.Add(new SqliteParameter(":Distance", sp.Distance));
400 cmd.ExecuteNonQuery();
401 }
402 }
344 } 403 }
345 404
346 /// <summary> 405 /// <summary>
@@ -435,10 +494,31 @@ namespace OpenSim.Data.SQLite
435 RegionSettings newSettings = buildRegionSettings(row); 494 RegionSettings newSettings = buildRegionSettings(row);
436 newSettings.OnSave += StoreRegionSettings; 495 newSettings.OnSave += StoreRegionSettings;
437 496
497 LoadSpawnPoints(newSettings);
498
438 return newSettings; 499 return newSettings;
439 } 500 }
440 } 501 }
441 502
503 private void LoadSpawnPoints(RegionSettings rs)
504 {
505 rs.ClearSpawnPoints();
506
507 DataTable spawnpoints = ds.Tables["spawn_points"];
508 string byRegion = "RegionID = '" + rs.RegionUUID + "'";
509 DataRow[] spForRegion = spawnpoints.Select(byRegion);
510
511 foreach (DataRow spRow in spForRegion)
512 {
513 SpawnPoint sp = new SpawnPoint();
514 sp.Pitch = (float)spRow["Pitch"];
515 sp.Yaw = (float)spRow["Yaw"];
516 sp.Distance = (float)spRow["Distance"];
517
518 rs.AddSpawnPoint(sp);
519 }
520 }
521
442 /// <summary> 522 /// <summary>
443 /// Adds an object into region storage 523 /// Adds an object into region storage
444 /// </summary> 524 /// </summary>
@@ -1265,6 +1345,8 @@ namespace OpenSim.Data.SQLite
1265 createCol(regionsettings, "covenant", typeof(String)); 1345 createCol(regionsettings, "covenant", typeof(String));
1266 createCol(regionsettings, "covenant_datetime", typeof(Int32)); 1346 createCol(regionsettings, "covenant_datetime", typeof(Int32));
1267 createCol(regionsettings, "map_tile_ID", typeof(String)); 1347 createCol(regionsettings, "map_tile_ID", typeof(String));
1348 createCol(regionsettings, "TelehubObject", typeof(String));
1349 createCol(regionsettings, "parcel_tile_ID", typeof(String));
1268 regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; 1350 regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
1269 return regionsettings; 1351 return regionsettings;
1270 } 1352 }
@@ -1345,6 +1427,17 @@ namespace OpenSim.Data.SQLite
1345 return regionwindlight; 1427 return regionwindlight;
1346 } 1428 }
1347 1429
1430 private static DataTable createRegionSpawnPointsTable()
1431 {
1432 DataTable spawn_points = new DataTable("spawn_points");
1433 createCol(spawn_points, "regionID", typeof(String));
1434 createCol(spawn_points, "Yaw", typeof(float));
1435 createCol(spawn_points, "Pitch", typeof(float));
1436 createCol(spawn_points, "Distance", typeof(float));
1437
1438 return spawn_points;
1439 }
1440
1348 /*********************************************************************** 1441 /***********************************************************************
1349 * 1442 *
1350 * Convert between ADO.NET <=> OpenSim Objects 1443 * Convert between ADO.NET <=> OpenSim Objects
@@ -1666,6 +1759,8 @@ namespace OpenSim.Data.SQLite
1666 newSettings.Covenant = new UUID((String)row["covenant"]); 1759 newSettings.Covenant = new UUID((String)row["covenant"]);
1667 newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); 1760 newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
1668 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); 1761 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
1762 newSettings.TelehubObject = new UUID((String)row["TelehubObject"]);
1763 newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]);
1669 1764
1670 return newSettings; 1765 return newSettings;
1671 } 1766 }
@@ -2068,6 +2163,8 @@ namespace OpenSim.Data.SQLite
2068 row["covenant"] = settings.Covenant.ToString(); 2163 row["covenant"] = settings.Covenant.ToString();
2069 row["covenant_datetime"] = settings.CovenantChangedDateTime; 2164 row["covenant_datetime"] = settings.CovenantChangedDateTime;
2070 row["map_tile_ID"] = settings.TerrainImageID.ToString(); 2165 row["map_tile_ID"] = settings.TerrainImageID.ToString();
2166 row["TelehubObject"] = settings.TelehubObject.ToString();
2167 row["parcel_tile_ID"] = settings.ParcelImageID.ToString();
2071 } 2168 }
2072 2169
2073 /// <summary> 2170 /// <summary>
@@ -2591,6 +2688,14 @@ namespace OpenSim.Data.SQLite
2591 da.UpdateCommand.Connection = conn; 2688 da.UpdateCommand.Connection = conn;
2592 } 2689 }
2593 2690
2691 private void setupRegionSpawnPointsCommands(SqliteDataAdapter da, SqliteConnection conn)
2692 {
2693 da.InsertCommand = createInsertCommand("spawn_points", ds.Tables["spawn_points"]);
2694 da.InsertCommand.Connection = conn;
2695 da.UpdateCommand = createUpdateCommand("spawn_points", "RegionID=:RegionID", ds.Tables["spawn_points"]);
2696 da.UpdateCommand.Connection = conn;
2697 }
2698
2594 /// <summary> 2699 /// <summary>
2595 /// 2700 ///
2596 /// </summary> 2701 /// </summary>
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 3868a31..586cde6 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -308,7 +308,9 @@ namespace OpenSim.Framework.Servers
308 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and 308 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
309 // the clr version number doesn't match the project version number under Mono. 309 // the clr version number doesn't match the project version number under Mono.
310 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); 310 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
311 m_log.Info("[STARTUP]: Operating system version: " + Environment.OSVersion + Environment.NewLine); 311 m_log.InfoFormat(
312 "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
313 Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
312 314
313 StartupSpecific(); 315 StartupSpecific();
314 316
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index dd30c2f..d2797e6 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -35,7 +35,8 @@ using System.IO;
35using System.IO.Compression; 35using System.IO.Compression;
36using System.Net; 36using System.Net;
37using System.Net.Sockets; 37using System.Net.Sockets;
38using System.Reflection; 38using System.Reflection;
39using System.Runtime.InteropServices;
39using System.Runtime.Serialization; 40using System.Runtime.Serialization;
40using System.Runtime.Serialization.Formatters.Binary; 41using System.Runtime.Serialization.Formatters.Binary;
41using System.Security.Cryptography; 42using System.Security.Cryptography;
@@ -375,6 +376,20 @@ namespace OpenSim.Framework
375 } 376 }
376 377
377 return sb.ToString(); 378 return sb.ToString();
379 }
380
381 /// <summary>
382 /// Is the platform Windows?
383 /// </summary>
384 /// <returns>true if so, false otherwise</returns>
385 public static bool IsWindows()
386 {
387 PlatformID platformId = Environment.OSVersion.Platform;
388
389 return (platformId == PlatformID.Win32NT
390 || platformId == PlatformID.Win32S
391 || platformId == PlatformID.Win32Windows
392 || platformId == PlatformID.WinCE);
378 } 393 }
379 394
380 public static bool IsEnvironmentSupported(ref string reason) 395 public static bool IsEnvironmentSupported(ref string reason)
@@ -1469,6 +1484,27 @@ namespace OpenSim.Framework
1469 } 1484 }
1470 1485
1471 return data; 1486 return data;
1487 }
1488
1489 /// <summary>
1490 /// Used to trigger an early library load on Windows systems.
1491 /// </summary>
1492 /// <remarks>
1493 /// Required to get 32-bit and 64-bit processes to automatically use the
1494 /// appropriate native library.
1495 /// </remarks>
1496 /// <param name="dllToLoad"></param>
1497 /// <returns></returns>
1498 [DllImport("kernel32.dll")]
1499 public static extern IntPtr LoadLibrary(string dllToLoad);
1500
1501 /// <summary>
1502 /// Determine whether the current process is 64 bit
1503 /// </summary>
1504 /// <returns>true if so, false if not</returns>
1505 public static bool Is64BitProcess()
1506 {
1507 return IntPtr.Size == 8;
1472 } 1508 }
1473 1509
1474 #region FireAndForget Threading Pattern 1510 #region FireAndForget Threading Pattern
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 3139112..a79b387 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -903,47 +903,64 @@ namespace OpenSim.Region.ClientStack.LindenUDP
903 903
904 private void HandleUseCircuitCode(object o) 904 private void HandleUseCircuitCode(object o)
905 { 905 {
906// DateTime startTime = DateTime.Now; 906 IPEndPoint remoteEndPoint = null;
907 object[] array = (object[])o; 907 IClientAPI client = null;
908 UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
909 UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
910
911 m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint);
912
913 IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
914 908
915 AuthenticateResponse sessionInfo; 909 try
916 if (IsClientAuthorized(uccp, out sessionInfo))
917 { 910 {
918 // Begin the process of adding the client to the simulator 911 // DateTime startTime = DateTime.Now;
919 IClientAPI client 912 object[] array = (object[])o;
920 = AddClient( 913 UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
921 uccp.CircuitCode.Code, 914 UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
922 uccp.CircuitCode.ID, 915
923 uccp.CircuitCode.SessionID, 916 m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint);
924 remoteEndPoint, 917
925 sessionInfo); 918 remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
926 919
927 // Send ack straight away to let the viewer know that the connection is active. 920 AuthenticateResponse sessionInfo;
928 // The client will be null if it already exists (e.g. if on a region crossing the client sends a use 921 if (IsClientAuthorized(uccp, out sessionInfo))
929 // circuit code to the existing child agent. This is not particularly obvious. 922 {
930 SendAckImmediate(remoteEndPoint, uccp.Header.Sequence); 923 // Begin the process of adding the client to the simulator
931 924 client
932 // We only want to send initial data to new clients, not ones which are being converted from child to root. 925 = AddClient(
933 if (client != null) 926 uccp.CircuitCode.Code,
934 client.SceneAgent.SendInitialDataToMe(); 927 uccp.CircuitCode.ID,
928 uccp.CircuitCode.SessionID,
929 remoteEndPoint,
930 sessionInfo);
931
932 // Send ack straight away to let the viewer know that the connection is active.
933 // The client will be null if it already exists (e.g. if on a region crossing the client sends a use
934 // circuit code to the existing child agent. This is not particularly obvious.
935 SendAckImmediate(remoteEndPoint, uccp.Header.Sequence);
936
937 // We only want to send initial data to new clients, not ones which are being converted from child to root.
938 if (client != null)
939 client.SceneAgent.SendInitialDataToMe();
940 }
941 else
942 {
943 // Don't create clients for unauthorized requesters.
944 m_log.WarnFormat(
945 "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
946 uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint);
947 }
948
949 // m_log.DebugFormat(
950 // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
951 // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
952
935 } 953 }
936 else 954 catch (Exception e)
937 { 955 {
938 // Don't create clients for unauthorized requesters. 956 m_log.ErrorFormat(
939 m_log.WarnFormat( 957 "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}",
940 "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", 958 remoteEndPoint != null ? remoteEndPoint.ToString() : "n/a",
941 uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); 959 client != null ? client.Name : "unknown",
960 client != null ? client.AgentId.ToString() : "unknown",
961 e.Message,
962 e.StackTrace);
942 } 963 }
943
944 // m_log.DebugFormat(
945// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
946// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
947 } 964 }
948 965
949 /// <summary> 966 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index c7f4c20..b0cee03 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -496,6 +496,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
496 SetAppearanceAssets(sp.UUID, sp.Appearance); 496 SetAppearanceAssets(sp.UUID, sp.Appearance);
497 497
498 m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); 498 m_scene.AvatarService.SetAppearance(agentid, sp.Appearance);
499
500 // Trigger this here because it's the final step in the set/queue/save process for appearance setting.
501 // Everything has been updated and stored. Ensures bakes have been persisted (if option is set to persist bakes).
502 m_scene.EventManager.TriggerAvatarAppearanceChanged(sp);
499 } 503 }
500 504
501 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) 505 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 82a035b..6c4c63f 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -565,9 +565,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
565// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is {1} {2}", 565// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is {1} {2}",
566// action, remoteClient.Name, userID); 566// action, remoteClient.Name, userID);
567 } 567 }
568 else if (so.RootPart.OwnerID == so.RootPart.GroupID)
569 {
570 // Group owned objects go to the last owner before the object was transferred.
571 userID = so.RootPart.LastOwnerID;
572 }
568 else 573 else
569 { 574 {
570 // All returns / deletes go to the object owner 575 // Other returns / deletes go to the object owner
571 // 576 //
572 userID = so.RootPart.OwnerID; 577 userID = so.RootPart.OwnerID;
573 578
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
index 786e0b5..be8a9a2 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
@@ -65,13 +65,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
65 } 65 }
66 } 66 }
67 67
68 internal struct ScopedRegionPosition
69 {
70 public UUID m_scopeID;
71 public ulong m_regionHandle;
72 public ScopedRegionPosition(UUID scopeID, ulong handle)
73 {
74 m_scopeID = scopeID;
75 m_regionHandle = handle;
76 }
77 }
78
68 private ExpiringCache<ScopedRegionUUID, GridRegion> m_UUIDCache; 79 private ExpiringCache<ScopedRegionUUID, GridRegion> m_UUIDCache;
69 private ExpiringCache<ScopedRegionName, ScopedRegionUUID> m_NameCache; 80 private ExpiringCache<ScopedRegionName, ScopedRegionUUID> m_NameCache;
81 private ExpiringCache<ScopedRegionPosition, GridRegion> m_PositionCache;
70 82
71 public RegionInfoCache() 83 public RegionInfoCache()
72 { 84 {
73 m_UUIDCache = new ExpiringCache<ScopedRegionUUID, GridRegion>(); 85 m_UUIDCache = new ExpiringCache<ScopedRegionUUID, GridRegion>();
74 m_NameCache = new ExpiringCache<ScopedRegionName, ScopedRegionUUID>(); 86 m_NameCache = new ExpiringCache<ScopedRegionName, ScopedRegionUUID>();
87 m_PositionCache = new ExpiringCache<ScopedRegionPosition, GridRegion>();
75 } 88 }
76 89
77 public void Cache(GridRegion rinfo) 90 public void Cache(GridRegion rinfo)
@@ -96,6 +109,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
96 { 109 {
97 ScopedRegionName name = new ScopedRegionName(scopeID,rinfo.RegionName); 110 ScopedRegionName name = new ScopedRegionName(scopeID,rinfo.RegionName);
98 m_NameCache.AddOrUpdate(name, id, CACHE_EXPIRATION_SECONDS); 111 m_NameCache.AddOrUpdate(name, id, CACHE_EXPIRATION_SECONDS);
112
113 ScopedRegionPosition pos = new ScopedRegionPosition(scopeID, rinfo.RegionHandle);
114 m_PositionCache.AddOrUpdate(pos, rinfo, CACHE_EXPIRATION_SECONDS);
99 } 115 }
100 } 116 }
101 117
@@ -114,6 +130,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
114 return null; 130 return null;
115 } 131 }
116 132
133 public GridRegion Get(UUID scopeID, ulong handle, out bool inCache)
134 {
135 inCache = false;
136
137 GridRegion rinfo = null;
138 ScopedRegionPosition pos = new ScopedRegionPosition(scopeID, handle);
139 if (m_PositionCache.TryGetValue(pos, out rinfo))
140 {
141 inCache = true;
142 return rinfo;
143 }
144
145 return null;
146 }
147
148
117 public GridRegion Get(UUID scopeID, string name, out bool inCache) 149 public GridRegion Get(UUID scopeID, string name, out bool inCache)
118 { 150 {
119 inCache = false; 151 inCache = false;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 6f364ae..e6c89d7 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -186,10 +186,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
186 186
187 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 187 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
188 { 188 {
189 GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); 189 bool inCache = false;
190 GridRegion rinfo = m_RegionInfoCache.Get(scopeID, Util.UIntsToLong((uint)x, (uint)y), out inCache);
191 if (inCache)
192 return rinfo;
193
194 rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y);
190 if (rinfo == null) 195 if (rinfo == null)
191 rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); 196 rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y);
192 197
198 m_RegionInfoCache.Cache(rinfo);
193 return rinfo; 199 return rinfo;
194 } 200 }
195 201
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 91aa228..02a163f 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -290,7 +290,8 @@ namespace OpenSim.Region.CoreModules.World.Land
290 ParcelFlags.AllowGroupScripts | 290 ParcelFlags.AllowGroupScripts |
291 ParcelFlags.CreateGroupObjects | 291 ParcelFlags.CreateGroupObjects |
292 ParcelFlags.AllowAPrimitiveEntry | 292 ParcelFlags.AllowAPrimitiveEntry |
293 ParcelFlags.AllowGroupObjectEntry); 293 ParcelFlags.AllowGroupObjectEntry |
294 ParcelFlags.AllowFly);
294 } 295 }
295 296
296 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale)) 297 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale))
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index d5b585a..d1d2020 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -148,6 +148,113 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
148 <OtherParts /> 148 <OtherParts />
149 </SceneObjectGroup>"; 149 </SceneObjectGroup>";
150 150
151 private string badFloatsXml = @"
152 <SceneObjectGroup>
153 <RootPart>
154 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
155 <AllowedDrop>false</AllowedDrop>
156 <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
157 <FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID>
158 <InventorySerial>1</InventorySerial>
159 <TaskInventory />
160 <ObjectFlags>0</ObjectFlags>
161 <UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID>
162 <LocalId>2698615125</LocalId>
163 <Name>NaughtyPrim</Name>
164 <Material>0</Material>
165 <PassTouches>false</PassTouches>
166 <RegionHandle>1099511628032000</RegionHandle>
167 <ScriptAccessPin>0</ScriptAccessPin>
168 <GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition>
169 <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition>
170 <RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset>
171 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
172 <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity>
173 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
174 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
175 <Description />
176 <Color />
177 <Text />
178 <SitName />
179 <TouchName />
180 <LinkNum>0</LinkNum>
181 <ClickAction>0</ClickAction>
182 <Shape>
183 <ProfileCurve>1</ProfileCurve>
184 <TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry>
185 <ExtraParams>AA==</ExtraParams>
186 <PathBegin>0</PathBegin>
187 <PathCurve>16</PathCurve>
188 <PathEnd>0</PathEnd>
189 <PathRadiusOffset>0</PathRadiusOffset>
190 <PathRevolutions>0</PathRevolutions>
191 <PathScaleX>100</PathScaleX>
192 <PathScaleY>100</PathScaleY>
193 <PathShearX>0</PathShearX>
194 <PathShearY>0</PathShearY>
195 <PathSkew>0</PathSkew>
196 <PathTaperX>0</PathTaperX>
197 <PathTaperY>0</PathTaperY>
198 <PathTwist>0</PathTwist>
199 <PathTwistBegin>0</PathTwistBegin>
200 <PCode>9</PCode>
201 <ProfileBegin>0</ProfileBegin>
202 <ProfileEnd>0</ProfileEnd>
203 <ProfileHollow>0</ProfileHollow>
204 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
205 <State>0</State>
206 <ProfileShape>Square</ProfileShape>
207 <HollowShape>Same</HollowShape>
208 <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
209 <SculptType>0</SculptType><SculptData />
210 <FlexiSoftness>0</FlexiSoftness>
211 <FlexiTension>0,5</FlexiTension>
212 <FlexiDrag>yo mamma</FlexiDrag>
213 <FlexiGravity>0</FlexiGravity>
214 <FlexiWind>0</FlexiWind>
215 <FlexiForceX>0</FlexiForceX>
216 <FlexiForceY>0</FlexiForceY>
217 <FlexiForceZ>0</FlexiForceZ>
218 <LightColorR>0</LightColorR>
219 <LightColorG>0</LightColorG>
220 <LightColorB>0</LightColorB>
221 <LightColorA>1</LightColorA>
222 <LightRadius>0</LightRadius>
223 <LightCutoff>0</LightCutoff>
224 <LightFalloff>0</LightFalloff>
225 <LightIntensity>1</LightIntensity>
226 <FlexiEntry>false</FlexiEntry>
227 <LightEntry>false</LightEntry>
228 <SculptEntry>false</SculptEntry>
229 </Shape>
230 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
231 <UpdateFlag>0</UpdateFlag>
232 <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
233 <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
234 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
235 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
236 <ParentID>0</ParentID>
237 <CreationDate>1211330445</CreationDate>
238 <Category>0</Category>
239 <SalePrice>0</SalePrice>
240 <ObjectSaleType>0</ObjectSaleType>
241 <OwnershipCost>0</OwnershipCost>
242 <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
243 <OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID>
244 <LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID>
245 <BaseMask>2147483647</BaseMask>
246 <OwnerMask>2147483647</OwnerMask>
247 <GroupMask>0</GroupMask>
248 <EveryoneMask>0</EveryoneMask>
249 <NextOwnerMask>2147483647</NextOwnerMask>
250 <Flags>None</Flags>
251 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
252 <CollisionSoundVolume>0</CollisionSoundVolume>
253 </SceneObjectPart>
254 </RootPart>
255 <OtherParts />
256 </SceneObjectGroup>";
257
151 private string xml2 = @" 258 private string xml2 = @"
152 <SceneObjectGroup> 259 <SceneObjectGroup>
153 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> 260 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
@@ -257,6 +364,32 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
257 } 364 }
258 365
259 [Test] 366 [Test]
367 public void TestDeserializeBadFloatsXml()
368 {
369 TestHelpers.InMethod();
370// log4net.Config.XmlConfigurator.Configure();
371
372 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(badFloatsXml);
373 SceneObjectPart rootPart = so.RootPart;
374
375 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
376 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
377 Assert.That(rootPart.Name, Is.EqualTo("NaughtyPrim"));
378
379 // This terminates the deserialization earlier if couldn't be parsed.
380 // TODO: Need to address this
381 Assert.That(rootPart.GroupPosition.X, Is.EqualTo(147.23f));
382
383 Assert.That(rootPart.Shape.PathCurve, Is.EqualTo(16));
384
385 // Defaults for bad parses
386 Assert.That(rootPart.Shape.FlexiTension, Is.EqualTo(0));
387 Assert.That(rootPart.Shape.FlexiDrag, Is.EqualTo(0));
388
389 // TODO: Check other properties
390 }
391
392 [Test]
260 public void TestSerializeXml() 393 public void TestSerializeXml()
261 { 394 {
262 TestHelpers.InMethod(); 395 TestHelpers.InMethod();
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 57db4d6..9fcd5fe 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -177,6 +177,9 @@ namespace OpenSim.Region.Framework.Scenes
177 public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); 177 public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
178 public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; 178 public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
179 179
180 public delegate void AvatarAppearanceChange(ScenePresence avatar);
181 public event AvatarAppearanceChange OnAvatarAppearanceChange;
182
180 public event Action<ScenePresence> OnSignificantClientMovement; 183 public event Action<ScenePresence> OnSignificantClientMovement;
181 184
182 public delegate void IncomingInstantMessage(GridInstantMessage message); 185 public delegate void IncomingInstantMessage(GridInstantMessage message);
@@ -188,10 +191,62 @@ namespace OpenSim.Region.Framework.Scenes
188 191
189 public event ClientClosed OnClientClosed; 192 public event ClientClosed OnClientClosed;
190 193
194 // Fired when a script is created
195 // The indication that a new script exists in this region.
196 public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
197 public event NewScript OnNewScript;
198 public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
199 {
200 NewScript handlerNewScript = OnNewScript;
201 if (handlerNewScript != null)
202 {
203 foreach (NewScript d in handlerNewScript.GetInvocationList())
204 {
205 try
206 {
207 d(clientID, part, itemID);
208 }
209 catch (Exception e)
210 {
211 m_log.ErrorFormat(
212 "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}",
213 e.Message, e.StackTrace);
214 }
215 }
216 }
217 }
218
219 //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
220 // An indication that the script has changed.
221 public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
222 public event UpdateScript OnUpdateScript;
223 public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
224 {
225 UpdateScript handlerUpdateScript = OnUpdateScript;
226 if (handlerUpdateScript != null)
227 {
228 foreach (UpdateScript d in handlerUpdateScript.GetInvocationList())
229 {
230 try
231 {
232 d(clientId, itemId, primId, isScriptRunning, newAssetID);
233 }
234 catch (Exception e)
235 {
236 m_log.ErrorFormat(
237 "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}",
238 e.Message, e.StackTrace);
239 }
240 }
241 }
242 }
243
191 /// <summary> 244 /// <summary>
192 /// This is fired when a scene object property that a script might be interested in (such as color, scale or 245 /// ScriptChangedEvent is fired when a scene object property that a script might be interested
193 /// inventory) changes. Only enough information is sent for the LSL changed event 246 /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
194 /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed) 247 /// This is not an indication that the script has changed (see OnUpdateScript for that).
248 /// This event is sent to a script to tell it that some property changed on
249 /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
195 /// </summary> 250 /// </summary>
196 public event ScriptChangedEvent OnScriptChangedEvent; 251 public event ScriptChangedEvent OnScriptChangedEvent;
197 public delegate void ScriptChangedEvent(uint localID, uint change); 252 public delegate void ScriptChangedEvent(uint localID, uint change);
@@ -1262,6 +1317,27 @@ namespace OpenSim.Region.Framework.Scenes
1262 } 1317 }
1263 } 1318 }
1264 1319
1320 public void TriggerAvatarAppearanceChanged(ScenePresence avatar)
1321 {
1322 AvatarAppearanceChange handler = OnAvatarAppearanceChange;
1323 if (handler != null)
1324 {
1325 foreach (AvatarAppearanceChange d in handler.GetInvocationList())
1326 {
1327 try
1328 {
1329 d(avatar);
1330 }
1331 catch (Exception e)
1332 {
1333 m_log.ErrorFormat(
1334 "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}",
1335 e.Message, e.StackTrace);
1336 }
1337 }
1338 }
1339 }
1340
1265 public void TriggerIncomingInstantMessage(GridInstantMessage message) 1341 public void TriggerIncomingInstantMessage(GridInstantMessage message)
1266 { 1342 {
1267 IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; 1343 IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index fff39fb..e7a3b42 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -265,6 +265,10 @@ namespace OpenSim.Region.Framework.Scenes
265 // 265 //
266 errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0); 266 errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0);
267 } 267 }
268
269 // Tell anyone managing scripts that a script has been reloaded/changed
270 EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID);
271
268 part.ParentGroup.ResumeScripts(); 272 part.ParentGroup.ResumeScripts();
269 return errors; 273 return errors;
270 } 274 }
@@ -1643,9 +1647,13 @@ namespace OpenSim.Region.Framework.Scenes
1643 // have state in inventory 1647 // have state in inventory
1644 part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); 1648 part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
1645 1649
1650 // tell anyone watching that there is a new script in town
1651 EventManager.TriggerNewScript(agentID, part, copyID);
1652
1646 // m_log.InfoFormat("[PRIMINVENTORY]: " + 1653 // m_log.InfoFormat("[PRIMINVENTORY]: " +
1647 // "Rezzed script {0} into prim local ID {1} for user {2}", 1654 // "Rezzed script {0} into prim local ID {1} for user {2}",
1648 // item.inventoryName, localID, remoteClient.Name); 1655 // item.inventoryName, localID, remoteClient.Name);
1656
1649 part.ParentGroup.ResumeScripts(); 1657 part.ParentGroup.ResumeScripts();
1650 1658
1651 return part; 1659 return part;
@@ -1726,6 +1734,10 @@ namespace OpenSim.Region.Framework.Scenes
1726 1734
1727 part.Inventory.AddInventoryItem(taskItem, false); 1735 part.Inventory.AddInventoryItem(taskItem, false);
1728 part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); 1736 part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
1737
1738 // tell anyone managing scripts that a new script exists
1739 EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
1740
1729 part.ParentGroup.ResumeScripts(); 1741 part.ParentGroup.ResumeScripts();
1730 1742
1731 return part; 1743 return part;
@@ -1954,7 +1966,7 @@ namespace OpenSim.Region.Framework.Scenes
1954 permissionToTake = true; 1966 permissionToTake = true;
1955 permissionToDelete = true; 1967 permissionToDelete = true;
1956 1968
1957 AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); 1969 AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
1958 } 1970 }
1959 } 1971 }
1960 else // Auto return passes through here with null agent 1972 else // Auto return passes through here with null agent
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index bbdf35d..7b1ef40 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3397,6 +3397,9 @@ namespace OpenSim.Region.Framework.Scenes
3397 { 3397 {
3398 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || 3398 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
3399 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); 3399 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
3400 bool viahome = ((teleportFlags & (uint)Constants.TeleportFlags.ViaHome) != 0);
3401 bool godlike = ((teleportFlags & (uint)Constants.TeleportFlags.Godlike) != 0);
3402
3400 reason = String.Empty; 3403 reason = String.Empty;
3401 3404
3402 //Teleport flags: 3405 //Teleport flags:
@@ -3571,6 +3574,29 @@ namespace OpenSim.Region.Framework.Scenes
3571 agent.startpos.Z = 720; 3574 agent.startpos.Z = 720;
3572 } 3575 }
3573 } 3576 }
3577
3578 // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags
3579 if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero &&
3580 RegionInfo.EstateSettings.AllowDirectTeleport == false &&
3581 !viahome && !godlike)
3582 {
3583 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject);
3584 // Can have multiple SpawnPoints
3585 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints();
3586 if ( spawnpoints.Count > 1)
3587 {
3588 // We have multiple SpawnPoints, Route the agent to a random one
3589 agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
3590 }
3591 else
3592 {
3593 // We have a single SpawnPoint and will route the agent to it
3594 agent.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
3595 }
3596
3597 return true;
3598 }
3599
3574 // Honor parcel landing type and position. 3600 // Honor parcel landing type and position.
3575 /* 3601 /*
3576 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); 3602 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 6dd42dd..5a7f124 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -406,7 +406,7 @@ namespace OpenSim.Region.Framework.Scenes
406 m_log.ErrorFormat( 406 m_log.ErrorFormat(
407 "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}", 407 "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}",
408 sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero); 408 sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero);
409 409
410 return false; 410 return false;
411 } 411 }
412 412
@@ -415,12 +415,12 @@ namespace OpenSim.Region.Framework.Scenes
415// m_log.DebugFormat( 415// m_log.DebugFormat(
416// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", 416// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
417// m_parentScene.RegionInfo.RegionName, sceneObject.UUID); 417// m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
418 418
419 return false; 419 return false;
420 } 420 }
421 421
422// m_log.DebugFormat( 422// m_log.DebugFormat(
423// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", 423// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
424// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); 424// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
425 425
426 SceneObjectPart[] parts = sceneObject.Parts; 426 SceneObjectPart[] parts = sceneObject.Parts;
@@ -456,7 +456,7 @@ namespace OpenSim.Region.Framework.Scenes
456 456
457 lock (SceneObjectGroupsByFullID) 457 lock (SceneObjectGroupsByFullID)
458 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 458 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
459 459
460 lock (SceneObjectGroupsByFullPartID) 460 lock (SceneObjectGroupsByFullPartID)
461 { 461 {
462 foreach (SceneObjectPart part in parts) 462 foreach (SceneObjectPart part in parts)
@@ -1678,7 +1678,7 @@ namespace OpenSim.Region.Framework.Scenes
1678 1678
1679 if (group != null) 1679 if (group != null)
1680 { 1680 {
1681 if (m_parentScene.Permissions.CanEditObject(group.UUID,agentID)) 1681 if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
1682 { 1682 {
1683 group.UpdateExtraParam(primLocalID, type, inUse, data); 1683 group.UpdateExtraParam(primLocalID, type, inUse, data);
1684 } 1684 }
@@ -1695,7 +1695,7 @@ namespace OpenSim.Region.Framework.Scenes
1695 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1695 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1696 if (group != null) 1696 if (group != null)
1697 { 1697 {
1698 if (m_parentScene.Permissions.CanEditObject(group.GetPartsFullID(primLocalID), agentID)) 1698 if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
1699 { 1699 {
1700 ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); 1700 ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock();
1701 shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; 1701 shapeData.ObjectLocalID = shapeBlock.ObjectLocalID;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e7c6ee8..cbd45c3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1764,7 +1764,7 @@ namespace OpenSim.Region.Framework.Scenes
1764 m_log.DebugFormat( 1764 m_log.DebugFormat(
1765 "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn", 1765 "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn",
1766 RootPart.UUID); 1766 RootPart.UUID);
1767 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn"); 1767 m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn");
1768 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, 1768 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
1769 DeRezAction.Return, UUID.Zero); 1769 DeRezAction.Return, UUID.Zero);
1770 1770
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f9e61be..d6d04b2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -314,6 +314,9 @@ namespace OpenSim.Region.Framework.Scenes
314 314
315// ~SceneObjectPart() 315// ~SceneObjectPart()
316// { 316// {
317// Console.WriteLine(
318// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}",
319// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId);
317// m_log.DebugFormat( 320// m_log.DebugFormat(
318// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", 321// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}",
319// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); 322// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId);
@@ -1601,9 +1604,9 @@ namespace OpenSim.Region.Framework.Scenes
1601 dupe.GroupPosition = GroupPosition; 1604 dupe.GroupPosition = GroupPosition;
1602 dupe.OffsetPosition = OffsetPosition; 1605 dupe.OffsetPosition = OffsetPosition;
1603 dupe.RotationOffset = RotationOffset; 1606 dupe.RotationOffset = RotationOffset;
1604 dupe.Velocity = new Vector3(0, 0, 0); 1607 dupe.Velocity = Velocity;
1605 dupe.Acceleration = new Vector3(0, 0, 0); 1608 dupe.Acceleration = Acceleration;
1606 dupe.AngularVelocity = new Vector3(0, 0, 0); 1609 dupe.AngularVelocity = AngularVelocity;
1607 dupe.Flags = Flags; 1610 dupe.Flags = Flags;
1608 1611
1609 dupe.OwnershipCost = OwnershipCost; 1612 dupe.OwnershipCost = OwnershipCost;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 4b80e37..19cb9fb 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.IO; 31using System.IO;
32using System.Linq;
32using System.Reflection; 33using System.Reflection;
33using System.Xml; 34using System.Xml;
34using log4net; 35using log4net;
@@ -573,13 +574,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
573 574
574 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 575 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
575 { 576 {
576 bool errors = false; 577 List<string> errorNodeNames;
577 obj.Shape = ReadShape(reader, "Shape", out errors); 578 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames);
578 579
579 if (errors) 580 if (errorNodeNames != null)
581 {
580 m_log.DebugFormat( 582 m_log.DebugFormat(
581 "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors. Please see earlier log entries.", 583 "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors in properties {2}.",
582 obj.Name, obj.UUID); 584 obj.Name, obj.UUID, string.Join(", ", errorNodeNames.ToArray()));
585 }
583 } 586 }
584 587
585 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) 588 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader)
@@ -1529,31 +1532,44 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1529 /// </summary> 1532 /// </summary>
1530 /// <param name="reader"></param> 1533 /// <param name="reader"></param>
1531 /// <param name="name">The name of the xml element containing the shape</param> 1534 /// <param name="name">The name of the xml element containing the shape</param>
1532 /// <param name="errors">true if any errors were encountered during parsing, false otherwise</param> 1535 /// <param name="errors">a list containing the failing node names. If no failures then null.</param>
1533 /// <returns>The shape parsed</returns> 1536 /// <returns>The shape parsed</returns>
1534 public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) 1537 public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List<string> errorNodeNames)
1535 { 1538 {
1536 errors = false; 1539 List<string> internalErrorNodeNames = null;
1537 1540
1538 PrimitiveBaseShape shape = new PrimitiveBaseShape(); 1541 PrimitiveBaseShape shape = new PrimitiveBaseShape();
1539 1542
1543 if (reader.IsEmptyElement)
1544 {
1545 reader.Read();
1546 errorNodeNames = null;
1547 return shape;
1548 }
1549
1540 reader.ReadStartElement(name, String.Empty); // Shape 1550 reader.ReadStartElement(name, String.Empty); // Shape
1541 1551
1542 errors = ExternalRepresentationUtils.ExecuteReadProcessors( 1552 ExternalRepresentationUtils.ExecuteReadProcessors(
1543 shape, 1553 shape,
1544 m_ShapeXmlProcessors, 1554 m_ShapeXmlProcessors,
1545 reader, 1555 reader,
1546 (o, nodeName, e) 1556 (o, nodeName, e)
1547 => 1557 =>
1548 { 1558 {
1549 m_log.DebugFormat( 1559// m_log.DebugFormat(
1550 "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", 1560// "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
1551 nodeName, e.Message, e.StackTrace); 1561// nodeName, e.Message, e.StackTrace);
1562 if (internalErrorNodeNames == null)
1563 internalErrorNodeNames = new List<string>();
1564
1565 internalErrorNodeNames.Add(nodeName);
1552 } 1566 }
1553 ); 1567 );
1554 1568
1555 reader.ReadEndElement(); // Shape 1569 reader.ReadEndElement(); // Shape
1556 1570
1571 errorNodeNames = internalErrorNodeNames;
1572
1557 return shape; 1573 return shape;
1558 } 1574 }
1559 1575
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 80f198d..7737d8e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using System.Threading;
30using NUnit.Framework; 31using NUnit.Framework;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -43,6 +44,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests
43 [TestFixture] 44 [TestFixture]
44 public class SceneObjectBasicTests 45 public class SceneObjectBasicTests
45 { 46 {
47// [TearDown]
48// public void TearDown()
49// {
50// Console.WriteLine("TearDown");
51// GC.Collect();
52// Thread.Sleep(3000);
53// }
54
55// public class GcNotify
56// {
57// public static AutoResetEvent gcEvent = new AutoResetEvent(false);
58// private static bool _initialized = false;
59//
60// public static void Initialize()
61// {
62// if (!_initialized)
63// {
64// _initialized = true;
65// new GcNotify();
66// }
67// }
68//
69// private GcNotify(){}
70//
71// ~GcNotify()
72// {
73// if (!Environment.HasShutdownStarted &&
74// !AppDomain.CurrentDomain.IsFinalizingForUnload())
75// {
76// Console.WriteLine("GcNotify called");
77// gcEvent.Set();
78// new GcNotify();
79// }
80// }
81// }
82
46 /// <summary> 83 /// <summary>
47 /// Test adding an object to a scene. 84 /// Test adding an object to a scene.
48 /// </summary> 85 /// </summary>
@@ -147,11 +184,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
147 public void TestDeleteSceneObject() 184 public void TestDeleteSceneObject()
148 { 185 {
149 TestHelpers.InMethod(); 186 TestHelpers.InMethod();
150 187
151 TestScene scene = SceneHelpers.SetupScene(); 188 TestScene scene = SceneHelpers.SetupScene();
152 SceneObjectPart part = SceneHelpers.AddSceneObject(scene); 189 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
153 scene.DeleteSceneObject(part.ParentGroup, false); 190 scene.DeleteSceneObject(part.ParentGroup, false);
154 191
155 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 192 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
156 Assert.That(retrievedPart, Is.Null); 193 Assert.That(retrievedPart, Is.Null);
157 } 194 }
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index d2810be..d0142a4 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -230,8 +230,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
230 230
231 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; 231 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
232 232
233 m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", 233 // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
234 m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); 234 // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
235
236 m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName);
235 237
236 if ( m_uri != string.Empty ) 238 if ( m_uri != string.Empty )
237 { 239 {
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index d395206..ae46c97 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -121,8 +121,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
121 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); 121 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
122 122
123 m_log.DebugFormat( 123 m_log.DebugFormat(
124 "[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}", 124 "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
125 firstname, lastname, npcAvatar.AgentId, position, scene.RegionInfo.RegionName); 125 firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName);
126 126
127 AgentCircuitData acd = new AgentCircuitData(); 127 AgentCircuitData acd = new AgentCircuitData();
128 acd.AgentID = npcAvatar.AgentId; 128 acd.AgentID = npcAvatar.AgentId;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 3763696..8587a2b 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -30,7 +30,8 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using Nini.Config; 32using Nini.Config;
33using log4net; 33using log4net;
34using OpenSim.Framework;
34 35
35namespace OpenSim.Region.Physics.Manager 36namespace OpenSim.Region.Physics.Manager
36{ 37{
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index f15e81b..6f6ed7f 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -313,7 +313,7 @@ namespace OpenSim.Region.Physics.Meshing
313 private bool GenerateCoordsAndFacesFromPrimMeshData( 313 private bool GenerateCoordsAndFacesFromPrimMeshData(
314 string primName, PrimitiveBaseShape primShape, Vector3 size, out List<Coord> coords, out List<Face> faces) 314 string primName, PrimitiveBaseShape primShape, Vector3 size, out List<Coord> coords, out List<Face> faces)
315 { 315 {
316 m_log.DebugFormat("[MESH]: experimental mesh proxy generation for {0}", primName); 316// m_log.DebugFormat("[MESH]: experimental mesh proxy generation for {0}", primName);
317 317
318 coords = new List<Coord>(); 318 coords = new List<Coord>();
319 faces = new List<Face>(); 319 faces = new List<Face>();
@@ -321,7 +321,7 @@ namespace OpenSim.Region.Physics.Meshing
321 321
322 if (primShape.SculptData.Length <= 0) 322 if (primShape.SculptData.Length <= 0)
323 { 323 {
324 m_log.Error("[MESH]: asset data is zero length"); 324 m_log.ErrorFormat("[MESH]: asset data for {0} is zero length", primName);
325 return false; 325 return false;
326 } 326 }
327 327
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 716161a..e8bb476 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin
46 /// </summary> 46 /// </summary>
47 public class OdePlugin : IPhysicsPlugin 47 public class OdePlugin : IPhysicsPlugin
48 { 48 {
49 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 private OdeScene m_scene; 51 private OdeScene m_scene;
52 52
@@ -59,13 +59,36 @@ namespace OpenSim.Region.Physics.OdePlugin
59 { 59 {
60 if (m_scene == null) 60 if (m_scene == null)
61 { 61 {
62 // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether
63 // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
64 // will find it already loaded later on.
65 //
66 // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
67 // controlled in Ode.NET.dll.config
68 if (Util.IsWindows())
69 {
70 string nativeLibraryPath;
71
72 if (Util.Is64BitProcess())
73 nativeLibraryPath = "lib64/ode.dll";
74 else
75 nativeLibraryPath = "lib32/ode.dll";
76
77 m_log.DebugFormat("[ODE PLUGIN]: Loading native Windows ODE library at {0}", nativeLibraryPath);
78
79 if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero)
80 m_log.ErrorFormat(
81 "[ODE PLUGIN]: Couldn't find native Windows ODE library at {0}", nativeLibraryPath);
82 }
83
62 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to 84 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
63 // http://opensimulator.org/mantis/view.php?id=2750). 85 // http://opensimulator.org/mantis/view.php?id=2750).
64 d.InitODE(); 86 d.InitODE();
65 87
66 m_scene = new OdeScene(sceneIdentifier); 88 m_scene = new OdeScene(sceneIdentifier);
67 } 89 }
68 return (m_scene); 90
91 return m_scene;
69 } 92 }
70 93
71 public string GetName() 94 public string GetName()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c83df4e..2424130 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2254,7 +2254,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2254 firstname, lastname, position, notecard, 2254 firstname, lastname, position, notecard,
2255 (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0, 2255 (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0,
2256 false); 2256 false);
2257// (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0); 2257// (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0);
2258 } 2258 }
2259 2259
2260 private LSL_Key NpcCreate( 2260 private LSL_Key NpcCreate(
@@ -2634,7 +2634,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2634 UUID npcID = new UUID(npc.m_string); 2634 UUID npcID = new UUID(npc.m_string);
2635 2635
2636 if (module.CheckPermissions(npcID, m_host.OwnerID)) 2636 if (module.CheckPermissions(npcID, m_host.OwnerID))
2637 AvatarPlayAnimation(npcID.ToString(), animation); 2637 AvatarStopAnimation(npcID.ToString(), animation);
2638 } 2638 }
2639 } 2639 }
2640 2640
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 5c200d6..83da204 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using log4net; 33using log4net;
34
35using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.ScriptEngine.Shared; 36using OpenSim.Region.ScriptEngine.Shared;
@@ -41,6 +40,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
41{ 40{
42 public class SensorRepeat 41 public class SensorRepeat
43 { 42 {
43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
44 public AsyncCommandManager m_CmdManager; 45 public AsyncCommandManager m_CmdManager;
45 46
46 public SensorRepeat(AsyncCommandManager CmdManager) 47 public SensorRepeat(AsyncCommandManager CmdManager)
@@ -452,11 +453,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
452 453
453 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence => 454 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
454 { 455 {
456// m_log.DebugFormat(
457// "[SENSOR REPEAT]: Inspecting scene presence {0}, type {1} on sensor sweep for {2}, type {3}",
458// presence.Name, presence.PresenceType, ts.name, ts.type);
459
455 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) 460 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
456 { 461 {
457 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); 462 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
458 if (npcData == null || !npcData.SenseAsAgent) 463 if (npcData == null || !npcData.SenseAsAgent)
464 {
465// m_log.DebugFormat(
466// "[SENSOR REPEAT]: Discarding NPC {0} from agent sense sweep for script item id {1}",
467// presence.Name, ts.itemID);
459 return; 468 return;
469 }
460 } 470 }
461 471
462 if ((ts.type & AGENT) == 0) 472 if ((ts.type & AGENT) == 0)
@@ -469,7 +479,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
469 { 479 {
470 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); 480 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
471 if (npcData != null && npcData.SenseAsAgent) 481 if (npcData != null && npcData.SenseAsAgent)
482 {
483// m_log.DebugFormat(
484// "[SENSOR REPEAT]: Discarding NPC {0} from non-agent sense sweep for script item id {1}",
485// presence.Name, ts.itemID);
472 return; 486 return;
487 }
473 } 488 }
474 } 489 }
475 490
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
index 44138c9..b1dd84e 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
@@ -220,7 +220,7 @@ namespace OpenSim.Services.Connectors.Friends
220 public bool Delete(Dictionary<string, object> sendData, string PrincipalID, string Friend) 220 public bool Delete(Dictionary<string, object> sendData, string PrincipalID, string Friend)
221 { 221 {
222 string reply = string.Empty; 222 string reply = string.Empty;
223 string uri = m_ServerURI = "/friends"; 223 string uri = m_ServerURI + "/friends";
224 try 224 try
225 { 225 {
226 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); 226 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData));
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 5d99c79..0a59f86 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -188,9 +188,9 @@ namespace OpenSim.Services.HypergridService
188 string authURL = string.Empty; 188 string authURL = string.Empty;
189 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 189 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
190 authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 190 authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
191 m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9}", 191 m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9} Teleport Flags {10}",
192 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName, 192 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName,
193 aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0); 193 aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString());
194 194
195 // 195 //
196 // Check client 196 // Check client
@@ -315,6 +315,10 @@ namespace OpenSim.Services.HypergridService
315 // Finally launch the agent at the destination 315 // Finally launch the agent at the destination
316 // 316 //
317 Constants.TeleportFlags loginFlag = isFirstLogin ? Constants.TeleportFlags.ViaLogin : Constants.TeleportFlags.ViaHGLogin; 317 Constants.TeleportFlags loginFlag = isFirstLogin ? Constants.TeleportFlags.ViaLogin : Constants.TeleportFlags.ViaHGLogin;
318
319 // Preserve our TeleportFlags we have gathered so-far
320 loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags;
321
318 m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag); 322 m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag);
319 return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); 323 return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason);
320 } 324 }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 035980d..6a9b8c6 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -472,6 +472,7 @@ namespace OpenSim.Services.LLLoginService
472 472
473 position = pinfo.HomePosition; 473 position = pinfo.HomePosition;
474 lookAt = pinfo.HomeLookAt; 474 lookAt = pinfo.HomeLookAt;
475 flags |= TeleportFlags.ViaHome;
475 } 476 }
476 477
477 if (tryDefaults) 478 if (tryDefaults)
@@ -760,6 +761,7 @@ namespace OpenSim.Services.LLLoginService
760 { 761 {
761 circuitCode = (uint)Util.RandomClass.Next(); ; 762 circuitCode = (uint)Util.RandomClass.Next(); ;
762 aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); 763 aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0);
764 aCircuit.teleportFlags |= (uint)flags;
763 success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); 765 success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason);
764 if (!success && m_GridService != null) 766 if (!success && m_GridService != null)
765 { 767 {
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 328cd2b..eea68c3 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -50,7 +50,8 @@ namespace OpenSim.Tests.Common.Mock
50 50
51 ~TestScene() 51 ~TestScene()
52 { 52 {
53 Console.WriteLine("TestScene destructor called for {0}", RegionInfo.RegionName); 53 //Console.WriteLine("TestScene destructor called for {0}", RegionInfo.RegionName);
54 Console.WriteLine("TestScene destructor called");
54 } 55 }
55 56
56 /// <summary> 57 /// <summary>
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs
index 74b336e..e83186a 100644
--- a/OpenSim/Tests/Torture/ObjectTortureTests.cs
+++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs
@@ -49,6 +49,13 @@ namespace OpenSim.Tests.Torture
49 [TestFixture] 49 [TestFixture]
50 public class ObjectTortureTests 50 public class ObjectTortureTests
51 { 51 {
52 [TearDown]
53 public void TearDown()
54 {
55 GC.Collect();
56 GC.WaitForPendingFinalizers();
57 }
58
52// [Test] 59// [Test]
53// public void Test0000Clean() 60// public void Test0000Clean()
54// { 61// {
@@ -141,8 +148,18 @@ namespace OpenSim.Tests.Torture
141 string.Format("Object {0} could not be retrieved", i)); 148 string.Format("Object {0} could not be retrieved", i));
142 } 149 }
143 150
144 // This does not work to fire the SceneObjectGroup destructors - something else is hanging on to them. 151 // When a scene object is added to a scene, it is placed in the update list for sending to viewers
145// scene.DeleteAllSceneObjects(); 152 // (though in this case we have none). When it is deleted, it is not removed from the update which is
153 // fine since it will later be ignored.
154 //
155 // However, that means that we need to manually run an update here to clear out that list so that deleted
156 // objects will be clean up by the garbage collector before the next stress test is run.
157 scene.Update();
158
159 // Currently, we need to do this in order to garbage collect the scene objects ready for the next test run.
160 // However, what we really need to do is find out why the entire scene is not garbage collected in
161 // teardown.
162 scene.DeleteAllSceneObjects();
146 163
147 Console.WriteLine( 164 Console.WriteLine(
148 "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)", 165 "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)",