From 2260ff61b5b4991fefe8257792f6c193f9a7a6b3 Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Thu, 22 Feb 2018 23:32:47 +0100 Subject: [PATCH] Log the number of channels broadcasts are sent to --- server/socketio.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/socketio.go b/server/socketio.go index 647e234f..bd5b3789 100644 --- a/server/socketio.go +++ b/server/socketio.go @@ -670,12 +670,14 @@ func (s *SocketIoServer) onSubscribe(c *gosocketio.Channel, req []byte) interfac // OnNewBlockHash notifies users subscribed to bitcoind/hashblock about new block func (s *SocketIoServer) OnNewBlockHash(hash string) { - glog.Info("broadcasting new block hash ", hash) - s.server.BroadcastTo("bitcoind/hashblock", "bitcoind/hashblock", hash) + c := s.server.BroadcastTo("bitcoind/hashblock", "bitcoind/hashblock", hash) + glog.Info("broadcasting new block hash ", hash, " to ", c, " channels") } // OnNewTxAddr notifies users subscribed to bitcoind/addresstxid about new block func (s *SocketIoServer) OnNewTxAddr(txid string, addr string) { - glog.Info("broadcasting new txid ", txid, " for addr ", addr) - s.server.BroadcastTo("bitcoind/addresstxid-"+addr, "bitcoind/addresstxid", map[string]string{"address": addr, "txid": txid}) + c := s.server.BroadcastTo("bitcoind/addresstxid-"+addr, "bitcoind/addresstxid", map[string]string{"address": addr, "txid": txid}) + if c > 0 { + glog.Info("broadcasting new txid ", txid, " for addr ", addr, " to ", c, " channels") + } }