aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/peer.go
diff options
context:
space:
mode:
authorSonic <sonic@cobinhood.com>2018-09-25 14:56:57 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-19 18:45:25 +0800
commit100b29dc149edb687485bf97befd20d49044f525 (patch)
treecbb7a40c1685b9d99e0acaf270133a87e390565e /p2p/peer.go
parentda57d63fac0679e343a068dd3fc1d7702ca78ea4 (diff)
downloaddexon-100b29dc149edb687485bf97befd20d49044f525.tar
dexon-100b29dc149edb687485bf97befd20d49044f525.tar.gz
dexon-100b29dc149edb687485bf97befd20d49044f525.tar.bz2
dexon-100b29dc149edb687485bf97befd20d49044f525.tar.lz
dexon-100b29dc149edb687485bf97befd20d49044f525.tar.xz
dexon-100b29dc149edb687485bf97befd20d49044f525.tar.zst
dexon-100b29dc149edb687485bf97befd20d49044f525.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.go2
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