public LoginViewModel(ILoginMonitor loginMonitor) { LoginMonitor = loginMonitor; Name = "Login"; LoginCommand = new DelegateCommand(obj => Login(), () => !string.IsNullOrEmpty(LoginMonitor.User.Name) && LoginMonitor.SecurePassword.Length > 0); }
public VpnConnectionProvider(ILoginMonitor loginMonitor) { _loginMonitor = loginMonitor; _phoneBook = new RasPhoneBook(); _dialer = new RasDialer { PhoneBookPath = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.User), Credentials = new NetworkCredential(_loginMonitor.User.Name, _loginMonitor.SecurePassword) }; }
/// <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()); } }
public AppViewModel(IVpnConnectionProvider vpnProvider, ILoginMonitor loginMonitor) { _vpnProvider = vpnProvider; LoginMonitor = loginMonitor; Name = "App"; VpnConnections = new ObservableCollection <VpnConnectionInfo>(); LogoutCommand = new DelegateCommand(obj => Logout(), () => true); NewCommand = new DelegateCommand(obj => CreateConnection(), () => LoginMonitor.User.IsPrivileged); RemoveCommand = new DelegateCommand(obj => RemoveConnection(), () => SelectedConnection != null && LoginMonitor.User.IsPrivileged); ConnectCommand = new DelegateCommand(obj => Connect(), () => SelectedConnection != null); DisconnectCommand = new DelegateCommand(obj => Disconnect(), () => true); }
/// <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) { AddAsyncEvent(delegate { try { AgentCircuitData aCircuit = AuthenticateHandler.GetAgentCircuitData(client.AgentId); m_clientManager.Add(client); //Create the scenepresence IScenePresence sp = CreateAndAddChildScenePresence(client); sp.IsChildAgent = aCircuit.IsChildAgent; //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 monitor3 = RequestModuleInterface <IMonitorModule>().GetMonitor <ILoginMonitor>(null); 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(); } if (completed != null) { completed(); } } catch (Exception ex) { MainConsole.Instance.Warn("[Scene]: Error in AddNewClient: " + ex); } }); }
protected void LogoutHandler(IClientAPI client) { client.SendLogoutPacket(); if (client.IsActive) { RemoveClient(((LLClientView)client).UDPClient); } ILoginMonitor monitor = (ILoginMonitor)m_scene.RequestModuleInterface <IMonitorModule>().GetMonitor("", "LoginMonitor"); if (monitor != null) { monitor.AddLogout(); } }
/// <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); } }); }
public void ResendUnacked(LLUDPClient udpClient) { if (!udpClient.IsConnected) { return; } // Disconnect an agent if no packets are received for some time if ((Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > 1000 * ClientTimeOut && !udpClient.IsPaused) { m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID); ILoginMonitor monitor = (ILoginMonitor)m_scene.RequestModuleInterface <IMonitorModule>().GetMonitor("", "LoginMonitor"); if (monitor != null) { monitor.AddAbnormalClientThreadTermination(); } RemoveClient(udpClient); return; } // Get a list of all of the packets that have been sitting unacked longer than udpClient.RTO List <OutgoingPacket> expiredPackets = udpClient.NeedAcks.GetExpiredPackets(udpClient.RTO); if (expiredPackets != null) { //m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO); // Exponential backoff of the retransmission timeout udpClient.BackoffRTO(); lock (udpClient) { udpClient.SlowDownSend(); } // Resend packets for (int i = 0; i < expiredPackets.Count; i++) { OutgoingPacket outgoingPacket = expiredPackets[i]; //m_log.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed", // outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount); // Set the resent flag outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT); // resend in its original category // outgoingPacket.Category = ThrottleOutPacketType.Resend; // Bump up the resend count on this packet Interlocked.Increment(ref outgoingPacket.ResendCount); //Interlocked.Increment(ref Stats.ResentPackets); // Requeue or resend the packet if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket)) { SendPacketFinal(outgoingPacket); } } } }