aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs84
1 files changed, 48 insertions, 36 deletions
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)