Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
339da2c1
Commit
339da2c1
authored
Aug 31, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a9daebaf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
go/neo/connection.go
go/neo/connection.go
+2
-2
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+1
-2
go/neo/server/master.go
go/neo/server/master.go
+12
-3
No files found.
go/neo/connection.go
View file @
339da2c1
...
...
@@ -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
...
...
go/neo/server/cluster_test.go
View file @
339da2c1
...
...
@@ -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
,
...
...
go/neo/server/master.go
View file @
339da2c1
...
...
@@ -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
:
return
&
neo
.
Error
{
neo
.
NOT_READY
,
"cluster not operational"
}
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment