MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / Connect

Method Connect

conn/node.go:527–546  ·  view source on GitHub ↗

Connect connects the node and makes its peerPool refer to the constructed pool and address (possibly updating ourselves from the old address.) (Unless pid is ourselves, in which case this does nothing.)

(pid uint64, addr string)

Source from the content-addressed store, hash-verified

525// (possibly updating ourselves from the old address.) (Unless pid is ourselves, in which
526// case this does nothing.)
527func (n *Node) Connect(pid uint64, addr string) {
528 if pid == n.Id {
529 return
530 }
531 if paddr, ok := n.Peer(pid); ok && paddr == addr {
532 // Already connected.
533 return
534 }
535 // Here's what we do. Right now peerPool maps peer node id's to addr values. If
536 // a *pool can be created, good, but if not, we still create a peerPoolEntry with
537 // a nil *pool.
538 if addr == n.MyAddr {
539 // TODO: Note this fact in more general peer health info somehow.
540 glog.Infof("Peer %d claims same host as me\n", pid)
541 n.SetPeer(pid, addr)
542 return
543 }
544 GetPools().Connect(addr, n.tlsClientConfig)
545 n.SetPeer(pid, addr)
546}
547
548// DeletePeer deletes the record of the peer with the given id.
549func (n *Node) DeletePeer(pid uint64) {

Callers 1

joinClusterMethod · 0.95

Calls 5

PeerMethod · 0.95
SetPeerMethod · 0.95
GetPoolsFunction · 0.85
InfofMethod · 0.80
ConnectMethod · 0.65

Tested by

no test coverage detected