@cryptotaxi247 / kubo / commits / 6a5bc4b87

fix(bs/n) remove unnecessary variable

to remove ambiguity (before it was possible to loop over either topics or keys by only keeping keys, there's no confusing about what to use for the loop range License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Brian Tiger Chow committed Nov 21, 2014 at 17:43 UTC 6a5bc4b879676aeb71951f6f03365048e6d96fda
1 file changed +3 -3
exchange/bitswap/notifications/notifications.go
+3 -3
@@ -37,14 +37,14 @@ func (ps *impl) Shutdown() {
37 // is closed if the |ctx| times out or is cancelled, or after sending len(keys)
38 // blocks.
39 func (ps *impl) Subscribe(ctx context.Context, keys ...u.Key) <-chan *blocks.Block {
40 - topics := toStrings(keys)
40 +
41 blocksCh := make(chan *blocks.Block, len(keys))
42 valuesCh := make(chan interface{}, len(keys))
43 - ps.wrapped.AddSub(valuesCh, topics...)
43 + ps.wrapped.AddSub(valuesCh, toStrings(keys)...)
44
45 go func() {
46 defer func() {
47 - ps.wrapped.Unsub(valuesCh, topics...)
47 + ps.wrapped.Unsub(valuesCh, toStrings(keys)...)
48 close(blocksCh)
49 }()
50 for _, _ = range keys {