/// <summary> /// Adding a New Client and Create a Presence for it. /// Called by the LLClientView when the UseCircuitCode packet comes in /// Used by NPCs to add themselves to the Scene /// </summary> /// <param name="client"></param> public void AddNewClient(IClientAPI client) { try { System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP(); AgentCircuitData aCircuit = AuthenticateHandler.AuthenticateSession(client.SessionId, client.AgentId, client.CircuitCode, ep); if (aCircuit == null) // no good, didn't pass NewUserConnection successfully { return; } m_clientManager.Add(client); //Create the scenepresence IScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client); sp.IsChildAgent = aCircuit.child; //Trigger events m_eventManager.TriggerOnNewPresence(sp); //Make sure the appearanace is updated if (aCircuit != null) { IAvatarAppearanceModule appearance = sp.RequestModuleInterface <IAvatarAppearanceModule> (); if (appearance != null) { appearance.Appearance = aCircuit.Appearance; } } if (GetScenePresence(client.AgentId) != null) { EventManager.TriggerOnNewClient(client); if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0) { EventManager.TriggerOnClientLogin(client); } } //Add the client to login stats ILoginMonitor monitor = (ILoginMonitor)RequestModuleInterface <IMonitorModule>().GetMonitor("", "LoginMonitor"); if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0 && monitor != null) { monitor.AddSuccessfulLogin(); } } catch (Exception ex) { m_log.Warn("[Scene]: Error in AddNewClient: " + ex.ToString()); } }
/// <summary> /// Adding a New Client and Create a Presence for it. /// Called by the LLClientView when the UseCircuitCode packet comes in /// Used by NPCs to add themselves to the Scene /// </summary> /// <param name="client"></param> /// <param name="completed"></param> public void AddNewClient(IClientAPI client, BlankHandler completed) { lock (m_events) m_events.Add(delegate { try { System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP(); AgentCircuitData aCircuit = AuthenticateHandler.AuthenticateSession(client.SessionId, client.AgentId, client.CircuitCode, ep); if (aCircuit == null) // no good, didn't pass NewUserConnection successfully { completed(); return; } m_clientManager.Add(client); //Create the scenepresence IScenePresence sp = CreateAndAddChildScenePresence(client); sp.IsChildAgent = aCircuit.child; sp.DrawDistance = aCircuit.DrawDistance; //Trigger events m_eventManager.TriggerOnNewPresence(sp); //Make sure the appearanace is updated IAvatarAppearanceModule appearance = sp.RequestModuleInterface <IAvatarAppearanceModule>(); if (appearance != null) { appearance.Appearance = aCircuit.Appearance ?? sp.Scene.AvatarService.GetAppearance(sp.UUID); if (appearance.Appearance == null) { MainConsole.Instance.Error("[AsyncScene]: NO AVATAR APPEARANCE FOUND FOR " + sp.Name); appearance.Appearance = new AvatarAppearance(sp.UUID); } } if (GetScenePresence(client.AgentId) != null) { EventManager.TriggerOnNewClient(client); if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0) { EventManager.TriggerOnClientLogin(client); } } //Add the client to login stats ILoginMonitor monitor3 = (ILoginMonitor)RequestModuleInterface <IMonitorModule>().GetMonitor("", MonitorModuleHelper.LoginMonitor); if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0 && monitor3 != null) { monitor3.AddSuccessfulLogin(); } if (sp.IsChildAgent)//If we're a child, trigger this so that we get updated in the modules { sp.TriggerSignificantClientMovement(); } completed(); } catch (Exception ex) { MainConsole.Instance.Warn("[Scene]: Error in AddNewClient: " + ex); } }); }
/// <summary> /// Adding a New Client and Create a Presence for it. /// Called by the LLClientView when the UseCircuitCode packet comes in /// Used by NPCs to add themselves to the Scene /// </summary> /// <param name="client"></param> public void AddNewClient(IClientAPI client) { try { System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP(); AgentCircuitData aCircuit = AuthenticateHandler.AuthenticateSession(client.SessionId, client.AgentId, client.CircuitCode, ep); if (aCircuit == null) // no good, didn't pass NewUserConnection successfully return; m_clientManager.Add (client); //Create the scenepresence IScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence (client); sp.IsChildAgent = aCircuit.child; //Trigger events m_eventManager.TriggerOnNewPresence (sp); //Make sure the appearanace is updated if (aCircuit != null) { IAvatarAppearanceModule appearance = sp.RequestModuleInterface<IAvatarAppearanceModule> (); if (appearance != null) appearance.Appearance = aCircuit.Appearance; } if (GetScenePresence(client.AgentId) != null) { EventManager.TriggerOnNewClient(client); if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0) EventManager.TriggerOnClientLogin(client); } //Add the client to login stats ILoginMonitor monitor = (ILoginMonitor)RequestModuleInterface<IMonitorModule>().GetMonitor("", "LoginMonitor"); if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0 && monitor != null) { monitor.AddSuccessfulLogin(); } } catch(Exception ex) { m_log.Warn("[Scene]: Error in AddNewClient: " + ex.ToString()); } }
/// <summary> /// Adding a New Client and Create a Presence for it. /// Called by the LLClientView when the UseCircuitCode packet comes in /// Used by NPCs to add themselves to the Scene /// </summary> /// <param name="client"></param> public void AddNewClient (IClientAPI client, BlankHandler completed) { lock(m_events) m_events.Add(delegate() { try { System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP(); AgentCircuitData aCircuit = AuthenticateHandler.AuthenticateSession(client.SessionId, client.AgentId, client.CircuitCode, ep); if(aCircuit == null) // no good, didn't pass NewUserConnection successfully { completed(); return; } m_clientManager.Add(client); //Create the scenepresence IScenePresence sp = CreateAndAddChildScenePresence(client); sp.IsChildAgent = aCircuit.child; sp.DrawDistance = aCircuit.DrawDistance; //Trigger events m_eventManager.TriggerOnNewPresence(sp); //Make sure the appearanace is updated IAvatarAppearanceModule appearance = sp.RequestModuleInterface<IAvatarAppearanceModule>(); if (appearance != null) { if (aCircuit != null && aCircuit.Appearance != null) appearance.Appearance = aCircuit.Appearance; else appearance.Appearance = sp.Scene.AvatarService.GetAppearance(sp.UUID); if (appearance.Appearance == null) { m_log.Error("[AsyncScene]: NO AVATAR APPEARANCE FOUND FOR " + sp.Name); appearance.Appearance = new AvatarAppearance(sp.UUID); } } if(GetScenePresence(client.AgentId) != null) { EventManager.TriggerOnNewClient(client); if((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0) EventManager.TriggerOnClientLogin(client); } //Add the client to login stats ILoginMonitor monitor = (ILoginMonitor)RequestModuleInterface<IMonitorModule>().GetMonitor("", MonitorModuleHelper.LoginMonitor); if((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0 && monitor != null) monitor.AddSuccessfulLogin(); if(sp.IsChildAgent)//If we're a child, trigger this so that we get updated in the modules sp.TriggerSignificantClientMovement(); completed(); } catch(Exception ex) { m_log.Warn("[Scene]: Error in AddNewClient: " + ex.ToString()); } }); }
/// <summary> /// Adding a New Client and Create a Presence for it. /// </summary> /// <param name="client"></param> public override void AddNewClient(IClientAPI client) { AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); bool vialogin = false; if (aCircuit == null) // no good, didn't pass NewUserConnection successfully return; m_clientManager.Add(client); SubscribeToClientEvents(client); // Do the verification here System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP(); if (!VerifyClient(aCircuit, ep, out vialogin)) { // uh-oh, this is fishy m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", client.AgentId, client.SessionId, ep.ToString()); try { client.Close(); } catch (Exception e) { m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); } return; } //m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); ScenePresence sp = CreateAndAddScenePresence(client); if (aCircuit != null) sp.Appearance = aCircuit.Appearance; // HERE!!! Do the initial attachments right here // first agent upon login is a root agent by design. // All other AddNewClient calls find aCircuit.child to be true if (aCircuit.child == false) { sp.IsChildAgent = false; Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); } if (GetScenePresence(client.AgentId) != null) { m_LastLogin = Util.EnvironmentTickCount(); EventManager.TriggerOnNewClient(client); if (vialogin) EventManager.TriggerOnClientLogin(client); } if (!sp.IsChildAgent && Stats is OpenSim.Framework.Statistics.SimExtraStatsCollector) { OpenSim.Framework.Statistics.SimExtraStatsCollector stats = Stats as OpenSim.Framework.Statistics.SimExtraStatsCollector; stats.AddSuccessfulLogin(); } }
/// <summary> /// Adding a New Client and Create a Presence for it. /// Called by the LLClientView when the UseCircuitCode packet comes in /// Used by NPCs to add themselves to the Scene /// </summary> /// <param name="client"></param> public void AddNewClient(IClientAPI client) { try { System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP(); AgentCircuitData aCircuit = AuthenticateHandler.AuthenticateSession(client.SessionId, client.AgentId, client.CircuitCode, ep); if (aCircuit == null) // no good, didn't pass NewUserConnection successfully return; //Create the scenepresence, then update it with any info that we have about it ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client); lock (m_incomingChildAgentData) { if (m_incomingChildAgentData.ContainsKey(sp.UUID)) { //Found info, update the agent then remove it sp.ChildAgentDataUpdate(m_incomingChildAgentData[sp.UUID]); m_incomingChildAgentData.Remove(sp.UUID); } } //Make sure the appearanace is updated if (aCircuit != null) sp.Appearance = aCircuit.Appearance; sp.IsChildAgent = aCircuit.child; m_clientManager.Add(client); //Trigger events m_eventManager.TriggerOnNewPresence(sp); if (GetScenePresence(client.AgentId) != null) { EventManager.TriggerOnNewClient(client); if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0) EventManager.TriggerOnClientLogin(client); } //Add the client to login stats ILoginMonitor monitor = (ILoginMonitor)RequestModuleInterface<IMonitorModule>().GetMonitor("", "LoginMonitor"); if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0 && monitor != null) { monitor.AddSuccessfulLogin(); } } catch(Exception ex) { m_log.Warn("[Scene]: Error in AddNewClient: " + ex.ToString()); } }
/// <summary> /// Adding a New Client and Create a Presence for it. /// </summary> /// <param name="client"></param> public override void AddNewClient(IClientAPI client) { bool vialogin = false; m_clientManager.Add(client); CheckHeartbeat(); SubscribeToClientEvents(client); ScenePresence presence; if (m_restorePresences.ContainsKey(client.AgentId)) { m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); presence = m_restorePresences[client.AgentId]; m_restorePresences.Remove(client.AgentId); // This is one of two paths to create avatars that are // used. This tends to get called more in standalone // than grid, not really sure why, but as such needs // an explicity appearance lookup here. AvatarAppearance appearance = null; GetAvatarAppearance(client, out appearance); presence.Appearance = appearance; presence.initializeScenePresence(client, RegionInfo, this); m_sceneGraph.AddScenePresence(presence); lock (m_restorePresences) { Monitor.PulseAll(m_restorePresences); } } else { AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); // Do the verification here System.Net.EndPoint ep = client.GetClientEP(); if (aCircuit != null) { if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) { m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); vialogin = true; IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); if (userVerification != null && ep != null) { if (!userVerification.VerifyClient(aCircuit, ep.ToString())) { // uh-oh, this is fishy m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", client.AgentId, client.SessionId, ep.ToString()); try { client.Close(); } catch (Exception e) { m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); } return; } else m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} returned true", aCircuit.firstname, aCircuit.lastname); } } } m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); ScenePresence sp = CreateAndAddScenePresence(client); if (aCircuit != null) sp.Appearance = aCircuit.Appearance; // HERE!!! Do the initial attachments right here // first agent upon login is a root agent by design. // All other AddNewClient calls find aCircuit.child to be true if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) { sp.IsChildAgent = false; Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); } } m_LastLogin = Util.EnvironmentTickCount(); EventManager.TriggerOnNewClient(client); if (vialogin) EventManager.TriggerOnClientLogin(client); }