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
ff0549ad
Commit
ff0549ad
authored
Feb 22, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
13d5edde
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
go/neo/xneo/nodetab.go
go/neo/xneo/nodetab.go
+8
-6
go/neo/xneo/xneo.go
go/neo/xneo/xneo.go
+2
-1
No files found.
go/neo/xneo/nodetab.go
View file @
ff0549ad
...
...
@@ -71,9 +71,12 @@ type NodeTable struct {
// PeerNode represents a peer node in the cluster.
//
// XXX = peer's nodeinfo + link
// It provides:
//
// - peer's node info (nid, laddr, state, ...), and
// - link to the peer.
type
PeerNode
struct
{
nodeTab
*
NodeTable
//
this node is part of
nodeTab
*
NodeTable
//
we are peer of .nodeTab.localNode
proto
.
NodeInfo
// (.type, .laddr, .nid, .state, .idtime) XXX also protect by mu?
...
...
@@ -220,7 +223,6 @@ func (p *PeerNode) ResetLink(ctx context.Context) {
// dial does low-level work to dial peer
// XXX p.* reading without lock - ok?
// XXX node.MyInfo without lock - ok?
func
(
p
*
PeerNode
)
dial
(
ctx
context
.
Context
)
(
_
*
neonet
.
NodeLink
,
err
error
)
{
node
:=
p
.
nodeTab
.
localNode
mynid
:=
node
.
MyInfo
.
NID
// XXX locking
...
...
@@ -231,7 +233,7 @@ func (p *PeerNode) dial(ctx context.Context) (_ *neonet.NodeLink, err error) {
NID
:
mynid
,
Address
:
node
.
MyInfo
.
Addr
,
ClusterName
:
node
.
ClusterName
,
IdTime
:
node
.
MyInfo
.
IdTime
,
// XXX ok?
IdTime
:
node
.
MyInfo
.
IdTime
,
DevPath
:
nil
,
// XXX stub
NewNID
:
nil
,
// XXX stub
}
...
...
@@ -247,8 +249,8 @@ func (p *PeerNode) dial(ctx context.Context) (_ *neonet.NodeLink, err error) {
case
accept
.
MyNID
!=
p
.
NID
:
err
=
fmt
.
Errorf
(
"connected, but peer's nid is not %s (identifies as %s)"
,
p
.
NID
,
accept
.
MyNID
)
case
accept
.
YourNID
!=
node
.
MyInfo
.
NID
:
err
=
fmt
.
Errorf
(
"connected, but peer gives us nid %s (our is %s)"
,
accept
.
YourNID
,
node
.
MyInfo
.
NID
)
case
accept
.
YourNID
!=
mynid
:
err
=
fmt
.
Errorf
(
"connected, but peer gives us nid %s (our is %s)"
,
accept
.
YourNID
,
mynid
)
}
if
err
!=
nil
{
...
...
go/neo/xneo/xneo.go
View file @
ff0549ad
...
...
@@ -67,8 +67,9 @@ func (cs *ClusterState) Snapshot() *ClusterStateSnapshot {
}
// Node provides base functionality underlying any NEO node.
// Node provides base functionality underlying
implementation of
any NEO node.
//
// XXX vvv was moved to to _MasteredNode
// Every node knows how to talk to master and receives master idea about:
//
// - current node table (all nodes in the cluster),
...
...
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