public async Task DisconnectAsync(IPeer peer, bool sendDisconnect = false)
        {
            // clean the pool
            if (_peerPool.RemovePeer(peer.Info.Pubkey) == null)
            {
                Logger.LogWarning($"{peer} was not found in pool.");
            }

            // cancel any pending reconnection
            _reconnectionService.CancelReconnection(peer.RemoteEndpoint.ToString());

            // dispose the peer
            await peer.DisconnectAsync(sendDisconnect);

            Logger.LogInformation($"Removed peer {peer}");
        }
Exemplo n.º 2
0
        public async Task DisconnectAsync(IPeer peer, bool sendDisconnect = false)
        {
            if (peer == null)
            {
                throw new ArgumentNullException(nameof(peer));
            }

            // clean the pool
            if (_peerPool.RemovePeer(peer.Info.Pubkey) == null)
            {
                Logger.LogWarning($"{peer} was not found in pool.");
            }

            // clean the peer
            await peer.DisconnectAsync(sendDisconnect);

            Logger.LogDebug($"Removed peer {peer}");
        }