aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2013-08-17 03:23:45 +0100
committerMelanie2013-08-17 03:23:45 +0100
commitbef03fb30be67dbe671dcc330558daf8a6c4bb22 (patch)
tree6d221db8af5bdb1a09190527a79aae3dfe3116d9
parentMerge branch 'master' into careminster (diff)
parentRemove mono compiler warnings from UserProfilesModule (diff)
downloadopensim-SC-bef03fb30be67dbe671dcc330558daf8a6c4bb22.zip
opensim-SC-bef03fb30be67dbe671dcc330558daf8a6c4bb22.tar.gz
opensim-SC-bef03fb30be67dbe671dcc330558daf8a6c4bb22.tar.bz2
opensim-SC-bef03fb30be67dbe671dcc330558daf8a6c4bb22.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs45
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs90
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs155
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs6
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs8
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs12
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs6
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs10
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs8
-rw-r--r--OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs43
-rw-r--r--OpenSim/Tools/pCampBot/Bot.cs8
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs1
28 files changed, 416 insertions, 171 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 729667c..f3490fb 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -439,18 +439,26 @@ namespace OpenSim.ApplicationPlugins.RemoteController
439 // k, (string)requestData[k], ((string)requestData[k]).Length); 439 // k, (string)requestData[k], ((string)requestData[k]).Length);
440 // } 440 // }
441 441
442 CheckStringParameters(requestData, responseData, new string[] {"filename", "regionid"}); 442 CheckStringParameters(requestData, responseData, new string[] { "filename" });
443 CheckRegionParams(requestData, responseData); 443 CheckRegionParams(requestData, responseData);
444 444
445 Scene scene = null; 445 Scene scene = null;
446 GetSceneFromRegionParams(requestData, responseData, out scene); 446 GetSceneFromRegionParams(requestData, responseData, out scene);
447 string file = (string)requestData["filename"];
448 447
449 responseData["accepted"] = true; 448 if (scene != null)
449 {
450 string file = (string)requestData["filename"];
450 451
451 LoadHeightmap(file, scene.RegionInfo.RegionID); 452 responseData["accepted"] = true;
452 453
453 responseData["success"] = true; 454 LoadHeightmap(file, scene.RegionInfo.RegionID);
455
456 responseData["success"] = true;
457 }
458 else
459 {
460 responseData["success"] = false;
461 }
454 462
455 m_log.Info("[RADMIN]: Load height maps request complete"); 463 m_log.Info("[RADMIN]: Load height maps request complete");
456 } 464 }
@@ -464,23 +472,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController
464 472
465// m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString()); 473// m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString());
466 474
467 CheckStringParameters(requestData, responseData, new string[] { "filename", "regionid" }); 475 CheckStringParameters(requestData, responseData, new string[] { "filename" });
468 CheckRegionParams(requestData, responseData); 476 CheckRegionParams(requestData, responseData);
469 477
470 Scene region = null; 478 Scene scene = null;
471 GetSceneFromRegionParams(requestData, responseData, out region); 479 GetSceneFromRegionParams(requestData, responseData, out scene);
472 480
473 string file = (string)requestData["filename"]; 481 if (scene != null)
474 m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file); 482 {
483 string file = (string)requestData["filename"];
484 m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file);
475 485
476 responseData["accepted"] = true; 486 responseData["accepted"] = true;
477 487
478 ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); 488 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
479 if (null == terrainModule) throw new Exception("terrain module not available"); 489 if (null == terrainModule) throw new Exception("terrain module not available");
480 490
481 terrainModule.SaveToFile(file); 491 terrainModule.SaveToFile(file);
482 492
483 responseData["success"] = true; 493 responseData["success"] = true;
494 }
495 else
496 {
497 responseData["success"] = false;
498 }
484 499
485 m_log.Info("[RADMIN]: Save height maps request complete"); 500 m_log.Info("[RADMIN]: Save height maps request complete");
486 } 501 }
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 7cf1fa7..05ee4c5 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -267,7 +267,7 @@ namespace OpenSim.Framework.Monitoring
267 public static Hashtable HandleStatsRequest(Hashtable request) 267 public static Hashtable HandleStatsRequest(Hashtable request)
268 { 268 {
269 Hashtable responsedata = new Hashtable(); 269 Hashtable responsedata = new Hashtable();
270 string regpath = request["uri"].ToString(); 270// string regpath = request["uri"].ToString();
271 int response_code = 200; 271 int response_code = 200;
272 string contenttype = "text/json"; 272 string contenttype = "text/json";
273 273
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs
index 9f2aed0..10a4753 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs
@@ -123,7 +123,7 @@ namespace OpenSim.Region.ClientStack.Linden
123 123
124 if (m_URL == "localhost") 124 if (m_URL == "localhost")
125 { 125 {
126 m_log.DebugFormat("[AVATAR PICKER SEARCH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); 126// m_log.DebugFormat("[AVATAR PICKER SEARCH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
127 caps.RegisterHandler( 127 caps.RegisterHandler(
128 "AvatarPickerSearch", 128 "AvatarPickerSearch",
129 new AvatarPickerSearchHandler("/CAPS/" + capID + "/", m_People, "AvatarPickerSearch", "Search for avatars by name")); 129 new AvatarPickerSearchHandler("/CAPS/" + capID + "/", m_People, "AvatarPickerSearch", "Search for avatars by name"));
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 0431b53..ad3f715 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -108,6 +108,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
108 108
109 StatsManager.RegisterStat( 109 StatsManager.RegisterStat(
110 new Stat( 110 new Stat(
111 "IncomingPacketsMalformedCount",
112 "Number of inbound UDP packets that could not be recognized as LL protocol packets.",
113 "",
114 "",
115 "clientstack",
116 scene.Name,
117 StatType.Pull,
118 MeasuresOfInterest.AverageChangeOverTime,
119 stat => stat.Value = m_udpServer.IncomingMalformedPacketCount,
120 StatVerbosity.Info));
121
122 StatsManager.RegisterStat(
123 new Stat(
124 "IncomingPacketsOrphanedCount",
125 "Number of inbound packets that were not initial connections packets and could not be associated with a viewer.",
126 "",
127 "",
128 "clientstack",
129 scene.Name,
130 StatType.Pull,
131 MeasuresOfInterest.AverageChangeOverTime,
132 stat => stat.Value = m_udpServer.IncomingOrphanedPacketCount,
133 StatVerbosity.Info));
134
135 StatsManager.RegisterStat(
136 new Stat(
111 "OutgoingUDPSendsCount", 137 "OutgoingUDPSendsCount",
112 "Number of UDP sends performed", 138 "Number of UDP sends performed",
113 "", 139 "",
@@ -272,7 +298,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
272 298
273 public Socket Server { get { return null; } } 299 public Socket Server { get { return null; } }
274 300
275 private int m_malformedCount = 0; // Guard against a spamming attack 301 /// <summary>
302 /// Record how many inbound packets could not be recognized as LLUDP packets.
303 /// </summary>
304 public int IncomingMalformedPacketCount { get; private set; }
305
306 /// <summary>
307 /// Record how many inbound packets could not be associated with a simulator circuit.
308 /// </summary>
309 public int IncomingOrphanedPacketCount { get; private set; }
276 310
277 /// <summary> 311 /// <summary>
278 /// Record current outgoing client for monitoring purposes. 312 /// Record current outgoing client for monitoring purposes.
@@ -1193,6 +1227,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1193 outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; 1227 outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue;
1194 } 1228 }
1195 1229
1230 private void RecordMalformedInboundPacket(IPEndPoint endPoint)
1231 {
1232// if (m_malformedCount < 100)
1233// m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString());
1234
1235 IncomingMalformedPacketCount++;
1236
1237 if ((IncomingMalformedPacketCount % 10000) == 0)
1238 m_log.WarnFormat(
1239 "[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack. Last was from {1}",
1240 IncomingMalformedPacketCount, endPoint);
1241 }
1242
1196 public override void PacketReceived(UDPPacketBuffer buffer) 1243 public override void PacketReceived(UDPPacketBuffer buffer)
1197 { 1244 {
1198 // Debugging/Profiling 1245 // Debugging/Profiling
@@ -1214,6 +1261,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1214// "[LLUDPSERVER]: Dropping undersized packet with {0} bytes received from {1} in {2}", 1261// "[LLUDPSERVER]: Dropping undersized packet with {0} bytes received from {1} in {2}",
1215// buffer.DataLength, buffer.RemoteEndPoint, m_scene.RegionInfo.RegionName); 1262// buffer.DataLength, buffer.RemoteEndPoint, m_scene.RegionInfo.RegionName);
1216 1263
1264 RecordMalformedInboundPacket(endPoint);
1265
1217 return; // Drop undersized packet 1266 return; // Drop undersized packet
1218 } 1267 }
1219 1268
@@ -1232,6 +1281,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1232// "[LLUDPSERVER]: Dropping packet with malformed header received from {0} in {1}", 1281// "[LLUDPSERVER]: Dropping packet with malformed header received from {0} in {1}",
1233// buffer.RemoteEndPoint, m_scene.RegionInfo.RegionName); 1282// buffer.RemoteEndPoint, m_scene.RegionInfo.RegionName);
1234 1283
1284 RecordMalformedInboundPacket(endPoint);
1285
1235 return; // Malformed header 1286 return; // Malformed header
1236 } 1287 }
1237 1288
@@ -1247,34 +1298,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1247 // Only allocate a buffer for zerodecoding if the packet is zerocoded 1298 // Only allocate a buffer for zerodecoding if the packet is zerocoded
1248 ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); 1299 ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null);
1249 } 1300 }
1250 catch (MalformedDataException)
1251 {
1252 }
1253 catch (IndexOutOfRangeException)
1254 {
1255// m_log.WarnFormat(
1256// "[LLUDPSERVER]: Dropping short packet received from {0} in {1}",
1257// buffer.RemoteEndPoint, m_scene.RegionInfo.RegionName);
1258
1259 return; // Drop short packet
1260 }
1261 catch (Exception e) 1301 catch (Exception e)
1262 { 1302 {
1263 if (m_malformedCount < 100) 1303 if (IncomingMalformedPacketCount < 100)
1264 m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); 1304 m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString());
1265
1266 m_malformedCount++;
1267
1268 if ((m_malformedCount % 100000) == 0)
1269 m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount);
1270 } 1305 }
1271 1306
1272 // Fail-safe check 1307 // Fail-safe check
1273 if (packet == null) 1308 if (packet == null)
1274 { 1309 {
1275 m_log.ErrorFormat("[LLUDPSERVER]: Malformed data, cannot parse {0} byte packet from {1}:", 1310 if (IncomingMalformedPacketCount < 100)
1276 buffer.DataLength, buffer.RemoteEndPoint); 1311 {
1277 m_log.Error(Utils.BytesToHexString(buffer.Data, buffer.DataLength, null)); 1312 m_log.WarnFormat("[LLUDPSERVER]: Malformed data, cannot parse {0} byte packet from {1}, data {2}:",
1313 buffer.DataLength, buffer.RemoteEndPoint, Utils.BytesToHexString(buffer.Data, buffer.DataLength, null));
1314 }
1315
1316 RecordMalformedInboundPacket(endPoint);
1317
1278 return; 1318 return;
1279 } 1319 }
1280 1320
@@ -1337,6 +1377,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1337 if (client == null || !(client is LLClientView)) 1377 if (client == null || !(client is LLClientView))
1338 { 1378 {
1339 //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); 1379 //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
1380
1381 IncomingOrphanedPacketCount++;
1382
1383 if ((IncomingOrphanedPacketCount % 10000) == 0)
1384 m_log.WarnFormat(
1385 "[LLUDPSERVER]: Received {0} orphaned packets so far. Last was from {1}",
1386 IncomingOrphanedPacketCount, endPoint);
1387
1340 return; 1388 return;
1341 } 1389 }
1342 1390
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
index 1fdc410..5a2bcee 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
@@ -145,39 +145,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
145 return packet; 145 return packet;
146 } 146 }
147 147
148 // private byte[] decoded_header = new byte[10];
149 private static PacketType GetType(byte[] bytes) 148 private static PacketType GetType(byte[] bytes)
150 { 149 {
151 byte[] decoded_header = new byte[10 + 8];
152 ushort id; 150 ushort id;
153 PacketFrequency freq; 151 PacketFrequency freq;
152 bool isZeroCoded = (bytes[0] & Helpers.MSG_ZEROCODED) != 0;
154 153
155 if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0) 154 if (bytes[6] == 0xFF)
156 { 155 {
157 Helpers.ZeroDecode(bytes, 16, decoded_header); 156 if (bytes[7] == 0xFF)
158 }
159 else
160 {
161 Buffer.BlockCopy(bytes, 0, decoded_header, 0, 10);
162 }
163
164 if (decoded_header[6] == 0xFF)
165 {
166 if (decoded_header[7] == 0xFF)
167 { 157 {
168 id = (ushort) ((decoded_header[8] << 8) + decoded_header[9]);
169 freq = PacketFrequency.Low; 158 freq = PacketFrequency.Low;
159 if (isZeroCoded && bytes[8] == 0)
160 id = bytes[10];
161 else
162 id = (ushort)((bytes[8] << 8) + bytes[9]);
170 } 163 }
171 else 164 else
172 { 165 {
173 id = decoded_header[7];
174 freq = PacketFrequency.Medium; 166 freq = PacketFrequency.Medium;
167 id = bytes[7];
175 } 168 }
176 } 169 }
177 else 170 else
178 { 171 {
179 id = decoded_header[6];
180 freq = PacketFrequency.High; 172 freq = PacketFrequency.High;
173 id = bytes[6];
181 } 174 }
182 175
183 return Packet.GetType(id, freq); 176 return Packet.GetType(id, freq);
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 62b25d0..95cc6b7 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -361,22 +361,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
361 361
362 // If we're an NPC then skip all the item checks and manipulations since we don't have an 362 // If we're an NPC then skip all the item checks and manipulations since we don't have an
363 // inventory right now. 363 // inventory right now.
364 SceneObjectGroup objatt 364 RezSingleAttachmentFromInventoryInternal(
365 = RezSingleAttachmentFromInventoryInternal(
366 sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, attachmentPt, true, d); 365 sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, attachmentPt, true, d);
367
368
369 if (ThrottlePer100PrimsRezzed > 0)
370 {
371 int throttleMs = (int)Math.Round((float)objatt.PrimCount / 100 * ThrottlePer100PrimsRezzed);
372
373 if (DebugLevel > 0)
374 m_log.DebugFormat(
375 "[ATTACHMENTS MODULE]: Throttling by {0}ms after rez of {1} with {2} prims for attachment to {3} on point {4} in {5}",
376 throttleMs, objatt.Name, objatt.PrimCount, sp.Name, attachmentPt, m_scene.Name);
377
378 Thread.Sleep(throttleMs);
379 }
380 } 366 }
381 catch (Exception e) 367 catch (Exception e)
382 { 368 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 35045b5..62acd78 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -844,7 +844,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
844 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); 844 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
845 TestClient tc = new TestClient(acd, sceneA); 845 TestClient tc = new TestClient(acd, sceneA);
846 List<TestClient> destinationTestClients = new List<TestClient>(); 846 List<TestClient> destinationTestClients = new List<TestClient>();
847 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 847 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
848 848
849 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd); 849 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
850 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); 850 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);
@@ -925,7 +925,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
925 IConfig modulesConfig = config.AddConfig("Modules"); 925 IConfig modulesConfig = config.AddConfig("Modules");
926 modulesConfig.Set("EntityTransferModule", etmA.Name); 926 modulesConfig.Set("EntityTransferModule", etmA.Name);
927 modulesConfig.Set("SimulationServices", lscm.Name); 927 modulesConfig.Set("SimulationServices", lscm.Name);
928 IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
929 928
930 modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule"); 929 modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule");
931 930
@@ -944,7 +943,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
944 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); 943 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
945 TestClient tc = new TestClient(acd, sceneA); 944 TestClient tc = new TestClient(acd, sceneA);
946 List<TestClient> destinationTestClients = new List<TestClient>(); 945 List<TestClient> destinationTestClients = new List<TestClient>();
947 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 946 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
948 947
949 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd); 948 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
950 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); 949 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);
@@ -966,7 +965,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
966 // Both these operations will occur on different threads and will wait for each other. 965 // Both these operations will occur on different threads and will wait for each other.
967 // We have to do this via ThreadPool directly since FireAndForget has been switched to sync for the V1 966 // We have to do this via ThreadPool directly since FireAndForget has been switched to sync for the V1
968 // test protocol, where we are trying to avoid unpredictable async operations in regression tests. 967 // test protocol, where we are trying to avoid unpredictable async operations in regression tests.
969 ((TestClient)beforeTeleportSp.ControllingClient).OnTestClientSendRegionTeleport 968 tc.OnTestClientSendRegionTeleport
970 += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) 969 += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL)
971 => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null); 970 => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null);
972 971
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index c04098c..966a05c 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -307,7 +307,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
307 } 307 }
308 308
309 string serverURI = string.Empty; 309 string serverURI = string.Empty;
310 bool foreign = GetUserProfileServerURI(targetID, out serverURI); 310 GetUserProfileServerURI(targetID, out serverURI);
311 UUID creatorId = UUID.Zero; 311 UUID creatorId = UUID.Zero;
312 312
313 OSDMap parameters= new OSDMap(); 313 OSDMap parameters= new OSDMap();
@@ -372,7 +372,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
372 } 372 }
373 373
374 string serverURI = string.Empty; 374 string serverURI = string.Empty;
375 bool foreign = GetUserProfileServerURI(target, out serverURI); 375 GetUserProfileServerURI(target, out serverURI);
376 376
377 object Ad = (object)ad; 377 object Ad = (object)ad;
378 if(!JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString())) 378 if(!JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString()))
@@ -441,10 +441,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
441 Vector3 pos = remoteClient.SceneAgent.AbsolutePosition; 441 Vector3 pos = remoteClient.SceneAgent.AbsolutePosition;
442 ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y); 442 ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);
443 ScenePresence p = FindPresence(remoteClient.AgentId); 443 ScenePresence p = FindPresence(remoteClient.AgentId);
444 Vector3 avaPos = p.AbsolutePosition; 444// Vector3 avaPos = p.AbsolutePosition;
445 445
446 string serverURI = string.Empty; 446 string serverURI = string.Empty;
447 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 447 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
448 448
449 if (land == null) 449 if (land == null)
450 { 450 {
@@ -470,7 +470,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
470 470
471 object Ad = ad; 471 object Ad = ad;
472 472
473 OSD X = OSD.SerializeMembers(Ad); 473 OSD.SerializeMembers(Ad);
474 474
475 if(!JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString())) 475 if(!JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString()))
476 { 476 {
@@ -491,7 +491,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
491 public void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient) 491 public void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient)
492 { 492 {
493 string serverURI = string.Empty; 493 string serverURI = string.Empty;
494 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 494 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
495 495
496 UUID classifiedId; 496 UUID classifiedId;
497 OSDMap parameters= new OSDMap(); 497 OSDMap parameters= new OSDMap();
@@ -541,7 +541,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
541 } 541 }
542 542
543 string serverURI = string.Empty; 543 string serverURI = string.Empty;
544 bool foreign = GetUserProfileServerURI(targetId, out serverURI); 544 GetUserProfileServerURI(targetId, out serverURI);
545 545
546 OSDMap parameters= new OSDMap(); 546 OSDMap parameters= new OSDMap();
547 parameters.Add("creatorId", OSD.FromUUID(targetId)); 547 parameters.Add("creatorId", OSD.FromUUID(targetId));
@@ -592,7 +592,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
592 UUID targetID; 592 UUID targetID;
593 UUID.TryParse(args[0], out targetID); 593 UUID.TryParse(args[0], out targetID);
594 string serverURI = string.Empty; 594 string serverURI = string.Empty;
595 bool foreign = GetUserProfileServerURI(targetID, out serverURI); 595 GetUserProfileServerURI(targetID, out serverURI);
596 IClientAPI remoteClient = (IClientAPI)sender; 596 IClientAPI remoteClient = (IClientAPI)sender;
597 597
598 UserProfilePick pick = new UserProfilePick(); 598 UserProfilePick pick = new UserProfilePick();
@@ -660,7 +660,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
660 m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); 660 m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString());
661 UserProfilePick pick = new UserProfilePick(); 661 UserProfilePick pick = new UserProfilePick();
662 string serverURI = string.Empty; 662 string serverURI = string.Empty;
663 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 663 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
664 ScenePresence p = FindPresence(remoteClient.AgentId); 664 ScenePresence p = FindPresence(remoteClient.AgentId);
665 665
666 Vector3 avaPos = p.AbsolutePosition; 666 Vector3 avaPos = p.AbsolutePosition;
@@ -720,7 +720,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
720 public void PickDelete(IClientAPI remoteClient, UUID queryPickID) 720 public void PickDelete(IClientAPI remoteClient, UUID queryPickID)
721 { 721 {
722 string serverURI = string.Empty; 722 string serverURI = string.Empty;
723 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 723 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
724 724
725 OSDMap parameters= new OSDMap(); 725 OSDMap parameters= new OSDMap();
726 parameters.Add("pickId", OSD.FromUUID(queryPickID)); 726 parameters.Add("pickId", OSD.FromUUID(queryPickID));
@@ -755,7 +755,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
755 755
756 IClientAPI remoteClient = (IClientAPI)sender; 756 IClientAPI remoteClient = (IClientAPI)sender;
757 string serverURI = string.Empty; 757 string serverURI = string.Empty;
758 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 758 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
759 note.TargetId = remoteClient.AgentId; 759 note.TargetId = remoteClient.AgentId;
760 UUID.TryParse(args[0], out note.UserId); 760 UUID.TryParse(args[0], out note.UserId);
761 761
@@ -791,7 +791,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
791 note.Notes = queryNotes; 791 note.Notes = queryNotes;
792 792
793 string serverURI = string.Empty; 793 string serverURI = string.Empty;
794 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 794 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
795 795
796 object Note = note; 796 object Note = note;
797 if(!JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString())) 797 if(!JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString()))
@@ -836,7 +836,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
836 prop.Language = languages; 836 prop.Language = languages;
837 837
838 string serverURI = string.Empty; 838 string serverURI = string.Empty;
839 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 839 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
840 840
841 object Param = prop; 841 object Param = prop;
842 if(!JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString())) 842 if(!JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString()))
@@ -958,7 +958,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
958 prop.FirstLifeText = newProfile.FirstLifeAboutText; 958 prop.FirstLifeText = newProfile.FirstLifeAboutText;
959 959
960 string serverURI = string.Empty; 960 string serverURI = string.Empty;
961 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 961 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
962 962
963 object Prop = prop; 963 object Prop = prop;
964 964
@@ -972,7 +972,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
972 } 972 }
973 } 973 }
974 974
975
976 /// <summary> 975 /// <summary>
977 /// Gets the profile data. 976 /// Gets the profile data.
978 /// </summary> 977 /// </summary>
@@ -997,7 +996,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
997 } 996 }
998 997
999 string serverURI = string.Empty; 998 string serverURI = string.Empty;
1000 bool foreign = GetUserProfileServerURI(properties.UserId, out serverURI); 999 GetUserProfileServerURI(properties.UserId, out serverURI);
1001 1000
1002 // This is checking a friend on the home grid 1001 // This is checking a friend on the home grid
1003 // Not HG friend 1002 // Not HG friend
@@ -1245,11 +1244,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1245 return false; 1244 return false;
1246 } 1245 }
1247 1246
1248 byte[] buf = new byte[8192];
1249 Stream rstream = webResponse.GetResponseStream(); 1247 Stream rstream = webResponse.GetResponseStream();
1250 OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream); 1248 OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream);
1251 1249
1252 if(mret.ContainsKey("error")) 1250 if (mret.ContainsKey("error"))
1253 return false; 1251 return false;
1254 1252
1255 // get params... 1253 // get params...
@@ -1311,7 +1309,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1311 return false; 1309 return false;
1312 } 1310 }
1313 1311
1314 byte[] buf = new byte[8192];
1315 Stream rstream = webResponse.GetResponseStream(); 1312 Stream rstream = webResponse.GetResponseStream();
1316 1313
1317 OSDMap response = new OSDMap(); 1314 OSDMap response = new OSDMap();
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 711167f..6ff9988 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -317,7 +317,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
317 "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2}@{3} - agent is already in transit.", 317 "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2}@{3} - agent is already in transit.",
318 sp.Name, sp.UUID, position, regionHandle); 318 sp.Name, sp.UUID, position, regionHandle);
319 319
320 sp.ControllingClient.SendTeleportFailed("Slow down!"); 320 sp.ControllingClient.SendTeleportFailed("Previous teleport process incomplete. Please retry shortly.");
321
321 return; 322 return;
322 } 323 }
323 324
@@ -1034,6 +1035,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1034 agent.SenderWantsToWaitForRoot = true; 1035 agent.SenderWantsToWaitForRoot = true;
1035 //SetCallbackURL(agent, sp.Scene.RegionInfo); 1036 //SetCallbackURL(agent, sp.Scene.RegionInfo);
1036 1037
1038 // Reset the do not close flag. This must be done before the destination opens child connections (here
1039 // triggered by UpdateAgent) to avoid race conditions. However, we also want to reset it as late as possible
1040 // to avoid a situation where an unexpectedly early call to Scene.NewUserConnection() wrongly results
1041 // in no close.
1042 sp.DoNotCloseAfterTeleport = false;
1043
1037 // Send the Update. If this returns true, we know the client has contacted the destination 1044 // Send the Update. If this returns true, we know the client has contacted the destination
1038 // via CompleteMovementIntoRegion, so we can let go. 1045 // via CompleteMovementIntoRegion, so we can let go.
1039 // If it returns false, something went wrong, and we need to abort. 1046 // If it returns false, something went wrong, and we need to abort.
@@ -1060,6 +1067,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1060 1067
1061 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); 1068 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
1062 1069
1070 // Need to signal neighbours whether child agents may need closing irrespective of whether this
1071 // one needed closing. We also need to close child agents as quickly as possible to avoid complicated
1072 // race conditions with rapid agent releporting (e.g. from A1 to a non-neighbour B, back
1073 // to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex
1074 // distributed checks to avoid problems in rapid reteleporting scenarios and where child agents are
1075 // abandoned without proper close by viewer but then re-used by an incoming connection.
1076 sp.CloseChildAgents(newRegionX, newRegionY);
1077
1063 // May need to logout or other cleanup 1078 // May need to logout or other cleanup
1064 AgentHasMovedAway(sp, logout); 1079 AgentHasMovedAway(sp, logout);
1065 1080
@@ -1069,22 +1084,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1069 // Now let's make it officially a child agent 1084 // Now let's make it officially a child agent
1070 sp.MakeChildAgent(); 1085 sp.MakeChildAgent();
1071 1086
1072 // May still need to signal neighbours whether child agents may need closing irrespective of whether this
1073 // one needed closing. Neighbour regions also contain logic to prevent a close if a subsequent move or
1074 // teleport re-established the child connection.
1075 //
1076 // It may be possible to also close child agents after a pause but one needs to be very careful about
1077 // race conditions between different regions on rapid teleporting (e.g. from A1 to a non-neighbour B, back
1078 // to a neighbour A2 then off to a non-neighbour C. Also, closing child agents early may be more compatible
1079 // with complicated scenarios where there a mixture of V1 and V2 teleports, though this is conjecture. It's
1080 // easier to close immediately and greatly reduce the scope of race conditions if possible.
1081 sp.CloseChildAgents(newRegionX, newRegionY);
1082
1083 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 1087 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
1084 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 1088 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
1085 { 1089 {
1086 sp.DoNotCloseAfterTeleport = false;
1087
1088 // RED ALERT!!!! 1090 // RED ALERT!!!!
1089 // PLEASE DO NOT DECREASE THIS WAIT TIME UNDER ANY CIRCUMSTANCES. 1091 // PLEASE DO NOT DECREASE THIS WAIT TIME UNDER ANY CIRCUMSTANCES.
1090 // THE VIEWERS SEEM TO NEED SOME TIME AFTER RECEIVING MoveAgentIntoRegion 1092 // THE VIEWERS SEEM TO NEED SOME TIME AFTER RECEIVING MoveAgentIntoRegion
@@ -1093,17 +1095,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1093 // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS. 1095 // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS.
1094 Thread.Sleep(15000); 1096 Thread.Sleep(15000);
1095 1097
1096 if (!sp.DoNotCloseAfterTeleport) 1098 // OK, it got this agent. Let's close everything
1097 { 1099 // If we shouldn't close the agent due to some other region renewing the connection
1098 // OK, it got this agent. Let's close everything 1100 // then this will be handled in IncomingCloseAgent under lock conditions
1099 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Closing agent {0} in {1}", sp.Name, Scene.Name); 1101 m_log.DebugFormat(
1100 sp.Scene.IncomingCloseAgent(sp.UUID, false); 1102 "[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport", sp.Name, Scene.Name);
1101 } 1103 sp.Scene.IncomingCloseAgent(sp.UUID, false);
1102 else
1103 {
1104 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Not closing agent {0}, user is back in {1}", sp.Name, Scene.Name);
1105 sp.DoNotCloseAfterTeleport = false;
1106 }
1107 } 1104 }
1108 else 1105 else
1109 { 1106 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4fa4a7c..56bdc63 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3862,21 +3862,30 @@ namespace OpenSim.Region.Framework.Scenes
3862 // In the case where, for example, an A B C D region layout, an avatar may 3862 // In the case where, for example, an A B C D region layout, an avatar may
3863 // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C 3863 // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C
3864 // renews the lease on the child agent at B, we must make sure that the close from A does not succeed. 3864 // renews the lease on the child agent at B, we must make sure that the close from A does not succeed.
3865 if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle)) 3865 //
3866 { 3866 // XXX: In the end, this should not be necessary if child agents are closed without delay on
3867 m_log.DebugFormat( 3867 // teleport, since realistically, the close request should always be processed before any other
3868 "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.", 3868 // region tried to re-establish a child agent. This is much simpler since the logic below is
3869 sp.Name, Name); 3869 // vulnerable to an issue when a viewer quits a region without sending a proper logout but then
3870 // re-establishes the connection on a relogin. This could wrongly set the DoNotCloseAfterTeleport
3871 // flag when no teleport had taken place (and hence no close was going to come).
3872// if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle))
3873// {
3874// m_log.DebugFormat(
3875// "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.",
3876// sp.Name, Name);
3877//
3878// sp.DoNotCloseAfterTeleport = true;
3879// }
3880// else if (EntityTransferModule.IsInTransit(sp.UUID))
3870 3881
3871 sp.DoNotCloseAfterTeleport = true; 3882 if (EntityTransferModule.IsInTransit(sp.UUID))
3872 }
3873 else if (EntityTransferModule.IsInTransit(sp.UUID))
3874 { 3883 {
3884 sp.DoNotCloseAfterTeleport = true;
3885
3875 m_log.DebugFormat( 3886 m_log.DebugFormat(
3876 "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt previous end-of-teleport close.", 3887 "[SCENE]: Set DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt end-of-teleport close from a previous close.",
3877 sp.Name, Name); 3888 sp.Name, Name);
3878
3879 sp.DoNotCloseAfterTeleport = true;
3880 } 3889 }
3881 } 3890 }
3882 } 3891 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5301a82..3f4979e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -223,7 +223,7 @@ namespace OpenSim.Region.Framework.Scenes
223 private float m_sitAvatarHeight = 2.0f; 223 private float m_sitAvatarHeight = 2.0f;
224 224
225 private Vector3 m_lastChildAgentUpdatePosition; 225 private Vector3 m_lastChildAgentUpdatePosition;
226 private Vector3 m_lastChildAgentUpdateCamPosition; 226// private Vector3 m_lastChildAgentUpdateCamPosition;
227 227
228 private const int LAND_VELOCITYMAG_MAX = 12; 228 private const int LAND_VELOCITYMAG_MAX = 12;
229 229
@@ -2108,8 +2108,7 @@ namespace OpenSim.Region.Framework.Scenes
2108 if (m_movementUpdateCount < 1) 2108 if (m_movementUpdateCount < 1)
2109 m_movementUpdateCount = 1; 2109 m_movementUpdateCount = 1;
2110 2110
2111 2111// AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags;
2112 AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags;
2113 2112
2114 // Camera location in world. We'll need to raytrace 2113 // Camera location in world. We'll need to raytrace
2115 // from this location from time to time. 2114 // from this location from time to time.
@@ -3241,7 +3240,7 @@ namespace OpenSim.Region.Framework.Scenes
3241 if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance) 3240 if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance)
3242 { 3241 {
3243 m_lastChildAgentUpdatePosition = AbsolutePosition; 3242 m_lastChildAgentUpdatePosition = AbsolutePosition;
3244 m_lastChildAgentUpdateCamPosition = CameraPosition; 3243// m_lastChildAgentUpdateCamPosition = CameraPosition;
3245 3244
3246 ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); 3245 ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
3247 cadu.ActiveGroupID = UUID.Zero.Guid; 3246 cadu.ActiveGroupID = UUID.Zero.Guid;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index d670dad..5b5fb92 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
147 AgentCircuitData acd = SceneHelpers.GenerateAgentData(uaB); 147 AgentCircuitData acd = SceneHelpers.GenerateAgentData(uaB);
148 TestClient clientB = new TestClient(acd, sceneB); 148 TestClient clientB = new TestClient(acd, sceneB);
149 List<TestClient> childClientsB = new List<TestClient>(); 149 List<TestClient> childClientsB = new List<TestClient>();
150 EntityTransferHelpers.SetUpInformClientOfNeighbour(clientB, childClientsB); 150 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(clientB, childClientsB);
151 151
152 SceneHelpers.AddScenePresence(sceneB, clientB, acd); 152 SceneHelpers.AddScenePresence(sceneB, clientB, acd);
153 153
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index 5df9aba..12a778b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
97 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); 97 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
98 TestClient tc = new TestClient(acd, sceneA); 98 TestClient tc = new TestClient(acd, sceneA);
99 List<TestClient> destinationTestClients = new List<TestClient>(); 99 List<TestClient> destinationTestClients = new List<TestClient>();
100 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 100 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
101 101
102 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd); 102 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
103 originalSp.AbsolutePosition = new Vector3(128, 32, 10); 103 originalSp.AbsolutePosition = new Vector3(128, 32, 10);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index afd2779..8c25dbc 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Net; 31using System.Net;
32using System.Text; 32using System.Text;
33using System.Threading;
33using Nini.Config; 34using Nini.Config;
34using NUnit.Framework; 35using NUnit.Framework;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -107,7 +108,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
107 } 108 }
108 109
109 [Test] 110 [Test]
110 public void TestSameSimulatorIsolatedRegions() 111 public void TestSameSimulatorIsolatedRegionsV1()
111 { 112 {
112 TestHelpers.InMethod(); 113 TestHelpers.InMethod();
113// TestHelpers.EnableLogging(); 114// TestHelpers.EnableLogging();
@@ -146,7 +147,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
146 sp.AbsolutePosition = new Vector3(30, 31, 32); 147 sp.AbsolutePosition = new Vector3(30, 31, 32);
147 148
148 List<TestClient> destinationTestClients = new List<TestClient>(); 149 List<TestClient> destinationTestClients = new List<TestClient>();
149 EntityTransferHelpers.SetUpInformClientOfNeighbour((TestClient)sp.ControllingClient, destinationTestClients); 150 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(
151 (TestClient)sp.ControllingClient, destinationTestClients);
150 152
151 sceneA.RequestTeleportLocation( 153 sceneA.RequestTeleportLocation(
152 sp.ControllingClient, 154 sp.ControllingClient,
@@ -179,6 +181,67 @@ namespace OpenSim.Region.Framework.Scenes.Tests
179// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); 181// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
180 } 182 }
181 183
184 [Test]
185 public void TestSameSimulatorIsolatedRegionsV2()
186 {
187 TestHelpers.InMethod();
188// TestHelpers.EnableLogging();
189
190 UUID userId = TestHelpers.ParseTail(0x1);
191
192 EntityTransferModule etmA = new EntityTransferModule();
193 EntityTransferModule etmB = new EntityTransferModule();
194 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
195
196 IConfigSource config = new IniConfigSource();
197 IConfig modulesConfig = config.AddConfig("Modules");
198 modulesConfig.Set("EntityTransferModule", etmA.Name);
199 modulesConfig.Set("SimulationServices", lscm.Name);
200
201 SceneHelpers sh = new SceneHelpers();
202 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
203 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
204
205 SceneHelpers.SetupSceneModules(sceneA, config, etmA);
206 SceneHelpers.SetupSceneModules(sceneB, config, etmB);
207 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
208
209 Vector3 teleportPosition = new Vector3(10, 11, 12);
210 Vector3 teleportLookAt = new Vector3(20, 21, 22);
211
212 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
213 sp.AbsolutePosition = new Vector3(30, 31, 32);
214
215 List<TestClient> destinationTestClients = new List<TestClient>();
216 EntityTransferHelpers.SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement(
217 (TestClient)sp.ControllingClient, destinationTestClients);
218
219 sceneA.RequestTeleportLocation(
220 sp.ControllingClient,
221 sceneB.RegionInfo.RegionHandle,
222 teleportPosition,
223 teleportLookAt,
224 (uint)TeleportFlags.ViaLocation);
225
226 Assert.That(sceneA.GetScenePresence(userId), Is.Null);
227
228 ScenePresence sceneBSp = sceneB.GetScenePresence(userId);
229 Assert.That(sceneBSp, Is.Not.Null);
230 Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName));
231 Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition));
232
233 Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0));
234 Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0));
235 Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1));
236 Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0));
237
238 // TODO: Add assertions to check correct circuit details in both scenes.
239
240 // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
241 // position instead).
242// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
243 }
244
182 /// <summary> 245 /// <summary>
183 /// Test teleport procedures when the target simulator returns false when queried about access. 246 /// Test teleport procedures when the target simulator returns false when queried about access.
184 /// </summary> 247 /// </summary>
@@ -428,7 +491,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
428 } 491 }
429 492
430 [Test] 493 [Test]
431 public void TestSameSimulatorNeighbouringRegions() 494 public void TestSameSimulatorNeighbouringRegionsV1()
432 { 495 {
433 TestHelpers.InMethod(); 496 TestHelpers.InMethod();
434// TestHelpers.EnableLogging(); 497// TestHelpers.EnableLogging();
@@ -466,7 +529,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
466 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); 529 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
467 TestClient tc = new TestClient(acd, sceneA); 530 TestClient tc = new TestClient(acd, sceneA);
468 List<TestClient> destinationTestClients = new List<TestClient>(); 531 List<TestClient> destinationTestClients = new List<TestClient>();
469 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 532 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
470 533
471 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); 534 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
472 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); 535 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32);
@@ -512,5 +575,89 @@ namespace OpenSim.Region.Framework.Scenes.Tests
512 575
513// TestHelpers.DisableLogging(); 576// TestHelpers.DisableLogging();
514 } 577 }
578
579 [Test]
580 public void TestSameSimulatorNeighbouringRegionsV2()
581 {
582 TestHelpers.InMethod();
583// TestHelpers.EnableLogging();
584
585 UUID userId = TestHelpers.ParseTail(0x1);
586
587 EntityTransferModule etmA = new EntityTransferModule();
588 EntityTransferModule etmB = new EntityTransferModule();
589 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
590
591 IConfigSource config = new IniConfigSource();
592 IConfig modulesConfig = config.AddConfig("Modules");
593 modulesConfig.Set("EntityTransferModule", etmA.Name);
594 modulesConfig.Set("SimulationServices", lscm.Name);
595
596 SceneHelpers sh = new SceneHelpers();
597 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
598 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);
599
600 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
601 SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
602 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
603
604 Vector3 teleportPosition = new Vector3(10, 11, 12);
605 Vector3 teleportLookAt = new Vector3(20, 21, 22);
606
607 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
608 TestClient tc = new TestClient(acd, sceneA);
609 List<TestClient> destinationTestClients = new List<TestClient>();
610 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
611
612 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
613 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32);
614
615 Assert.That(beforeSceneASp, Is.Not.Null);
616 Assert.That(beforeSceneASp.IsChildAgent, Is.False);
617
618 ScenePresence beforeSceneBSp = sceneB.GetScenePresence(userId);
619 Assert.That(beforeSceneBSp, Is.Not.Null);
620 Assert.That(beforeSceneBSp.IsChildAgent, Is.True);
621
622 // Here, we need to make clientA's receipt of SendRegionTeleport trigger clientB's CompleteMovement(). This
623 // is to operate the teleport V2 mechanism where the EntityTransferModule will first request the client to
624 // CompleteMovement to the region and then call UpdateAgent to the destination region to confirm the receipt
625 // Both these operations will occur on different threads and will wait for each other.
626 // We have to do this via ThreadPool directly since FireAndForget has been switched to sync for the V1
627 // test protocol, where we are trying to avoid unpredictable async operations in regression tests.
628 tc.OnTestClientSendRegionTeleport
629 += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL)
630 => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null);
631
632 sceneA.RequestTeleportLocation(
633 beforeSceneASp.ControllingClient,
634 sceneB.RegionInfo.RegionHandle,
635 teleportPosition,
636 teleportLookAt,
637 (uint)TeleportFlags.ViaLocation);
638
639 ScenePresence afterSceneASp = sceneA.GetScenePresence(userId);
640 Assert.That(afterSceneASp, Is.Not.Null);
641 Assert.That(afterSceneASp.IsChildAgent, Is.True);
642
643 ScenePresence afterSceneBSp = sceneB.GetScenePresence(userId);
644 Assert.That(afterSceneBSp, Is.Not.Null);
645 Assert.That(afterSceneBSp.IsChildAgent, Is.False);
646 Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName));
647 Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition));
648
649 Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0));
650 Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1));
651 Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1));
652 Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0));
653
654 // TODO: Add assertions to check correct circuit details in both scenes.
655
656 // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
657 // position instead).
658// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
659
660// TestHelpers.DisableLogging();
661 }
515 } 662 }
516} \ No newline at end of file 663} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
index 5f232a4..68bc1b9 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
@@ -69,7 +69,9 @@ public class BSActorAvatarMove : BSActor
69 // BSActor.Dispose() 69 // BSActor.Dispose()
70 public override void Dispose() 70 public override void Dispose()
71 { 71 {
72 Enabled = false; 72 base.SetEnabled(false);
73 // Now that turned off, remove any state we have in the scene.
74 Refresh();
73 } 75 }
74 76
75 // Called when physical parameters (properties set in Bullet) need to be re-applied. 77 // Called when physical parameters (properties set in Bullet) need to be re-applied.
@@ -181,7 +183,7 @@ public class BSActorAvatarMove : BSActor
181 if (m_controllingPrim.IsColliding) 183 if (m_controllingPrim.IsColliding)
182 { 184 {
183 // If we are colliding with a stationary object, presume we're standing and don't move around 185 // If we are colliding with a stationary object, presume we're standing and don't move around
184 if (!m_controllingPrim.ColliderIsMoving) 186 if (!m_controllingPrim.ColliderIsMoving && !m_controllingPrim.ColliderIsVolumeDetect)
185 { 187 {
186 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID); 188 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID);
187 m_controllingPrim.IsStationary = true; 189 m_controllingPrim.IsStationary = true;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 502f85f..291dfcd 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -107,6 +107,8 @@ public sealed class BSCharacter : BSPhysObject
107 PhysicalActors.Add(AvatarMoveActorName, m_moveActor); 107 PhysicalActors.Add(AvatarMoveActorName, m_moveActor);
108 108
109 SetPhysicalProperties(); 109 SetPhysicalProperties();
110
111 IsInitialized = true;
110 }); 112 });
111 return; 113 return;
112 } 114 }
@@ -114,6 +116,8 @@ public sealed class BSCharacter : BSPhysObject
114 // called when this character is being destroyed and the resources should be released 116 // called when this character is being destroyed and the resources should be released
115 public override void Destroy() 117 public override void Destroy()
116 { 118 {
119 IsInitialized = false;
120
117 base.Destroy(); 121 base.Destroy();
118 122
119 DetailLog("{0},BSCharacter.Destroy", LocalID); 123 DetailLog("{0},BSCharacter.Destroy", LocalID);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 27caf62..9dc52d5 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -72,6 +72,8 @@ public abstract class BSPhysObject : PhysicsActor
72 } 72 }
73 protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName) 73 protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
74 { 74 {
75 IsInitialized = false;
76
75 PhysScene = parentScene; 77 PhysScene = parentScene;
76 LocalID = localID; 78 LocalID = localID;
77 PhysObjectName = name; 79 PhysObjectName = name;
@@ -130,6 +132,9 @@ public abstract class BSPhysObject : PhysicsActor
130 public string PhysObjectName { get; protected set; } 132 public string PhysObjectName { get; protected set; }
131 public string TypeName { get; protected set; } 133 public string TypeName { get; protected set; }
132 134
135 // Set to 'true' when the object is completely initialized.
136 // This mostly prevents property updates and collisions until the object is completely here.
137 public bool IsInitialized { get; protected set; }
133 138
134 // Return the object mass without calculating it or having side effects 139 // Return the object mass without calculating it or having side effects
135 public abstract float RawMass { get; } 140 public abstract float RawMass { get; }
@@ -352,6 +357,8 @@ public abstract class BSPhysObject : PhysicsActor
352 // On a collision, check the collider and remember if the last collider was moving 357 // On a collision, check the collider and remember if the last collider was moving
353 // Used to modify the standing of avatars (avatars on stationary things stand still) 358 // Used to modify the standing of avatars (avatars on stationary things stand still)
354 public bool ColliderIsMoving; 359 public bool ColliderIsMoving;
360 // 'true' if the last collider was a volume detect object
361 public bool ColliderIsVolumeDetect;
355 // Used by BSCharacter to manage standing (and not slipping) 362 // Used by BSCharacter to manage standing (and not slipping)
356 public bool IsStationary; 363 public bool IsStationary;
357 364
@@ -431,6 +438,7 @@ public abstract class BSPhysObject : PhysicsActor
431 438
432 // For movement tests, remember if we are colliding with an object that is moving. 439 // For movement tests, remember if we are colliding with an object that is moving.
433 ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false; 440 ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false;
441 ColliderIsVolumeDetect = collidee != null ? (collidee.IsVolumeDetect) : false;
434 442
435 // Make a collection of the collisions that happened the last simulation tick. 443 // Make a collection of the collisions that happened the last simulation tick.
436 // This is different than the collection created for sending up to the simulator as it is cleared every tick. 444 // This is different than the collection created for sending up to the simulator as it is cleared every tick.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 6b5dea3..d5b999d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -110,6 +110,8 @@ public class BSPrim : BSPhysObject
110 CreateGeomAndObject(true); 110 CreateGeomAndObject(true);
111 111
112 CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody); 112 CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody);
113
114 IsInitialized = true;
113 }); 115 });
114 } 116 }
115 117
@@ -117,6 +119,8 @@ public class BSPrim : BSPhysObject
117 public override void Destroy() 119 public override void Destroy()
118 { 120 {
119 // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID); 121 // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID);
122 IsInitialized = false;
123
120 base.Destroy(); 124 base.Destroy();
121 125
122 // Undo any vehicle properties 126 // Undo any vehicle properties
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 79ac5a5..88d50b4 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -639,7 +639,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
639 BSPhysObject pobj; 639 BSPhysObject pobj;
640 if (PhysObjects.TryGetValue(entprop.ID, out pobj)) 640 if (PhysObjects.TryGetValue(entprop.ID, out pobj))
641 { 641 {
642 pobj.UpdateProperties(entprop); 642 if (pobj.IsInitialized)
643 pobj.UpdateProperties(entprop);
643 } 644 }
644 } 645 }
645 } 646 }
@@ -766,10 +767,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
766 767
767 // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); 768 // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
768 769
769 if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration)) 770 if (collider.IsInitialized)
770 { 771 {
771 // If a collision was 'good', remember to send it to the simulator 772 if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration))
772 ObjectsWithCollisions.Add(collider); 773 {
774 // If a collision was 'good', remember to send it to the simulator
775 ObjectsWithCollisions.Add(collider);
776 }
773 } 777 }
774 778
775 return; 779 return;
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index f37f2f1..04bb9e8 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
85 data.destinationServerURI = args["destination_serveruri"]; 85 data.destinationServerURI = args["destination_serveruri"];
86 86
87 } 87 }
88 catch (InvalidCastException e) 88 catch (InvalidCastException)
89 { 89 {
90 m_log.ErrorFormat("[HOME AGENT HANDLER]: Bad cast in UnpackData"); 90 m_log.ErrorFormat("[HOME AGENT HANDLER]: Bad cast in UnpackData");
91 } 91 }
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index d9c1bd3..7137836 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -453,7 +453,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
453 XmlRpcResponse response = new XmlRpcResponse(); 453 XmlRpcResponse response = new XmlRpcResponse();
454 response.Value = hash; 454 response.Value = hash;
455 return response; 455 return response;
456
457 } 456 }
458 457
459 /// <summary> 458 /// <summary>
@@ -471,9 +470,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
471 //string portstr = (string)requestData["port"]; 470 //string portstr = (string)requestData["port"];
472 if (requestData.ContainsKey("first") && requestData.ContainsKey("last")) 471 if (requestData.ContainsKey("first") && requestData.ContainsKey("last"))
473 { 472 {
474 UUID userID = UUID.Zero;
475 string first = (string)requestData["first"]; 473 string first = (string)requestData["first"];
476
477 string last = (string)requestData["last"]; 474 string last = (string)requestData["last"];
478 UUID uuid = m_HomeUsersService.GetUUID(first, last); 475 UUID uuid = m_HomeUsersService.GetUUID(first, last);
479 hash["UUID"] = uuid.ToString(); 476 hash["UUID"] = uuid.ToString();
@@ -482,7 +479,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
482 XmlRpcResponse response = new XmlRpcResponse(); 479 XmlRpcResponse response = new XmlRpcResponse();
483 response.Value = hash; 480 response.Value = hash;
484 return response; 481 return response;
485
486 } 482 }
487 } 483 }
488} 484} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
index f9a520a..28dbbc2 100644
--- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
@@ -39,8 +39,7 @@ namespace OpenSim.Server.Handlers.Profiles
39{ 39{
40 public class UserProfilesConnector: ServiceConnector 40 public class UserProfilesConnector: ServiceConnector
41 { 41 {
42 static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42// static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 43
45 // Our Local Module 44 // Our Local Module
46 public IUserProfilesService ServiceModule 45 public IUserProfilesService ServiceModule
@@ -110,5 +109,4 @@ namespace OpenSim.Server.Handlers.Profiles
110 Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); 109 Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);
111 } 110 }
112 } 111 }
113} 112} \ No newline at end of file
114
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
index b36fa23..245703c 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Services.Connectors
98 catch (Exception e) 98 catch (Exception e)
99 { 99 {
100 m_log.WarnFormat( 100 m_log.WarnFormat(
101 "[NEIGHBOUR SERVICE CONNCTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3}{4}", 101 "[NEIGHBOUR SERVICES CONNECTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3}{4}",
102 uri, thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); 102 uri, thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
103 103
104 return false; 104 return false;
@@ -117,7 +117,7 @@ namespace OpenSim.Services.Connectors
117 catch (Exception e) 117 catch (Exception e)
118 { 118 {
119 m_log.WarnFormat( 119 m_log.WarnFormat(
120 "[NEIGHBOUR SERVICE CONNCTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2}{3}", 120 "[NEIGHBOUR SERVICES CONNECTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2}{3}",
121 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); 121 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
122 122
123 return false; 123 return false;
@@ -137,7 +137,7 @@ namespace OpenSim.Services.Connectors
137 catch (Exception e) 137 catch (Exception e)
138 { 138 {
139 m_log.WarnFormat( 139 m_log.WarnFormat(
140 "[NEIGHBOUR SERVICE CONNCTOR]: Exception thrown on serialization of HelloNeighbour from {0} to {1}. Exception {2}{3}", 140 "[NEIGHBOUR SERVICES CONNECTOR]: Exception thrown on serialization of HelloNeighbour from {0} to {1}. Exception {2}{3}",
141 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); 141 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
142 142
143 return false; 143 return false;
@@ -175,7 +175,7 @@ namespace OpenSim.Services.Connectors
175 if (webResponse == null) 175 if (webResponse == null)
176 { 176 {
177 m_log.DebugFormat( 177 m_log.DebugFormat(
178 "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", 178 "[NEIGHBOUR SERVICES CONNECTOR]: Null reply on DoHelloNeighbourCall post from {0} to {1}",
179 thisRegion.RegionName, region.RegionName); 179 thisRegion.RegionName, region.RegionName);
180 } 180 }
181 181
@@ -193,7 +193,7 @@ namespace OpenSim.Services.Connectors
193 catch (Exception e) 193 catch (Exception e)
194 { 194 {
195 m_log.WarnFormat( 195 m_log.WarnFormat(
196 "[NEIGHBOUR SERVICE CONNCTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2}{3}", 196 "[NEIGHBOUR SERVICES CONNECTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2}{3}",
197 region.RegionName, thisRegion.RegionName, e.Message, e.StackTrace); 197 region.RegionName, thisRegion.RegionName, e.Message, e.StackTrace);
198 198
199 return false; 199 return false;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs
index e85b0b7..764e71f 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs
@@ -56,11 +56,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
56 private Scene m_scene; 56 private Scene m_scene;
57 private String m_simianURL; 57 private String m_simianURL;
58 58
59 private IGridUserService m_GridUserService;
60
61#region IRegionModule Members 59#region IRegionModule Members
62 60
63
64 public string Name 61 public string Name
65 { 62 {
66 get { return this.GetType().Name; } 63 get { return this.GetType().Name; }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
index e7d2f86..9898da9 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
@@ -29,11 +29,9 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Reflection; 31using System.Reflection;
32
33using log4net; 32using log4net;
34using Mono.Addins; 33using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36
37using OpenSim.Framework; 35using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
@@ -52,7 +50,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 51
54 private IConfig m_config = null; 52 private IConfig m_config = null;
55 private bool m_enabled = true;
56 53
57 private String m_simianURL; 54 private String m_simianURL;
58 55
@@ -62,7 +59,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
62 { 59 {
63 get { return this.GetType().Name; } 60 get { return this.GetType().Name; }
64 } 61 }
65
66 62
67 public void Initialise(IConfigSource config) 63 public void Initialise(IConfigSource config)
68 { 64 {
@@ -76,7 +72,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
76 if (String.IsNullOrEmpty(m_simianURL)) 72 if (String.IsNullOrEmpty(m_simianURL))
77 { 73 {
78 // m_log.DebugFormat("[SimianGrid] service URL is not defined"); 74 // m_log.DebugFormat("[SimianGrid] service URL is not defined");
79 m_enabled = false;
80 return; 75 return;
81 } 76 }
82 77
@@ -141,6 +136,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
141 } 136 }
142 137
143#endregion 138#endregion
139
144 public static String SimulatorCapability = UUID.Zero.ToString(); 140 public static String SimulatorCapability = UUID.Zero.ToString();
145 public static OSDMap PostToService(string url, NameValueCollection data) 141 public static OSDMap PostToService(string url, NameValueCollection data)
146 { 142 {
@@ -148,4 +144,4 @@ namespace OpenSim.Services.Connectors.SimianGrid
148 return WebUtil.PostToService(url, data); 144 return WebUtil.PostToService(url, data);
149 } 145 }
150 } 146 }
151} 147} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
index 1b960b1..ff6608d 100644
--- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Text; 33using System.Text;
34using System.Threading;
34using log4net; 35using log4net;
35using Nini.Config; 36using Nini.Config;
36using NUnit.Framework; 37using NUnit.Framework;
@@ -59,7 +60,8 @@ namespace OpenSim.Tests.Common
59 /// A list that will be populated with any TestClients set up in response to 60 /// A list that will be populated with any TestClients set up in response to
60 /// being informed about a destination region. 61 /// being informed about a destination region.
61 /// </param> 62 /// </param>
62 public static void SetUpInformClientOfNeighbour(TestClient tc, List<TestClient> neighbourTcs) 63 public static void SetupInformClientOfNeighbourTriggersNeighbourClientCreate(
64 TestClient tc, List<TestClient> neighbourTcs)
63 { 65 {
64 // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the 66 // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the
65 // event queue). 67 // event queue).
@@ -75,8 +77,6 @@ namespace OpenSim.Tests.Common
75 "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", 77 "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}",
76 x, y, neighbourExternalEndPoint); 78 x, y, neighbourExternalEndPoint);
77 79
78 // In response to this message, we are going to make a teleport to the scene we've previous been told
79 // about by test code (this needs to be improved).
80 AgentCircuitData newAgent = tc.RequestClientInfo(); 80 AgentCircuitData newAgent = tc.RequestClientInfo();
81 81
82 Scene neighbourScene; 82 Scene neighbourScene;
@@ -87,5 +87,42 @@ namespace OpenSim.Tests.Common
87 neighbourScene.AddNewClient(neighbourTc, PresenceType.User); 87 neighbourScene.AddNewClient(neighbourTc, PresenceType.User);
88 }; 88 };
89 } 89 }
90
91 /// <summary>
92 /// Set up correct handling of the InformClientOfNeighbour call from the source region that triggers the
93 /// viewer to setup a connection with the destination region.
94 /// </summary>
95 /// <param name='tc'></param>
96 /// <param name='neighbourTcs'>
97 /// A list that will be populated with any TestClients set up in response to
98 /// being informed about a destination region.
99 /// </param>
100 public static void SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement(
101 TestClient client, List<TestClient> destinationClients)
102 {
103 client.OnTestClientSendRegionTeleport
104 += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) =>
105 {
106 uint x, y;
107 Utils.LongToUInts(regionHandle, out x, out y);
108 x /= Constants.RegionSize;
109 y /= Constants.RegionSize;
110
111 m_log.DebugFormat(
112 "[TEST CLIENT]: Processing send region teleport for destination at {0},{1} at {2}",
113 x, y, regionExternalEndPoint);
114
115 AgentCircuitData newAgent = client.RequestClientInfo();
116
117 Scene destinationScene;
118 SceneManager.Instance.TryGetScene(x, y, out destinationScene);
119
120 TestClient destinationClient = new TestClient(newAgent, destinationScene);
121 destinationClients.Add(destinationClient);
122 destinationScene.AddNewClient(destinationClient, PresenceType.User);
123
124 ThreadPool.UnsafeQueueUserWorkItem(o => destinationClient.CompleteMovement(), null);
125 };
126 }
90 } 127 }
91} \ No newline at end of file 128} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index dac8ccb..32bf32b 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -59,6 +59,11 @@ namespace pCampBot
59 public delegate void AnEvent(Bot callbot, EventType someevent); // event delegate for bot events 59 public delegate void AnEvent(Bot callbot, EventType someevent); // event delegate for bot events
60 60
61 /// <summary> 61 /// <summary>
62 /// Controls whether bots request textures for the object information they receive
63 /// </summary>
64 public bool RequestObjectTextures { get; set; }
65
66 /// <summary>
62 /// Bot manager. 67 /// Bot manager.
63 /// </summary> 68 /// </summary>
64 public BotManager Manager { get; private set; } 69 public BotManager Manager { get; private set; }
@@ -469,6 +474,9 @@ namespace pCampBot
469 474
470 public void Objects_NewPrim(object sender, PrimEventArgs args) 475 public void Objects_NewPrim(object sender, PrimEventArgs args)
471 { 476 {
477 if (!RequestObjectTextures)
478 return;
479
472 Primitive prim = args.Prim; 480 Primitive prim = args.Prim;
473 481
474 if (prim != null) 482 if (prim != null)
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 397a98e..dee02c3 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -300,6 +300,7 @@ namespace pCampBot
300 Bot pb = new Bot(bm, behaviours, firstName, lastName, password, startLocation, loginUri); 300 Bot pb = new Bot(bm, behaviours, firstName, lastName, password, startLocation, loginUri);
301 pb.wear = wearSetting; 301 pb.wear = wearSetting;
302 pb.Client.Settings.SEND_AGENT_UPDATES = InitBotSendAgentUpdates; 302 pb.Client.Settings.SEND_AGENT_UPDATES = InitBotSendAgentUpdates;
303 pb.RequestObjectTextures = InitBotRequestObjectTextures;
303 304
304 pb.OnConnected += handlebotEvent; 305 pb.OnConnected += handlebotEvent;
305 pb.OnDisconnected += handlebotEvent; 306 pb.OnDisconnected += handlebotEvent;