Exemple #1
0
 /// <inheritdoc/>
 public bool IsConnected(HeadId headId)
 {
     lock (All)
     {
         return(All.Any(_ => _.HeadId == headId));
     }
 }
Exemple #2
0
 /// <inheritdoc/>
 public Head GetById(HeadId headId)
 {
     lock (All)
     {
         return(All.SingleOrDefault(_ => _.HeadId == headId));
     }
 }
Exemple #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Error != 0)
            {
                hash ^= Error.GetHashCode();
            }
            if (UserId != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (Nickname.Length != 0)
            {
                hash ^= Nickname.GetHashCode();
            }
            if (Sex != 0)
            {
                hash ^= Sex.GetHashCode();
            }
            if (HeadId != 0)
            {
                hash ^= HeadId.GetHashCode();
            }
            if (Coin != 0)
            {
                hash ^= Coin.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #4
0
 /// <inheritdoc/>
 public bool IsConnected(HeadId headId)
 {
     lock (_heads)
     {
         return(_heads.Any(_ => _.HeadId == headId));
     }
 }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Head"/> class.
        /// </summary>
        /// <param name="headId"><see cref="HeadId"/> of the client.</param>
        /// <param name="host">Hostname of the client.</param>
        /// <param name="port">TCP port to connect back to the client.</param>
        /// <param name="runtime">Runtime information from the client.</param>
        /// <param name="servicesByName">Names of services exposed.</param>
        /// <param name="connectionTime">Time of when client was connected.</param>
        public Head(
            HeadId headId,
            string host,
            int port,
            string runtime,
            IEnumerable <string> servicesByName,
            DateTimeOffset connectionTime)
        {
            HeadId         = headId;
            Host           = host;
            Port           = port;
            Runtime        = runtime;
            ServicesByName = servicesByName;
            ConnectionTime = connectionTime;

            var keepAliveTime         = new ChannelOption("grpc.keepalive_time", 1000);
            var keepAliveTimeout      = new ChannelOption("grpc.keepalive_timeout_ms", 500);
            var keepAliveWithoutCalls = new ChannelOption("grpc.keepalive_permit_without_calls", 1);

            Channel = new Channel(
                host,
                (int)port,
                ChannelCredentials.Insecure,
                new[] { keepAliveTime, keepAliveTimeout, keepAliveWithoutCalls });
        }
Exemple #6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (SceneId != 0)
            {
                hash ^= SceneId.GetHashCode();
            }
            if (TalkId != 0)
            {
                hash ^= TalkId.GetHashCode();
            }
            if (SceneName.Length != 0)
            {
                hash ^= SceneName.GetHashCode();
            }
            if (HeadId != 0)
            {
                hash ^= HeadId.GetHashCode();
            }
            if (PicId != 0)
            {
                hash ^= PicId.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Blogger.Length != 0)
            {
                hash ^= Blogger.GetHashCode();
            }
            if (BtnTxt.Length != 0)
            {
                hash ^= BtnTxt.GetHashCode();
            }
            if (Content.Length != 0)
            {
                hash ^= Content.GetHashCode();
            }
            if (Reading != 0)
            {
                hash ^= Reading.GetHashCode();
            }
            if (Comments != 0)
            {
                hash ^= Comments.GetHashCode();
            }
            if (Likes != 0)
            {
                hash ^= Likes.GetHashCode();
            }
            hash ^= selectIds_.GetHashCode();
            return(hash);
        }
Exemple #7
0
 /// <inheritdoc/>
 public void Disconnect(HeadId headId)
 {
     lock (All)
     {
         var head = All.SingleOrDefault(_ => _.HeadId == headId);
         if (head != null)
         {
             _logger.Debug("Disconnecting head '{HeadId}'", headId);
             All.Remove(head);
         }
     }
 }
Exemple #8
0
 /// <inheritdoc/>
 public void Disconnect(HeadId headId)
 {
     lock (_heads)
     {
         var head = _heads.SingleOrDefault(_ => _.HeadId == headId);
         if (head != null)
         {
             _logger.Information($"Disconnecting head '{headId}'");
             _heads?.Remove(head);
         }
     }
 }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Head"/> class.
 /// </summary>
 /// <param name="headId"><see cref="HeadId"/> of the client.</param>
 /// <param name="host">The hostname of the <see cref="Head"/>.</param>
 /// <param name="runtime">Runtime information from the client.</param>
 /// <param name="version">Version of the <see cref="Head"/>.</param>
 /// <param name="connectionTime">Time of when client was connected.</param>
 public Head(
     HeadId headId,
     string host,
     string runtime,
     string version,
     DateTimeOffset connectionTime)
 {
     HeadId         = headId;
     Host           = host;
     Runtime        = runtime;
     Version        = version;
     ConnectionTime = connectionTime;
 }
Exemple #10
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (HeadId.Length != 0)
        {
            hash ^= HeadId.GetHashCode();
        }
        hash ^= transactionIds_.GetHashCode();
        if (paging_ != null)
        {
            hash ^= Paging.GetHashCode();
        }
        hash ^= sorting_.GetHashCode();
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
    public override int GetHashCode()
    {
        int hash = 1;

        if (Status != 0)
        {
            hash ^= Status.GetHashCode();
        }
        hash ^= blocks_.GetHashCode();
        if (HeadId.Length != 0)
        {
            hash ^= HeadId.GetHashCode();
        }
        if (paging_ != null)
        {
            hash ^= Paging.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
Exemple #12
0
 /// <inheritdoc/>
 public Head GetById(HeadId headId)
 {
     return(_heads.SingleOrDefault(_ => _.HeadId == headId));
 }
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Head"/> class.
 /// </summary>
 /// <param name="id"><see cref="HeadId">Id</see> of the client.</param>
 public Head(HeadId id)
 {
     Id = id;
 }