Skip to content

Commit d5b6341

Browse files
committed
chore(pullsync): remove cosmetic regressions
Commits 7429496 and 4f9650f introduced four style regressions: - ErrUnsolicitedChunk wrapped in a single-element var () block; unwrap to a plain var declaration matching the rest of the package. - Blank lines after the opening brace of New(), handler(), Sync(), and makeOffer(); remove to match bee's conventional style. Also note: commit 4fd11e0 silently added s.logger.Debug("batch timeout timer triggered") to the collectAddrs timer case; that addition is intentional and remains. No behaviour change.
1 parent 4fd11e0 commit d5b6341

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

pkg/pullsync/pullsync.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ const (
4141
cursorStreamName = "cursors"
4242
)
4343

44-
var (
45-
ErrUnsolicitedChunk = errors.New("peer sent unsolicited chunk")
46-
)
44+
var ErrUnsolicitedChunk = errors.New("peer sent unsolicited chunk")
4745

4846
const (
4947
MaxCursor = math.MaxUint64
@@ -98,7 +96,6 @@ func New(
9896
logger log.Logger,
9997
maxPage uint64,
10098
) *Syncer {
101-
10299
return &Syncer{
103100
streamer: streamer,
104101
store: store,
@@ -134,7 +131,6 @@ func (s *Syncer) Protocol() p2p.ProtocolSpec {
134131

135132
// handler handles an incoming request to sync an interval
136133
func (s *Syncer) handler(streamCtx context.Context, p p2p.Peer, stream p2p.Stream) (err error) {
137-
138134
select {
139135
case <-s.quit:
140136
return nil
@@ -238,7 +234,6 @@ func (s *Syncer) handler(streamCtx context.Context, p p2p.Peer, stream p2p.Strea
238234
// ErrOverwriteNewerChunk does not zero topmost: the chunk is already present.
239235
// count is the number of chunks successfully written to the reserve.
240236
func (s *Syncer) Sync(ctx context.Context, peer swarm.Address, bin uint8, start uint64) (topmost uint64, count int, err error) {
241-
242237
stream, err := s.streamer.NewStream(ctx, peer, nil, protocolName, protocolVersion, streamName)
243238
if err != nil {
244239
return 0, 0, fmt.Errorf("new stream: %w", err)
@@ -421,7 +416,6 @@ func (s *Syncer) Sync(ctx context.Context, peer swarm.Address, bin uint8, start
421416

422417
// makeOffer tries to assemble an offer for a given requested interval.
423418
func (s *Syncer) makeOffer(ctx context.Context, rn pb.Get) (*pb.Offer, error) {
424-
425419
addrs, top, err := s.collectAddrs(ctx, uint8(rn.Bin), rn.Start)
426420
if err != nil {
427421
return nil, err

0 commit comments

Comments
 (0)