diff options
author | Sonic <sonic@cobinhood.com> | 2018-09-25 14:56:57 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:48 +0800 |
commit | 41433314bbb6db749db36ad1f479b103cea0539c (patch) | |
tree | f2fe3a3f7d69b8e07be6e25ac41302959a57ea7a /p2p/peer.go | |
parent | 5806428c3132a2b86fb8ff3e34f1b2e37ff16bb7 (diff) | |
download | dexon-41433314bbb6db749db36ad1f479b103cea0539c.tar dexon-41433314bbb6db749db36ad1f479b103cea0539c.tar.gz dexon-41433314bbb6db749db36ad1f479b103cea0539c.tar.bz2 dexon-41433314bbb6db749db36ad1f479b103cea0539c.tar.lz dexon-41433314bbb6db749db36ad1f479b103cea0539c.tar.xz dexon-41433314bbb6db749db36ad1f479b103cea0539c.tar.zst dexon-41433314bbb6db749db36ad1f479b103cea0539c.zip |
p2p: implement AddNotaryPeer and RemoveNotaryPeer
AddNotaryPeer adds node to static node set so that server will maintain
the connection with the notary node.
AddNotaryPeer also sets the notaryConn flag to allow the node to always
connect, even if the slot are full.
RemoveNotaryPeer removes node from static, then disconnect and unsets
the notaryConn flag.
Diffstat (limited to 'p2p/peer.go')
-rw-r--r-- | p2p/peer.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/p2p/peer.go b/p2p/peer.go index af019d07a..4828d3234 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -434,6 +434,7 @@ type PeerInfo struct { RemoteAddress string `json:"remoteAddress"` // Remote endpoint of the TCP data connection Inbound bool `json:"inbound"` Trusted bool `json:"trusted"` + Notary bool `json:"notary"` Static bool `json:"static"` } `json:"network"` Protocols map[string]interface{} `json:"protocols"` // Sub-protocol specific metadata fields @@ -458,6 +459,7 @@ func (p *Peer) Info() *PeerInfo { info.Network.RemoteAddress = p.RemoteAddr().String() info.Network.Inbound = p.rw.is(inboundConn) info.Network.Trusted = p.rw.is(trustedConn) + info.Network.Notary = p.rw.is(notaryConn) info.Network.Static = p.rw.is(staticDialedConn) // Gather all the running protocol infos |