Skip to content

Commit e69af10

Browse files
authored
refactor: simplify graphsync transport (#203)
* refactor: simplify graphsync transport * feat: add more logging to graphsync transport * refactor: keep gs req fields in one struct
1 parent ceb3c41 commit e69af10

File tree

8 files changed

+682
-540
lines changed

8 files changed

+682
-540
lines changed

impl/impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ func (m *manager) ResumeDataTransferChannel(ctx context.Context, chid datatransf
397397

398398
err := pausable.ResumeChannel(ctx, m.resumeMessage(chid), chid)
399399
if err != nil {
400-
log.Warnf("Error attempting to pause at transport level: %s", err.Error())
400+
log.Warnf("Error attempting to resume at transport level: %s", err.Error())
401401
}
402402

403403
return m.resume(chid)

impl/integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ func TestAutoRestart(t *testing.T) {
727727
AcceptTimeout: 100 * time.Millisecond,
728728
RestartDebounce: 500 * time.Millisecond,
729729
RestartBackoff: 500 * time.Millisecond,
730-
MaxConsecutiveRestarts: 5,
730+
MaxConsecutiveRestarts: 10,
731731
RestartAckTimeout: 100 * time.Millisecond,
732732
CompleteTimeout: 100 * time.Millisecond,
733733
})

impl/receiver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,19 @@ func (r *receiver) ReceiveRestartExistingChannelRequest(ctx context.Context,
131131

132132
// initiator should be me
133133
if channel.ChannelID().Initiator != r.manager.peerID {
134-
log.Error("cannot restart channel %s: channel initiator is not the manager peer", ch)
134+
log.Errorf("cannot restart channel %s: channel initiator is not the manager peer", ch)
135135
return
136136
}
137137

138138
// other peer should be the counter party on the channel
139139
if channel.OtherPeer() != sender {
140-
log.Error("cannot restart channel %s: channel counterparty is not the sender peer", ch)
140+
log.Errorf("cannot restart channel %s: channel counterparty is not the sender peer", ch)
141141
return
142142
}
143143

144144
// channel should NOT be terminated
145145
if channels.IsChannelTerminated(channel.Status()) {
146-
log.Error("cannot restart channel %s: channel already terminated", ch)
146+
log.Errorf("cannot restart channel %s: channel already terminated", ch)
147147
return
148148
}
149149

transport/graphsync/channellocker.go

Lines changed: 0 additions & 85 deletions
This file was deleted.

transport/graphsync/channellocker_test.go

Lines changed: 0 additions & 113 deletions
This file was deleted.

0 commit comments

Comments
 (0)