From ffaacc0985c9e9eff14ae76596269b991b6b6fbb Mon Sep 17 00:00:00 2001 From: Jeffrey Picard Date: Thu, 20 Oct 2022 09:23:31 +0000 Subject: [PATCH] cleanup and add manage goroutine to stopper pattern --- server/args.go | 3 +-- server/jsonrpc_server.go | 2 +- server/server.go | 3 --- server/session.go | 2 ++ 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/server/args.go b/server/args.go index 1798713..1f6438c 100644 --- a/server/args.go +++ b/server/args.go @@ -84,7 +84,6 @@ const ( DefaultBannerFile = "" DefaultCountry = "US" - GENESIS_HASH = "9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463" HUB_PROTOCOL_VERSION = "0.107.0" PROTOCOL_MIN = "0.54.0" PROTOCOL_MAX = "0.199.0" @@ -303,7 +302,7 @@ func ParseArgs(searchRequest *pb.SearchRequest) *Args { BlockingChannelIds: *blockingChannelIds, FilteringChannelIds: *filteringChannelIds, - GenesisHash: GENESIS_HASH, + GenesisHash: "", ServerVersion: HUB_PROTOCOL_VERSION, ProtocolMin: PROTOCOL_MIN, ProtocolMax: PROTOCOL_MAX, diff --git a/server/jsonrpc_server.go b/server/jsonrpc_server.go index 9f35896..a818966 100644 --- a/server/jsonrpc_server.go +++ b/server/jsonrpc_server.go @@ -39,7 +39,7 @@ func (t *ServerService) Features(req *ServerFeaturesReq, res **ServerFeaturesRes ServerVersion: HUB_PROTOCOL_VERSION, ProtocolMin: PROTOCOL_MIN, ProtocolMax: PROTOCOL_MAX, - GenesisHash: GENESIS_HASH, + GenesisHash: t.Args.GenesisHash, Description: t.Args.ServerDescription, PaymentAddress: t.Args.PaymentAddress, DonationAddress: t.Args.DonationAddress, diff --git a/server/server.go b/server/server.go index 8920ef9..ce4060e 100644 --- a/server/server.go +++ b/server/server.go @@ -268,14 +268,11 @@ func MakeHubServer(grp *stop.Group, args *Args) *Server { //TODO: is this the right place to load the db? var myDB *db.ReadOnlyDBColumnFamily - // var dbShutdown = func() {} if !args.DisableResolve { myDB, err = LoadDatabase(args, grp) if err != nil { logrus.Warning(err) } - // myDB.Grp = stop.New(grp) - // myDB.Grp.Add(1) } // Determine which chain to use based on db and cli values diff --git a/server/session.go b/server/session.go index e9b4f53..98f3f8c 100644 --- a/server/session.go +++ b/server/session.go @@ -147,6 +147,7 @@ func newSessionManager(db *db.ReadOnlyDBColumnFamily, args *Args, grp *stop.Grou } func (sm *sessionManager) start() { + sm.grp.Add(1) go sm.manage() } @@ -175,6 +176,7 @@ func (sm *sessionManager) manage() { // Wait for next management clock tick. select { case <-sm.grp.Ch(): + sm.grp.Done() return case <-sm.manageTicker.C: continue