Commit 58455af2 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c17c904b
......@@ -1078,10 +1078,6 @@ func (m *Master) notifyAll(ctx context.Context, event _ΔClusterState) {
// corresponding peer entry is returned. New task is spawned to reply with
// either reject or accept + notify.
func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer, ok bool) {
// XXX also verify ? :
// - NodeType valid
// - IdTime ?
nid := n.idReq.NID
nodeType := n.idReq.NodeType
......@@ -1095,6 +1091,9 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
}
// TODO nid < 0 (temporary) -> reallocate if conflict ?
// TODO check nid matches NodeType
// TODO verify NodeType valid
// XXX handle IdTime ?
node := m.node.State.NodeTab.Get(nid)
if node != nil {
......@@ -1122,14 +1121,15 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
return nil
}()
subj := fmt.Sprintf("identify: %s (%s)", n.req.Link().RemoteAddr(), n.idReq.NID)
link := n.req.Link()
subj := fmt.Sprintf("identify: %s (%s)", link.RemoteAddr(), n.idReq.NID)
if err != nil {
log.Infof(ctx, "%s: rejecting: %s", subj, err)
m.mainWG.Go(func(ctx context.Context) error {
// XXX close link on ctx cancel
n.req.Reply(err)
n.req.Link().Close()
// XXX log err (if any)
xxcontext.WithCloseOnErrCancel(ctx, link, func() error {
n.req.Reply(err)
return fmt.Errorf("X") // to close link
})
return nil // not to cancel main by a failing reject
})
return nil, false
......@@ -1163,7 +1163,7 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
}
node := m.updateNodeTab(ctx, nodeInfo)
node.SetLink(n.req.Link())
node.SetLink(link)
// create peer with nodeTab/partTab snapshot to push to accepted node
......
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