Commit 4a9252a6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e21fe877
......@@ -486,16 +486,9 @@ loop:
// peer (should be) disconnected
case n := <-m.nodeLeaveq:
// XXX -> move to func
peer := n.peer
peer.node.ResetLink(ctx)
delete(m.peerTab, peer.node.NID)
m.updateNodeState(ctx, peer.node, proto.DOWN)
m.disconnectPeer(ctx, n.peer)
updateReadyToStart()
// node comes in and asks to be identified
case n := <-m.nodeComeq:
peer, ok := m.identify(ctx, n,
......@@ -706,8 +699,7 @@ loop:
// peer (should be) disconnected
case n := <-m.nodeLeaveq:
// XXX update
n.node.SetState(proto.DOWN)
m.disconnectPeer(ctx, n.peer)
// if cluster became non-operational - we cancel verification
if !m.node.State.PartTab.OperationalWith(m.node.State.NodeTab) {
......@@ -1052,6 +1044,14 @@ func (m *Master) serveClient1(ctx context.Context, req proto.Msg) (resp proto.Ms
// ----------------------------------------
// disconnectPeer resets link to the peer and sets its state to DOWN in nodeTab.
// other peers are notified with δnodeTab about it.
func (m *Master) disconnectPeer(ctx context.Context, peer *_MasteredPeer) {
peer.node.ResetLink(ctx)
delete(m.peerTab, peer.node.NID)
m.updateNodeState(ctx, peer.node, proto.DOWN)
}
// updateNodeTab = .nodeTab.Update + send δnodeTab to all subscribers.
// XXX place
// called from main master process. XXX
......@@ -1069,6 +1069,7 @@ func (m *Master) updateNodeTab(ctx context.Context, nodeInfo proto.NodeInfo) *xn
default:
}
// XXX try to move logging into other place - so that we could remove ctx arg here
log.Warningf(ctx, "peer %s is slow -> detaching it", nid)
close(peer.notifyqOverflow)
// TODO delete(m.peerTab, nid) -> p.cancel()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment