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
58455af2
Commit
58455af2
authored
Feb 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c17c904b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
go/neo/master.go
go/neo/master.go
+10
-10
No files found.
go/neo/master.go
View file @
58455af2
...
...
@@ -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
...
...
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