void FromAdapter_AddClient(Guid[] clientId)
 {
     foreach (var client in clientId)
     {
         if (client != this.clientId && clientTable.Get(client) == null)
         {
             clientTable.AddOrUpdate(client);
             if (isStarted)
             {
                 RemoteClientUpdated?.Invoke(this, new ClientWithVirtualHostSettingEventArgs(client, Guid.Empty, null));
             }
         }
     }
 }
示例#2
0
 void OnHelloReceived()
 {
     foreach (var client in clients)
     {
         var setting = clientTable.Get(client.Key);
         if (client.Value == Guid.Empty)
         {
             SendingRefreshClient(client.Key, null);
         }
         else
         {
             SendingRefreshClient(client.Key, BuildSettingData(client.Value, setting.VirtualHosts));
         }
     }
 }
示例#3
0
        /// <inheritdoc/>
        public bool TryGetVirtualHosts(Guid clientId, out KeyValuePair <Guid, VirtualHostSetting>[] settings)
        {
            var entity = clientTable.Get(clientId);

            if (entity == null)
            {
                settings = default;
                return(false);
            }
            else
            {
                if (entity.IsVirtualHostsDisabled)
                {
                    settings = default;
                }
                else
                {
                    settings = entity.GetVirtualHosts();
                }
                return(true);
            }
        }