Ejemplo n.º 1
0
 void Channel_Closed(object sender, EventArgs e)
 {
     if (ClientClosed != null)
     {
         ClientClosed.Invoke(this, null);
     }
 }
Ejemplo n.º 2
0
 private void OnClientClosed(ClientConnection client, Exception ex)
 {
     client.Closed   -= OnClientClosed;
     client.Received -= OnClientReceived;
     _clients.Remove(client.ConnectionId);
     ClientClosed?.Invoke(client.ConnectionId, ex);
 }
Ejemplo n.º 3
0
 public void TriggerClientClosed(UUID ClientID)
 {
     handlerClientClosed = OnClientClosed;
     if (handlerClientClosed != null)
     {
         handlerClientClosed(ClientID);
     }
 }
Ejemplo n.º 4
0
 public void TriggerClientClosed(UUID ClientID, Scene scene)
 {
     handlerClientClosed = OnClientClosed;
     if (handlerClientClosed != null)
     {
         handlerClientClosed(ClientID, scene);
     }
 }
Ejemplo n.º 5
0
        private void NetSession_Closed(NetSession ses)
        {
            // Raise event to consumer
            ClientClosed?.Invoke(ses);

            lock (sessions)
            {
                sessions.Remove(ses.Id);
            }
            ses.Dispose();
        }
        Message ProcessCloseMessage(Message msg, uint clID)
        {
            Dbg.Assert(msg.MessageCode == Message_t.Close);

            AppContext.LogManager.LogSysActivity($"Réception d'une notification de déconnexion {ClientStrID(clID)}", true);

            DateTime dt = DateTime.Now;

            AppContext.LogManager.LogSysActivity($"client {ClientStrID(clID)} arrêté le {dt.ToShortDateString()} à {dt.ToLongTimeString()}", true);

            AppContext.LogManager.LogClientActivity(clID, "Déconnexion");
            m_onlineClients.Remove(clID);
            AppContext.LogManager.CloseLogger(clID);
            ClientClosed?.Invoke(clID);

            return(null);
        }
Ejemplo n.º 7
0
        void ProcessRunningClients()
        {
            var deadClients = new List <uint>();


            foreach (uint clID in m_onlineClients.ClientsID)
            {
                ActiveClientsQueue.IClientData clData = m_onlineClients.Get(clID);

                if (clData == null)
                {
                    continue;
                }

                if (--clData.TimeToLive <= TTL_DIE)
                {
                    deadClients.Add(clID);
                }
                else if (clData.TimeToLive <= 0)
                {
                    AppContext.LogManager.LogSysActivity($"Envoi d'un message de synchronisation au client {ClientStrID(clID)}", true);
                    var msg = new Message(++clData.LastSrvMessageID, 0, Message_t.Sync);   //delegate status update to processdialog method
                    DialogEngin.AppendSrvDialog(AppPaths.GetSrvDialogFilePath(clID), msg);
                    AddUpload(Names.GetSrvDialogFile(clID));
                }
            }

            foreach (uint id in deadClients)
            {
                AppContext.LogManager.LogSysActivity($"Client {ClientStrID(id)} présumé déconnecté", true);

                m_onlineClients.Remove(id);
                AppContext.LogManager.CloseLogger(id);
                ClientClosed?.Invoke(id);
            }


            foreach (uint clID in m_onlineClients.ClientsID)
            {
                AddDownload(Names.GetClientDialogFile(clID));
            }
        }
Ejemplo n.º 8
0
        public void DeleteClient(uint clID)
        {
            //remove client from running clients queue if present
            using (m_onlineClients.Lock())
                if (m_onlineClients.Contains(clID))
                {
                    m_onlineClients.Remove(clID);
                    ClientClosed?.Invoke(clID);
                    AppContext.LogManager.CloseLogger(clID);
                }

            // delete: env
            uint[] ids = (from HubClientEnvironment env in m_ndxerClientsEnv.Source.Enumerate()
                          where env.ClientID == clID
                          select env.ID).ToArray();

            for (int i = ids.Length - 1; i >= 0; --i)
            {
                int ndx = m_ndxerClientsEnv.IndexOf(ids[i]);
                m_ndxerClientsEnv.Source.Delete(ndx);
                AppContext.LogManager.LogSysActivity($"Environnement du client {ClientsManager.ClientStrID(clID)} supprimé");
            }


            //delete status
            int ndxStatus = m_ndxerClientsStatus.IndexOf(clID);

            if (ndxStatus >= 0)
            {
                m_ndxerClientsStatus.Source.Delete(ndxStatus);
                AppContext.LogManager.LogSysActivity($"Status du client {ClientsManager.ClientStrID(clID)} supprimé");
            }

            //delete client.
            int ndxClient = m_ndxerClients.IndexOf(clID);

            m_ndxerClients.Source.Delete(ndxClient);
            AppContext.LogManager.LogSysActivity($"Client {ClientsManager.ClientStrID(clID)} supprimé");
        }
Ejemplo n.º 9
0
        private void ProcessClose(SocketAsyncEventArgs e)
        {
            _socket.Shutdown(SocketShutdown.Receive);
            _socket.Close(100);
            _socket.Dispose();

            switch (e.SocketError)
            {
            case SocketError.Success:
                ClientAction(new ClientEventArgs()
                {
                    Command = ClientActions.Disconnected, Connection = this
                });
                break;

            default:
                Debug.WriteLine("{0}: Необработанное исключение. Событие {1}", "ProcessClose", e.SocketError.ToString());
                break;
            }

            ClientClosed?.Invoke(this);

            isPendingCloseIO = false;
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Invokes ClientClosed event
 /// </summary>
 protected void OnClientClosed()
 {
     ClientClosed?.Invoke(this);
 }
Ejemplo n.º 11
0
 public void TriggerClientClosed(UUID ClientID, Scene scene)
 {
     handlerClientClosed = OnClientClosed;
     if (handlerClientClosed != null)
     {
         handlerClientClosed(ClientID, scene);
     }
 }
Ejemplo n.º 12
0
 private void OnClientClosed(TCPClientSession session)
 {
     m_ClientCount--;
     ClientClosed?.Invoke(this, session);
 }
Ejemplo n.º 13
0
 public void NotifyClientClosed(EventArgs e)
 {
     ClientClosed?.Invoke(this, e);
 }
 public static void Fire_ClientClosed(Object sender, ClsStringEventArgs args)
 {
     ClientClosed?.Invoke(sender, args);
 }