Exemplo n.º 1
0
        private int GetPageCount()
        {
            var peerCount = _peerRepository.Count();

            if (peerCount == 0)
            {
                return(1);
            }

            var pages = (int)Math.Ceiling(peerCount / (decimal)_peersPerCycle);

            return(pages);
        }
Exemplo n.º 2
0
        /// <summary>Increments the received count.</summary>
        /// <param name="correlationId">The correlation identifier.</param>
        private async Task <BroadcastMessage> GetOrCreateAsync(ICorrelationId correlationId)
        {
            var request = await _pendingRequests.GetOrCreateAsync(correlationId.Id, async entry =>
            {
                entry.SetOptions(_entryOptions());
                var gossipRequest = await Task.FromResult(new BroadcastMessage
                {
                    ReceivedCount   = 0,
                    BroadcastCount  = 0,
                    PeerNetworkSize = _peers.Count()
                }).ConfigureAwait(false);
                entry.Value = gossipRequest;
                return(gossipRequest);
            }).ConfigureAwait(false);

            return(request);
        }
Exemplo n.º 3
0
 private int GetAvaliablePeerCount() => Math.Min(_maxPeersInStore, _peerRepository.Count());