public void should_delete_peers() { _transactionPool = CreatePool(_noTransactionStorage); var peers = GetPeers(); foreach ((ISynchronizationPeer peer, _) in peers) { _transactionPool.AddPeer(peer); } foreach ((ISynchronizationPeer peer, _) in peers) { _transactionPool.RemovePeer(peer.Node.Id); } }
private void SessionDisconnected(object sender, DisconnectEventArgs e) { ISession session = (ISession)sender; session.Initialized -= SessionInitialized; session.Disconnected -= SessionDisconnected; if (_syncPeers.ContainsKey(session.SessionId)) { ISynchronizationPeer syncPeer = _syncPeers[session.SessionId]; _syncManager.RemovePeer(syncPeer); _transactionPool.RemovePeer(syncPeer.Node.Id); } _sessions.TryRemove(session.SessionId, out session); }
private void SessionDisconnected(object sender, DisconnectEventArgs e) { ISession session = (ISession)sender; session.Initialized -= SessionInitialized; session.Disconnected -= SessionDisconnected; if (_syncPeers.ContainsKey(session.SessionId)) { ISynchronizationPeer syncPeer = _syncPeers[session.SessionId]; _syncManager.RemovePeer(syncPeer); _transactionPool.RemovePeer(syncPeer.Node.Id); if (_logger.IsDebug) { _logger.Debug($"{session.Node.ClientId} sync peer {session} disconnected {e.DisconnectType} {e.DisconnectReason}"); } } _sessions.TryRemove(session.SessionId, out session); }