Commit d85169e0 authored by Nemanja Zbiljić's avatar Nemanja Zbiljić Committed by GitHub

Pushsync should not blocklist peer (#1011)

parent 3ceb51de
......@@ -31,7 +31,6 @@ const (
const (
maxPeers = 5
blocklistDuration = time.Minute
)
type PushSyncer interface {
......@@ -311,9 +310,6 @@ func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Re
_ = streamer.Reset()
lastErr = fmt.Errorf("chunk deliver to peer %s: %w", peer.String(), err)
ps.logger.Debugf("pushsync-push: %v", lastErr)
if errors.Is(err, context.DeadlineExceeded) {
ps.blocklistPeer(peer)
}
continue
}
......@@ -332,9 +328,6 @@ func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Re
_ = streamer.Reset()
lastErr = fmt.Errorf("receive receipt from peer %s: %w", peer.String(), err)
ps.logger.Debugf("pushsync-push: %v", lastErr)
if errors.Is(err, context.DeadlineExceeded) {
ps.blocklistPeer(peer)
}
continue
}
ps.metrics.ReceiptRTT.Observe(time.Since(receiptRTTTimer).Seconds())
......@@ -367,15 +360,6 @@ func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Re
return nil, topology.ErrNotFound
}
func (ps *PushSync) blocklistPeer(peer swarm.Address) {
if err := ps.streamer.Blocklist(peer, blocklistDuration); err != nil {
ps.logger.Errorf("pushsync-push: unable to block peer %s", peer)
ps.logger.Debugf("pushsync-push: blocking peer %s: %v", peer, err)
} else {
ps.logger.Warningf("pushsync-push: peer %s blocked as unresponsive", peer)
}
}
func (ps *PushSync) handleDeliveryResponse(ctx context.Context, w protobuf.Writer, p p2p.Peer, chunk swarm.Chunk) error {
// Store the chunk in the local store
_, err := ps.storer.Put(ctx, storage.ModePutSync, chunk)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment