aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorDiva Canto2010-08-20 09:02:05 -0700
committerDiva Canto2010-08-20 09:02:05 -0700
commit6f83b0ee4625ae6b94a7ca0525f7d8369da7e126 (patch)
tree08ca12550811ccfec43da892f59e397c4653a3b8 /OpenSim/Region/Framework
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-6f83b0ee4625ae6b94a7ca0525f7d8369da7e126.zip
opensim-SC_OLD-6f83b0ee4625ae6b94a7ca0525f7d8369da7e126.tar.gz
opensim-SC_OLD-6f83b0ee4625ae6b94a7ca0525f7d8369da7e126.tar.bz2
opensim-SC_OLD-6f83b0ee4625ae6b94a7ca0525f7d8369da7e126.tar.xz
Cleaned up a few more things related to incoming agents.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs87
1 files changed, 42 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2f862ea..a147628 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2502,18 +2502,25 @@ namespace OpenSim.Region.Framework.Scenes
2502 /// <param name="client"></param> 2502 /// <param name="client"></param>
2503 public override void AddNewClient(IClientAPI client) 2503 public override void AddNewClient(IClientAPI client)
2504 { 2504 {
2505 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2505 bool vialogin = false; 2506 bool vialogin = false;
2506 2507
2507 m_clientManager.Add(client); 2508 if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
2509 return;
2510
2511 vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
2512 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
2508 2513
2509 CheckHeartbeat(); 2514 CheckHeartbeat();
2510 SubscribeToClientEvents(client);
2511 ScenePresence presence; 2515 ScenePresence presence;
2512 2516
2513 if (m_restorePresences.ContainsKey(client.AgentId)) 2517 if (m_restorePresences.ContainsKey(client.AgentId))
2514 { 2518 {
2515 m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); 2519 m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
2516 2520
2521 m_clientManager.Add(client);
2522 SubscribeToClientEvents(client);
2523
2517 presence = m_restorePresences[client.AgentId]; 2524 presence = m_restorePresences[client.AgentId];
2518 m_restorePresences.Remove(client.AgentId); 2525 m_restorePresences.Remove(client.AgentId);
2519 2526
@@ -2536,49 +2543,35 @@ namespace OpenSim.Region.Framework.Scenes
2536 } 2543 }
2537 else 2544 else
2538 { 2545 {
2539 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2546 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
2540 2547 {
2541 //// Do the verification here -- No, really don't do this here. This is UDP address, let it go. 2548 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2542 //System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP();
2543 //if (aCircuit != null)
2544 //{
2545 // if (!VerifyClient(aCircuit, ep, out vialogin))
2546 // {
2547 // // uh-oh, this is fishy
2548 // m_log.WarnFormat("[SCENE]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
2549 // client.AgentId, client.SessionId, ep.ToString());
2550 // try
2551 // {
2552 // client.Close();
2553 // }
2554 // catch (Exception e)
2555 // {
2556 // m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace);
2557 // }
2558 // return;
2559 // }
2560 //}
2561 2549
2562 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); 2550 m_clientManager.Add(client);
2551 SubscribeToClientEvents(client);
2563 2552
2564 ScenePresence sp = CreateAndAddScenePresence(client); 2553 ScenePresence sp = CreateAndAddScenePresence(client);
2565 if (aCircuit != null) 2554 if (aCircuit != null)
2566 sp.Appearance = aCircuit.Appearance; 2555 sp.Appearance = aCircuit.Appearance;
2567 2556
2568 // HERE!!! Do the initial attachments right here 2557 // HERE!!! Do the initial attachments right here
2569 // first agent upon login is a root agent by design. 2558 // first agent upon login is a root agent by design.
2570 // All other AddNewClient calls find aCircuit.child to be true 2559 // All other AddNewClient calls find aCircuit.child to be true
2571 if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) 2560 if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
2572 { 2561 {
2573 sp.IsChildAgent = false; 2562 sp.IsChildAgent = false;
2574 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); 2563 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2564 }
2575 } 2565 }
2576 } 2566 }
2577 2567
2578 m_LastLogin = Util.EnvironmentTickCount(); 2568 if (GetScenePresence(client.AgentId) != null)
2579 EventManager.TriggerOnNewClient(client); 2569 {
2580 if (vialogin) 2570 m_LastLogin = Util.EnvironmentTickCount();
2581 EventManager.TriggerOnClientLogin(client); 2571 EventManager.TriggerOnNewClient(client);
2572 if (vialogin)
2573 EventManager.TriggerOnClientLogin(client);
2574 }
2582 } 2575 }
2583 2576
2584 private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) 2577 private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin)
@@ -2605,8 +2598,11 @@ namespace OpenSim.Region.Framework.Scenes
2605 } 2598 }
2606 2599
2607 else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) 2600 else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
2608 m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.", 2601 {
2602 m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.",
2609 aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2603 aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2604 vialogin = true;
2605 }
2610 2606
2611 return true; 2607 return true;
2612 } 2608 }
@@ -3245,7 +3241,8 @@ namespace OpenSim.Region.Framework.Scenes
3245 /// also return a reason.</returns> 3241 /// also return a reason.</returns>
3246 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) 3242 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
3247 { 3243 {
3248 TeleportFlags tp = (TeleportFlags)teleportFlags; 3244 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
3245 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
3249 reason = String.Empty; 3246 reason = String.Empty;
3250 3247
3251 //Teleport flags: 3248 //Teleport flags:
@@ -3282,7 +3279,7 @@ namespace OpenSim.Region.Framework.Scenes
3282 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); 3279 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3283 3280
3284 //On login test land permisions 3281 //On login test land permisions
3285 if (tp == TeleportFlags.ViaLogin) 3282 if (vialogin)
3286 { 3283 {
3287 if (land != null && !TestLandRestrictions(agent, land, out reason)) 3284 if (land != null && !TestLandRestrictions(agent, land, out reason))
3288 { 3285 {
@@ -3341,7 +3338,7 @@ namespace OpenSim.Region.Framework.Scenes
3341 agent.teleportFlags = teleportFlags; 3338 agent.teleportFlags = teleportFlags;
3342 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3339 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3343 3340
3344 if (tp == TeleportFlags.ViaLogin) 3341 if (vialogin)
3345 { 3342 {
3346 if (TestBorderCross(agent.startpos, Cardinals.E)) 3343 if (TestBorderCross(agent.startpos, Cardinals.E))
3347 { 3344 {
@@ -3459,7 +3456,7 @@ namespace OpenSim.Region.Framework.Scenes
3459 IPresenceService presence = RequestModuleInterface<IPresenceService>(); 3456 IPresenceService presence = RequestModuleInterface<IPresenceService>();
3460 if (presence == null) 3457 if (presence == null)
3461 { 3458 {
3462 reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName); 3459 reason = String.Format("Failed to verify user presence in the grid for {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
3463 return false; 3460 return false;
3464 } 3461 }
3465 3462
@@ -3467,7 +3464,7 @@ namespace OpenSim.Region.Framework.Scenes
3467 3464
3468 if (pinfo == null) 3465 if (pinfo == null)
3469 { 3466 {
3470 reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName); 3467 reason = String.Format("Failed to verify user presence in the grid for {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
3471 return false; 3468 return false;
3472 } 3469 }
3473 3470