aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2013-07-18 10:08:10 +0100
committerMelanie2013-07-18 10:08:10 +0100
commit7830cc995471120892a24a39e86283774fa07c4c (patch)
treed3f46b4f3ce95bb8572511c6f12c9f8ca86922c8 /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' into careminster (diff)
parentDocument obscure Groups config related to the user level required for creatin... (diff)
downloadopensim-SC_OLD-7830cc995471120892a24a39e86283774fa07c4c.zip
opensim-SC_OLD-7830cc995471120892a24a39e86283774fa07c4c.tar.gz
opensim-SC_OLD-7830cc995471120892a24a39e86283774fa07c4c.tar.bz2
opensim-SC_OLD-7830cc995471120892a24a39e86283774fa07c4c.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/Framework/Scenes/ScenePresence.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs OpenSim/Server/Handlers/Simulation/AgentHandlers.cs OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs OpenSim/Services/HypergridService/UserAgentService.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs84
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs88
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs1
10 files changed, 194 insertions, 85 deletions
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index 8a40278..29652aa 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -55,7 +55,6 @@ namespace OpenSim.Region.Framework.Scenes
55 private object m_lockObject = new object(); 55 private object m_lockObject = new object();
56 private object m_timerLock = new object(); 56 private object m_timerLock = new object();
57 private const double m_tickDuration = 50.0; 57 private const double m_tickDuration = 50.0;
58 private Scene m_scene;
59 58
60 public double TickDuration 59 public double TickDuration
61 { 60 {
@@ -69,8 +68,6 @@ namespace OpenSim.Region.Framework.Scenes
69 m_timer.AutoReset = true; 68 m_timer.AutoReset = true;
70 m_timer.Elapsed += OnTimer; 69 m_timer.Elapsed += OnTimer;
71 70
72 m_scene = scene;
73
74 m_timer.Start(); 71 m_timer.Start();
75 } 72 }
76 73
@@ -94,13 +91,13 @@ namespace OpenSim.Region.Framework.Scenes
94 { 91 {
95 m.OnTimer(TickDuration); 92 m.OnTimer(TickDuration);
96 } 93 }
97 catch (Exception inner) 94 catch (Exception)
98 { 95 {
99 // Don't stop processing 96 // Don't stop processing
100 } 97 }
101 } 98 }
102 } 99 }
103 catch (Exception e) 100 catch (Exception)
104 { 101 {
105 // Keep running no matter what 102 // Keep running no matter what
106 } 103 }
@@ -157,7 +154,7 @@ namespace OpenSim.Region.Framework.Scenes
157 [Serializable] 154 [Serializable]
158 public class KeyframeMotion 155 public class KeyframeMotion
159 { 156 {
160 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 157// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
161 158
162 public enum PlayMode : int 159 public enum PlayMode : int
163 { 160 {
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
index c11174d..f208afb 100644
--- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
+++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
@@ -46,47 +46,33 @@ using OpenSim.Region.Framework.Scenes;
46 46
47namespace OpenSim.Region.Framework.Scenes 47namespace OpenSim.Region.Framework.Scenes
48{ 48{
49 public class RegionStatsHandler : IStreamedRequestHandler 49 public class RegionStatsHandler : BaseStreamHandler
50 { 50 {
51 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 private string osRXStatsURI = String.Empty;
54 private string osXStatsURI = String.Empty; 53 private string osXStatsURI = String.Empty;
55 //private string osSecret = String.Empty; 54 //private string osSecret = String.Empty;
56 private OpenSim.Framework.RegionInfo regionInfo; 55 private OpenSim.Framework.RegionInfo regionInfo;
57 public string localZone = TimeZone.CurrentTimeZone.StandardName; 56 public string localZone = TimeZone.CurrentTimeZone.StandardName;
58 public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); 57 public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
59 58
60 public string Name { get { return "RegionStats"; } } 59 public RegionStatsHandler(RegionInfo region_info)
61 public string Description { get { return "Region Statistics"; } } 60 : base("GET", "/" + Util.SHA1Hash(region_info.regionSecret), "RegionStats", "Region Statistics")
62
63 public RegionStatsHandler(RegionInfo region_info)
64 { 61 {
65 regionInfo = region_info; 62 regionInfo = region_info;
66 osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret);
67 osXStatsURI = Util.SHA1Hash(regionInfo.osSecret); 63 osXStatsURI = Util.SHA1Hash(regionInfo.osSecret);
68 } 64 }
69 65
70 public byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 66 protected override byte[] ProcessRequest(
67 string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
71 { 68 {
72 return Util.UTF8.GetBytes(Report()); 69 return Util.UTF8.GetBytes(Report());
73 } 70 }
74 71
75 public string ContentType 72 public override string ContentType
76 { 73 {
77 get { return "text/plain"; } 74 get { return "text/plain"; }
78 } 75 }
79
80 public string HttpMethod
81 {
82 get { return "GET"; }
83 }
84
85 public string Path
86 {
87 // This is for the region and is the regionSecret hashed
88 get { return "/" + osRXStatsURI; }
89 }
90 76
91 private string Report() 77 private string Report()
92 { 78 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c743190..c132c5d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3258,7 +3258,6 @@ namespace OpenSim.Region.Framework.Scenes
3258 { 3258 {
3259 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; 3259 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
3260 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 3260 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
3261 client.OnRegionHandleRequest += RegionHandleRequest;
3262 } 3261 }
3263 3262
3264 public virtual void SubscribeToClientNetworkEvents(IClientAPI client) 3263 public virtual void SubscribeToClientNetworkEvents(IClientAPI client)
@@ -3384,7 +3383,6 @@ namespace OpenSim.Region.Framework.Scenes
3384 { 3383 {
3385 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; 3384 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
3386 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; 3385 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
3387 client.OnRegionHandleRequest -= RegionHandleRequest;
3388 } 3386 }
3389 3387
3390 public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client) 3388 public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client)
@@ -3611,7 +3609,7 @@ namespace OpenSim.Region.Framework.Scenes
3611 regions.Remove(RegionInfo.RegionHandle); 3609 regions.Remove(RegionInfo.RegionHandle);
3612 3610
3613 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. 3611 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours.
3614 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3612 m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions);
3615 } 3613 }
3616 3614
3617 m_eventManager.TriggerClientClosed(agentID, this); 3615 m_eventManager.TriggerClientClosed(agentID, this);
@@ -3858,8 +3856,10 @@ namespace OpenSim.Region.Framework.Scenes
3858 m_log.WarnFormat( 3856 m_log.WarnFormat(
3859 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", 3857 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.",
3860 sp.Name, sp.UUID, RegionInfo.RegionName); 3858 sp.Name, sp.UUID, RegionInfo.RegionName);
3859
3860 if (sp.ControllingClient != null)
3861 sp.ControllingClient.Close(true, true);
3861 3862
3862 sp.ControllingClient.Close(true, true);
3863 sp = null; 3863 sp = null;
3864 } 3864 }
3865 } 3865 }
@@ -4394,10 +4394,16 @@ namespace OpenSim.Region.Framework.Scenes
4394 4394
4395 if (childAgentUpdate != null) 4395 if (childAgentUpdate != null)
4396 { 4396 {
4397 if (cAgentData.SessionID != childAgentUpdate.ControllingClient.SessionId)
4398 {
4399 m_log.WarnFormat("[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).", childAgentUpdate.UUID, cAgentData.SessionID);
4400 Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}",
4401 childAgentUpdate.UUID, childAgentUpdate.ControllingClient.SessionId, cAgentData.SessionID));
4402 }
4403
4397 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 4404 childAgentUpdate.ChildAgentDataUpdate(cAgentData);
4398 return true; 4405 return true;
4399 } 4406 }
4400
4401 return false; 4407 return false;
4402 } 4408 }
4403 4409
@@ -4413,20 +4419,24 @@ namespace OpenSim.Region.Framework.Scenes
4413 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 4419 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
4414 if (childAgentUpdate != null) 4420 if (childAgentUpdate != null)
4415 { 4421 {
4416 // I can't imagine *yet* why we would get an update if the agent is a root agent.. 4422 if (childAgentUpdate.ControllingClient.SessionId == cAgentData.SessionID)
4417 // however to avoid a race condition crossing borders.. 4423 {
4418 if (childAgentUpdate.IsChildAgent) 4424 // I can't imagine *yet* why we would get an update if the agent is a root agent..
4419 { 4425 // however to avoid a race condition crossing borders..
4420 uint rRegionX = (uint)(cAgentData.RegionHandle >> 40); 4426 if (childAgentUpdate.IsChildAgent)
4421 uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8); 4427 {
4422 uint tRegionX = RegionInfo.RegionLocX; 4428 uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
4423 uint tRegionY = RegionInfo.RegionLocY; 4429 uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
4424 //Send Data to ScenePresence 4430 uint tRegionX = RegionInfo.RegionLocX;
4425 childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY); 4431 uint tRegionY = RegionInfo.RegionLocY;
4426 // Not Implemented: 4432 //Send Data to ScenePresence
4427 //TODO: Do we need to pass the message on to one of our neighbors? 4433 childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY);
4434 // Not Implemented:
4435 //TODO: Do we need to pass the message on to one of our neighbors?
4436 }
4428 } 4437 }
4429 4438 else
4439 m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}", childAgentUpdate.UUID, cAgentData.SessionID);
4430 return true; 4440 return true;
4431 } 4441 }
4432 4442
@@ -4469,6 +4479,25 @@ namespace OpenSim.Region.Framework.Scenes
4469 4479
4470 return false; 4480 return false;
4471 } 4481 }
4482 /// <summary>
4483 /// Authenticated close (via network)
4484 /// </summary>
4485 /// <param name="agentID"></param>
4486 /// <param name="force"></param>
4487 /// <param name="auth_token"></param>
4488 /// <returns></returns>
4489 public bool IncomingCloseAgent(UUID agentID, bool force, string auth_token)
4490 {
4491 //m_log.DebugFormat("[SCENE]: Processing incoming close agent {0} in region {1} with auth_token {2}", agentID, RegionInfo.RegionName, auth_token);
4492
4493 // Check that the auth_token is valid
4494 AgentCircuitData acd = AuthenticateHandler.GetAgentCircuitData(agentID);
4495 if (acd != null && acd.SessionID.ToString() == auth_token)
4496 return IncomingCloseAgent(agentID, force);
4497 else
4498 m_log.ErrorFormat("[SCENE]: Request to close agent {0} with invalid authorization token {1}", agentID, auth_token);
4499 return false;
4500 }
4472 4501
4473 public bool IncomingCloseAgent(UUID agentID) 4502 public bool IncomingCloseAgent(UUID agentID)
4474 { 4503 {
@@ -4491,7 +4520,6 @@ namespace OpenSim.Region.Framework.Scenes
4491 public bool IncomingCloseAgent(UUID agentID, bool force) 4520 public bool IncomingCloseAgent(UUID agentID, bool force)
4492 { 4521 {
4493 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 4522 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
4494
4495 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); 4523 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
4496 if (presence != null) 4524 if (presence != null)
4497 { 4525 {
@@ -4499,7 +4527,7 @@ namespace OpenSim.Region.Framework.Scenes
4499 return true; 4527 return true;
4500 } 4528 }
4501 4529
4502 // Agent not here 4530 // Agent not here
4503 return false; 4531 return false;
4504 } 4532 }
4505 4533
@@ -5089,22 +5117,6 @@ namespace OpenSim.Region.Framework.Scenes
5089 5117
5090 #endregion 5118 #endregion
5091 5119
5092 public void RegionHandleRequest(IClientAPI client, UUID regionID)
5093 {
5094 m_log.DebugFormat("[SCENE]: RegionHandleRequest {0}", regionID);
5095 ulong handle = 0;
5096 if (regionID == RegionInfo.RegionID)
5097 handle = RegionInfo.RegionHandle;
5098 else
5099 {
5100 GridRegion r = GridService.GetRegionByUUID(UUID.Zero, regionID);
5101 if (r != null)
5102 handle = r.RegionHandle;
5103 }
5104
5105 if (handle != 0)
5106 client.SendRegionHandle(regionID, handle);
5107 }
5108 5120
5109// Commented pending deletion since this method no longer appears to do anything at all 5121// Commented pending deletion since this method no longer appears to do anything at all
5110// public bool NeedSceneCacheClear(UUID agentID) 5122// public bool NeedSceneCacheClear(UUID agentID)
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index df61dde..52f46f2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes
200 /// This Closes child agents on neighboring regions 200 /// This Closes child agents on neighboring regions
201 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 201 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
202 /// </summary> 202 /// </summary>
203 protected void SendCloseChildAgentAsync(UUID agentID, ulong regionHandle) 203 protected void SendCloseChildAgent(UUID agentID, ulong regionHandle, string auth_token)
204 { 204 {
205 // let's do our best, but there's not much we can do if the neighbour doesn't accept. 205 // let's do our best, but there's not much we can do if the neighbour doesn't accept.
206 206
@@ -209,24 +209,25 @@ namespace OpenSim.Region.Framework.Scenes
209 Utils.LongToUInts(regionHandle, out x, out y); 209 Utils.LongToUInts(regionHandle, out x, out y);
210 210
211 GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y); 211 GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y);
212 m_scene.SimulationService.CloseChildAgent(destination, agentID);
213 }
214 212
215 private void SendCloseChildAgentCompleted(IAsyncResult iar) 213 m_log.DebugFormat(
216 { 214 "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName);
217 SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState; 215
218 icon.EndInvoke(iar); 216 m_scene.SimulationService.CloseAgent(destination, agentID, auth_token);
219 } 217 }
220 218
221 public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst) 219 /// <summary>
220 /// Closes a child agents in a collection of regions. Does so asynchronously
221 /// so that the caller doesn't wait.
222 /// </summary>
223 /// <param name="agentID"></param>
224 /// <param name="regionslst"></param>
225 public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst)
222 { 226 {
223 foreach (ulong handle in regionslst) 227 foreach (ulong handle in regionslst)
224 { 228 {
225 ulong handleCopy = handle; 229 ulong handleCopy = handle;
226 SendCloseChildAgentDelegate d = SendCloseChildAgentAsync; 230 Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy, auth_code); });
227 d.BeginInvoke(agentID, handleCopy,
228 SendCloseChildAgentCompleted,
229 d);
230 } 231 }
231 } 232 }
232 233
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index f8624e7..8c50a81 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -67,6 +67,12 @@ namespace OpenSim.Region.Framework.Scenes
67 { 67 {
68 int scriptsStarted = 0; 68 int scriptsStarted = 0;
69 69
70 if (m_scene == null)
71 {
72 m_log.DebugFormat("[PRIM INVENTORY]: m_scene is null. Unable to create script instances");
73 return 0;
74 }
75
70 // Don't start scripts if they're turned off in the region! 76 // Don't start scripts if they're turned off in the region!
71 if (!m_scene.RegionInfo.RegionSettings.DisableScripts) 77 if (!m_scene.RegionInfo.RegionSettings.DisableScripts)
72 { 78 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f13f7ab..95ffc77 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -543,7 +543,11 @@ namespace OpenSim.Region.Framework.Scenes
543 CreatorID = uuid; 543 CreatorID = uuid;
544 } 544 }
545 if (parts.Length >= 2) 545 if (parts.Length >= 2)
546 {
546 CreatorData = parts[1]; 547 CreatorData = parts[1];
548 if (!CreatorData.EndsWith("/"))
549 CreatorData += "/";
550 }
547 if (parts.Length >= 3) 551 if (parts.Length >= 3)
548 name = parts[2]; 552 name = parts[2];
549 553
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index d04d87b..3be0623 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -696,7 +696,8 @@ namespace OpenSim.Region.Framework.Scenes
696 /// </param> 696 /// </param>
697 public void StopScriptInstance(TaskInventoryItem item) 697 public void StopScriptInstance(TaskInventoryItem item)
698 { 698 {
699 m_part.ParentGroup.Scene.EventManager.TriggerStopScript(m_part.LocalId, item.ItemID); 699 if (m_part.ParentGroup.Scene != null)
700 m_part.ParentGroup.Scene.EventManager.TriggerStopScript(m_part.LocalId, item.ItemID);
700 701
701 // At the moment, even stopped scripts are counted as active, which is probably wrong. 702 // At the moment, even stopped scripts are counted as active, which is probably wrong.
702// m_part.ParentGroup.AddActiveScriptCount(-1); 703// m_part.ParentGroup.AddActiveScriptCount(-1);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4ae0eb1..6e4ac98 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1151,9 +1151,9 @@ namespace OpenSim.Region.Framework.Scenes
1151 1151
1152 MovementFlag = 0; 1152 MovementFlag = 0;
1153 1153
1154 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1154 // DIVA NOTE: I moved TriggerOnMakeRootAgent out of here and into the end of
1155 1155 // CompleteMovement. We don't want modules doing heavy computation before CompleteMovement
1156 m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; 1156 // is over.
1157 } 1157 }
1158 1158
1159 public int GetStateSource() 1159 public int GetStateSource()
@@ -1519,10 +1519,15 @@ namespace OpenSim.Region.Framework.Scenes
1519 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1519 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1520 MakeRootAgent(AbsolutePosition, flying); 1520 MakeRootAgent(AbsolutePosition, flying);
1521 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1521 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1522 // Remember in HandleUseCircuitCode, we delayed this to here
1523 // This will also send the initial data to clients when TP to a neighboring region.
1524 // Not ideal, but until we know we're TP-ing from a neighboring region, there's not much we can do
1525 if (m_teleportFlags > 0)
1526 SendInitialDataToMe();
1522 1527
1523// m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); 1528// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1524 1529
1525 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1530 if (!string.IsNullOrEmpty(m_callbackURI))
1526 { 1531 {
1527 // We cannot sleep here since this would hold up the inbound packet processing thread, as 1532 // We cannot sleep here since this would hold up the inbound packet processing thread, as
1528 // CompleteMovement() is executed synchronously. However, it might be better to delay the release 1533 // CompleteMovement() is executed synchronously. However, it might be better to delay the release
@@ -1550,9 +1555,6 @@ namespace OpenSim.Region.Framework.Scenes
1550 // Create child agents in neighbouring regions 1555 // Create child agents in neighbouring regions
1551 if (openChildAgents && !IsChildAgent) 1556 if (openChildAgents && !IsChildAgent)
1552 { 1557 {
1553 // Remember in HandleUseCircuitCode, we delayed this to here
1554 SendInitialDataToMe();
1555
1556 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1558 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1557 if (m_agentTransfer != null) 1559 if (m_agentTransfer != null)
1558 m_agentTransfer.EnableChildAgents(this); 1560 m_agentTransfer.EnableChildAgents(this);
@@ -1575,6 +1577,11 @@ namespace OpenSim.Region.Framework.Scenes
1575// m_log.DebugFormat( 1577// m_log.DebugFormat(
1576// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1578// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1577// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1579// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1580
1581 // DIVA NOTE: moved this here from MakeRoot. We don't want modules making heavy
1582 // computations before CompleteMovement is over
1583 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1584
1578 } 1585 }
1579 1586
1580 /// <summary> 1587 /// <summary>
@@ -2886,11 +2893,12 @@ namespace OpenSim.Region.Framework.Scenes
2886 SendOtherAgentsAppearanceToMe(); 2893 SendOtherAgentsAppearanceToMe();
2887 2894
2888 EntityBase[] entities = Scene.Entities.GetEntities(); 2895 EntityBase[] entities = Scene.Entities.GetEntities();
2889 foreach(EntityBase e in entities) 2896 foreach (EntityBase e in entities)
2890 { 2897 {
2891 if (e != null && e is SceneObjectGroup) 2898 if (e != null && e is SceneObjectGroup)
2892 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); 2899 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
2893 } 2900 }
2901
2894 }); 2902 });
2895 } 2903 }
2896 2904
@@ -3116,7 +3124,7 @@ namespace OpenSim.Region.Framework.Scenes
3116 cadu.Velocity = Velocity; 3124 cadu.Velocity = Velocity;
3117 3125
3118 AgentPosition agentpos = new AgentPosition(); 3126 AgentPosition agentpos = new AgentPosition();
3119 agentpos.CopyFrom(cadu); 3127 agentpos.CopyFrom(cadu, ControllingClient.SessionId);
3120 3128
3121 // Let's get this out of the update loop 3129 // Let's get this out of the update loop
3122 Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); }); 3130 Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); });
@@ -3355,7 +3363,11 @@ namespace OpenSim.Region.Framework.Scenes
3355 { 3363 {
3356 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); 3364 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents");
3357 3365
3358 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); 3366 AgentCircuitData acd = Scene.AuthenticateHandler.GetAgentCircuitData(UUID);
3367 string auth = string.Empty;
3368 if (acd != null)
3369 auth = acd.SessionID.ToString();
3370 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, auth, byebyeRegions);
3359 } 3371 }
3360 3372
3361 foreach (ulong handle in byebyeRegions) 3373 foreach (ulong handle in byebyeRegions)
@@ -3456,6 +3468,7 @@ namespace OpenSim.Region.Framework.Scenes
3456 3468
3457 cAgent.AgentID = UUID; 3469 cAgent.AgentID = UUID;
3458 cAgent.RegionID = Scene.RegionInfo.RegionID; 3470 cAgent.RegionID = Scene.RegionInfo.RegionID;
3471 cAgent.SessionID = ControllingClient.SessionId;
3459 3472
3460 cAgent.Position = AbsolutePosition; 3473 cAgent.Position = AbsolutePosition;
3461 cAgent.Velocity = m_velocity; 3474 cAgent.Velocity = m_velocity;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
new file mode 100644
index 0000000..4ae7a8e
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
@@ -0,0 +1,88 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using System.Threading;
33using System.Timers;
34using Timer = System.Timers.Timer;
35using Nini.Config;
36using NUnit.Framework;
37using OpenMetaverse;
38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Region.ClientStack.Linden;
43using OpenSim.Region.CoreModules.Framework;
44using OpenSim.Region.CoreModules.Framework.EntityTransfer;
45using OpenSim.Region.CoreModules.World.Serialiser;
46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Region.Framework.Interfaces;
49using OpenSim.Tests.Common;
50using OpenSim.Tests.Common.Mock;
51using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52
53namespace OpenSim.Region.Framework.Scenes.Tests
54{
55 [TestFixture]
56 public class ScenePresenceCapabilityTests : OpenSimTestCase
57 {
58 [Test]
59 public void TestChildAgentSingleRegionCapabilities()
60 {
61 TestHelpers.InMethod();
62// TestHelpers.EnableLogging();
63
64 UUID spUuid = TestHelpers.ParseTail(0x1);
65
66 // XXX: This is not great since the use of statics will mean that this has to be manually cleaned up for
67 // any subsequent test.
68 // XXX: May replace with a mock IHttpServer later.
69 BaseHttpServer httpServer = new BaseHttpServer(99999);
70 MainServer.AddHttpServer(httpServer);
71 MainServer.Instance = httpServer;
72
73 CapabilitiesModule capsMod = new CapabilitiesModule();
74 TestScene scene = new SceneHelpers().SetupScene();
75 SceneHelpers.SetupSceneModules(scene, capsMod);
76
77 ScenePresence sp = SceneHelpers.AddChildScenePresence(scene, spUuid);
78 //Assert.That(capsMod.GetCapsForUser(spUuid), Is.Not.Null);
79
80 // TODO: Need to add tests for other ICapabiltiesModule methods.
81
82 scene.IncomingCloseAgent(sp.UUID, false);
83 //Assert.That(capsMod.GetCapsForUser(spUuid), Is.Null);
84
85 // TODO: Need to add tests for other ICapabiltiesModule methods.
86 }
87 }
88}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index 5a72239..5df9aba 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -112,6 +112,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
112 //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero); 112 //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero);
113 moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2))); 113 moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2)));
114 moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS; 114 moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
115 moveArgs.SessionID = acd.SessionID;
115 116
116 originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs); 117 originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs);
117 118