Commit 339da2c1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a9daebaf
......@@ -1209,14 +1209,14 @@ type Request struct {
func (link *NodeLink) Recv1() (Request, error) {
conn, err := link.Accept(/*context.TODO()*/) // XXX remove context?
if err != nil {
return Request{}, nil // XXX or return *Request? (want to avoid alloc)
return Request{}, err // XXX or return *Request? (want to avoid alloc)
}
// NOTE serveRecv guaranty that when a conn is accepted, there is 1 message in conn.rxq
msg, err := conn.Recv()
if err != nil {
conn.Close() // XXX -> lclose(conn)
return Request{}, nil
return Request{}, err
}
// noone will be reading from conn anymore - shutdown rx so that if
......
......@@ -358,8 +358,7 @@ func TestMasterStorage(t *testing.T) {
IdTimestamp: 0,
}))
// XXX vvv reenable
//tc.Expect(node(M.nodeTab, "", neo.CLIENT, 1, neo.RUNNING, 0.01))
tc.Expect(node(M.nodeTab, "", neo.CLIENT, 1, neo.RUNNING, 0.02))
tc.Expect(conntx("m:3", "c:1", 1, &neo.AcceptIdentification{
NodeType: neo.MASTER,
......
......@@ -899,6 +899,7 @@ func storCtlService1(ctx context.Context, stor *neo.Node) (err error) {
// ----------------------------------------
// identify processes identification request of just connected node and either accepts or declines it.
//
// If node identification is accepted .nodeTab is updated and corresponding node entry is returned.
// Response message is constructed but not send back not to block the caller - it is
// the caller responsibility to send the response to node which requested identification.
......@@ -929,12 +930,20 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (node *neo.Node, resp
return &neo.Error{neo.PROTOCOL_ERROR, fmt.Sprintf("uuid %v already used by another node", uuid)}
}
// XXX accept only certain kind of nodes depending on .clusterState, e.g.
// accept only certain kind of nodes depending on .clusterState, e.g.
// XXX ok to have this logic inside identify? (better provide from outside ?)
switch nodeType {
case neo.CLIENT:
if m.clusterState != neo.ClusterRunning {
return &neo.Error{neo.NOT_READY, "cluster not operational"}
}
case neo.STORAGE:
// ok
// XXX ...
// TODO +master, admin
default:
return &neo.Error{neo.PROTOCOL_ERROR, fmt.Sprintf("not accepting node type %v", nodeType)}
}
return nil
......
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