Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }