From 1a6eb2ef0061f59f923c61f86bedb1e9b80d2b07 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Mon, 11 Feb 2019 16:03:25 +0400 Subject: [PATCH] godoc comments --- libs/pubsub/pubsub.go | 2 ++ rpc/client/httpclient.go | 8 +++----- rpc/core/pipe.go | 6 +++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libs/pubsub/pubsub.go b/libs/pubsub/pubsub.go index 43d172b6..7b5ff057 100644 --- a/libs/pubsub/pubsub.go +++ b/libs/pubsub/pubsub.go @@ -242,12 +242,14 @@ func (s *Server) UnsubscribeAll(ctx context.Context, clientID string) error { } } +// NumClients returns the number of clients. func (s *Server) NumClients() int { s.mtx.RLock() defer s.mtx.RUnlock() return len(s.subscriptions) } +// NumClientSubscriptions returns the number of subscriptions the client has. func (s *Server) NumClientSubscriptions(clientID string) int { s.mtx.RLock() defer s.mtx.RUnlock() diff --git a/rpc/client/httpclient.go b/rpc/client/httpclient.go index cd2f3363..5ff28570 100644 --- a/rpc/client/httpclient.go +++ b/rpc/client/httpclient.go @@ -272,6 +272,7 @@ func newWSEvents(cdc *amino.Codec, remote, endpoint string) *WSEvents { return wsEvents } +// OnStart implements cmn.Service by starting WSClient and event loop. func (w *WSEvents) OnStart() error { w.ws = rpcclient.NewWSClient(w.remote, w.endpoint, rpcclient.OnReconnect(func() { w.redoSubscriptions() @@ -287,12 +288,9 @@ func (w *WSEvents) OnStart() error { return nil } -// Stop wraps the BaseService/eventSwitch actions as Start does +// OnStop implements cmn.Service by stopping WSClient. func (w *WSEvents) OnStop() { - err := w.ws.Stop() - if err != nil { - w.Logger.Error("failed to stop WSClient", "err", err) - } + _ = w.ws.Stop() } // Subscribe implements EventsClient by using WSClient to subscribe given diff --git a/rpc/core/pipe.go b/rpc/core/pipe.go index ecb4e0eb..721a38a6 100644 --- a/rpc/core/pipe.go +++ b/rpc/core/pipe.go @@ -74,9 +74,13 @@ var ( logger log.Logger - // XXX: godoc comment + // config variables + + // MaxSubscriptionClients mirrors RPCConfig.MaxSubscriptionClients MaxSubscriptionClients int + // MaxSubscriptionsPerClient mirrors RPCConfig.MaxSubscriptionsPerClient MaxSubscriptionsPerClient int + // TimeoutBroadcastTxCommit mirrors RPCConfig.TimeoutBroadcastTxCommit TimeoutBroadcastTxCommit time.Duration )