Commit ff0549ad authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 13d5edde
......@@ -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 {
......
......@@ -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),
......
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