コード例 #1
0
#pragma warning restore CS4014

        public string Trace()
        {
            var trace = $"Routing table of [{_address.ToHex()}]\n";
            var count = 0;

            for (var i = 0; i < _tableSize; i++)
            {
                if (_routing.BucketOf(i).IsEmpty())
                {
                    continue;
                }

                trace += $"**Bucket {i}**\n";
                trace  = _routing.BucketOf(i).PeerStates.Aggregate(trace, (current, state) =>
                                                                   current +
                                                                   $"| {++count}: [{state.Address.ToHex()}]\n" +
                                                                   $"| - LastUpdated: {state.LastUpdated}\n" +
                                                                   $"| - LastChecked: {state.LastChecked}\n" +
                                                                   $"| - Latency: {state.Latency?.Milliseconds}ms\n");

                trace = trace.TrimEnd(' ', ',');
            }

            return($"Total peer count: {count}\n{trace.Trim('\n')}");
        }
コード例 #2
0
#pragma warning restore CS4014

        public string Trace()
        {
            var trace = $"Routing table of [{_address.ToHex()}]\n";
            var count = 0;

            for (var i = 0; i < _tableSize; i++)
            {
                if (_routing.BucketOf(i).IsEmpty())
                {
                    continue;
                }

                trace += $"**Bucket {i}**\n";
                trace  = _routing.BucketOf(i).Peers.Aggregate(trace, (current, peer) =>
                                                              current + $"{++count} : [{peer.Address.ToHex()}]\n");

                trace = trace.TrimEnd(' ', ',');
            }

            return($"Total peer count: {count}\n{trace.Trim('\n')}");
        }