From 5bbd755eddf72e37b2f7dcb19a5650adfd90f3e9 Mon Sep 17 00:00:00 2001 From: Sonic Date: Tue, 25 Sep 2018 14:56:57 +0800 Subject: 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. --- p2p/peer.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'p2p/peer.go') 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 -- cgit v1.2.3