fix tests halting
Jeromy committed
Nov 19, 2014 at 23:34 UTC
e4b2ae3bb2b946e0161a17ec1359d0a819d253c9
2 files changed
+5
-1
exchange/bitswap/bitswap.go
+4
@@ -117,6 +117,9 @@ func (bs *bitswap) GetBlocks(parent context.Context, ks []u.Key) (*blocks.Block,
117
}
118
119
func (bs *bitswap) sendWantListTo(ctx context.Context, peers <-chan peer.Peer) error {
120
+ if peers == nil {
121
+ panic("Cant send wantlist to nil peerchan")
122
+ }
123
message := bsmsg.New()
124
for _, wanted := range bs.wantlist.Keys() {
125
message.AddWanted(wanted)
@@ -164,6 +167,7 @@ func (bs *bitswap) run(ctx context.Context) {
167
for {
168
select {
169
case <-broadcastSignal:
170
+ unsentKeys = 0
171
wantlist := bs.wantlist.Keys()
172
if len(wantlist) == 0 {
173
continue
routing/mock/routing.go
+1
-1
@@ -59,7 +59,7 @@ func (mr *MockRouter) FindProviders(ctx context.Context, key u.Key) ([]peer.Peer
59
}
60
61
func (mr *MockRouter) FindPeer(ctx context.Context, pid peer.ID) (peer.Peer, error) {
62
- log.Debug("FindPeer: %s", pid)
62
+ log.Debugf("FindPeer: %s", pid)
63
return nil, nil
64
}
65