From ccabb3f182a4cc8d5b527ad75a5214da556fb567 Mon Sep 17 00:00:00 2001 From: Jeffrey Picard Date: Thu, 17 Nov 2022 22:16:12 +0000 Subject: [PATCH] cleanup some peers stuff --- server/notifier.go | 4 ++++ server/session.go | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/server/notifier.go b/server/notifier.go index 9bd69e7..cccbf0a 100644 --- a/server/notifier.go +++ b/server/notifier.go @@ -57,6 +57,10 @@ func (s *Server) RunNotifier() error { case internal.HeightHash: heightHash, _ := notification.(internal.HeightHash) s.DoNotify(&heightHash) + // Do we need this? + // case peerNotification: + // peer, _ := notification.(peerNotification) + // s.notifyPeerSubs(&Peer{Address: peer.address, Port: peer.port}) default: logrus.Warn("unknown notification type") } diff --git a/server/session.go b/server/session.go index 3d7c931..cd0a8a3 100644 --- a/server/session.go +++ b/server/session.go @@ -47,7 +47,7 @@ type session struct { // headersSub indicates header subscription headersSub bool // peersSub indicates peer subscription - peersBool bool + peersSub bool // headersSubRaw indicates the header subscription mode headersSubRaw bool // client provides the ability to send notifications @@ -103,6 +103,9 @@ func (s *session) doNotify(notification interface{}) { } params = []string{orig, status} case peerNotification: + if !s.peersSub { + return + } note, _ := notification.(peerNotification) method = "server.peers.subscribe" params = []string{note.address, note.port}