Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont double count data sent #185

Merged
merged 2 commits into from Apr 5, 2021
Merged

Dont double count data sent #185

merged 2 commits into from Apr 5, 2021

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented Apr 1, 2021

Fixes #184

Tasks:

  • Implement fix
  • Unit tests
  • Integration tests

@dirkmc dirkmc marked this pull request as ready for review April 1, 2021 12:42
Comment on lines -37 to -54
if chid.Initiator != m.peerID {
var result datatransfer.VoucherResult
var err error
var handled bool
_ = m.revalidators.Each(func(_ datatransfer.TypeIdentifier, _ encoding.Decoder, processor registry.Processor) error {
revalidator := processor.(datatransfer.Revalidator)
handled, result, err = revalidator.OnPushDataReceived(chid, size)
if handled {
return errors.New("stop processing")
}
return nil
})
if err != nil || result != nil {
msg, err := m.processRevalidationResult(chid, result, err)
if msg != nil {
if err := m.dataTransferNetwork.SendMessage(context.TODO(), chid.Initiator, msg); err != nil {
return err
}
Copy link
Contributor Author

@dirkmc dirkmc Apr 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: the logic hasn't changed here, just the indentation.
I suggest viewing with whitespace changes turned off:
https://github.com/filecoin-project/go-data-transfer/pull/185/files?diff=unified&w=1

Copy link
Collaborator

@aarshkshah1992 aarshkshah1992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dirkmc LGTM. Just some nits we need to fix in the test.

channels/channels_test.go Show resolved Hide resolved
channels/channels_test.go Show resolved Hide resolved
channels/channels.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't double count data sent on restart
2 participants