Ejemplo n.º 1
0
 public bool IsLoggedIn(string deviceId)
 {
     lock (_lock)
     {
         return(LoggedInConnections.ContainsKey(deviceId));
     }
 }
Ejemplo n.º 2
0
        public void PromoteToLoggedInConnection(IPersistentConnection connection, string deviceId, long numericDeviceId)
        {
            if (deviceId == null)
            {
                throw new ArgumentNullException(nameof(deviceId));
            }

            lock (_lock)
            {
                InitiatedConnections.Remove(connection.ConnectionId);

                connection.DeviceId        = deviceId;
                connection.NumericDeviceId = numericDeviceId;
                connection.ConnectionState = ConnectionState.LoggedIn;
                connection.Heartbeat();
                LoggedInConnections.Add(connection.DeviceId, connection);
            }
        }
Ejemplo n.º 3
0
        public void CloseConnection(IPersistentConnection connection)
        {
            lock (_lock)
            {
                connection.ConnectionState  = ConnectionState.None;
                connection.SubscriptionType = SubscriptionType.None;

                if (connection.DeviceId == null)
                {
                    InitiatedConnections.Remove(connection.ConnectionId);
                }
                else
                {
                    LoggedInConnections.Remove(connection.DeviceId);
                    SubscribedConnections.Remove(connection.DeviceId);
                }
            }
        }