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 ( ...@@ -31,7 +31,6 @@ const (
const ( const (
maxPeers = 5 maxPeers = 5
blocklistDuration = time.Minute
) )
type PushSyncer interface { type PushSyncer interface {
...@@ -311,9 +310,6 @@ func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Re ...@@ -311,9 +310,6 @@ func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Re
_ = streamer.Reset() _ = streamer.Reset()
lastErr = fmt.Errorf("chunk deliver to peer %s: %w", peer.String(), err) lastErr = fmt.Errorf("chunk deliver to peer %s: %w", peer.String(), err)
ps.logger.Debugf("pushsync-push: %v", lastErr) ps.logger.Debugf("pushsync-push: %v", lastErr)
if errors.Is(err, context.DeadlineExceeded) {
ps.blocklistPeer(peer)
}
continue continue
} }
...@@ -332,9 +328,6 @@ func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Re ...@@ -332,9 +328,6 @@ func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Re
_ = streamer.Reset() _ = streamer.Reset()
lastErr = fmt.Errorf("receive receipt from peer %s: %w", peer.String(), err) lastErr = fmt.Errorf("receive receipt from peer %s: %w", peer.String(), err)
ps.logger.Debugf("pushsync-push: %v", lastErr) ps.logger.Debugf("pushsync-push: %v", lastErr)
if errors.Is(err, context.DeadlineExceeded) {
ps.blocklistPeer(peer)
}
continue continue
} }
ps.metrics.ReceiptRTT.Observe(time.Since(receiptRTTTimer).Seconds()) ps.metrics.ReceiptRTT.Observe(time.Since(receiptRTTTimer).Seconds())
...@@ -367,15 +360,6 @@ func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Re ...@@ -367,15 +360,6 @@ func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Re
return nil, topology.ErrNotFound 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 { func (ps *PushSync) handleDeliveryResponse(ctx context.Context, w protobuf.Writer, p p2p.Peer, chunk swarm.Chunk) error {
// Store the chunk in the local store // Store the chunk in the local store
_, err := ps.storer.Put(ctx, storage.ModePutSync, chunk) _, 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