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

.

parent e21fe877
...@@ -486,16 +486,9 @@ loop: ...@@ -486,16 +486,9 @@ loop:
// peer (should be) disconnected // peer (should be) disconnected
case n := <-m.nodeLeaveq: case n := <-m.nodeLeaveq:
// XXX -> move to func m.disconnectPeer(ctx, n.peer)
peer := n.peer
peer.node.ResetLink(ctx)
delete(m.peerTab, peer.node.NID)
m.updateNodeState(ctx, peer.node, proto.DOWN)
updateReadyToStart() updateReadyToStart()
// node comes in and asks to be identified // node comes in and asks to be identified
case n := <-m.nodeComeq: case n := <-m.nodeComeq:
peer, ok := m.identify(ctx, n, peer, ok := m.identify(ctx, n,
...@@ -706,8 +699,7 @@ loop: ...@@ -706,8 +699,7 @@ loop:
// peer (should be) disconnected // peer (should be) disconnected
case n := <-m.nodeLeaveq: case n := <-m.nodeLeaveq:
// XXX update m.disconnectPeer(ctx, n.peer)
n.node.SetState(proto.DOWN)
// if cluster became non-operational - we cancel verification // if cluster became non-operational - we cancel verification
if !m.node.State.PartTab.OperationalWith(m.node.State.NodeTab) { 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 ...@@ -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. // updateNodeTab = .nodeTab.Update + send δnodeTab to all subscribers.
// XXX place // XXX place
// called from main master process. XXX // called from main master process. XXX
...@@ -1069,6 +1069,7 @@ func (m *Master) updateNodeTab(ctx context.Context, nodeInfo proto.NodeInfo) *xn ...@@ -1069,6 +1069,7 @@ func (m *Master) updateNodeTab(ctx context.Context, nodeInfo proto.NodeInfo) *xn
default: 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) log.Warningf(ctx, "peer %s is slow -> detaching it", nid)
close(peer.notifyqOverflow) close(peer.notifyqOverflow)
// TODO delete(m.peerTab, nid) -> p.cancel() // 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