Skip to content

Commit

Permalink
Add comments; Check ctx.Err(); Move import
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelavila committed Mar 20, 2019
1 parent 09cc62e commit 13e417e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"context"
"errors"
"fmt"
"github.com/ipfs/go-ipfs/provider"
"io"
"io/ioutil"
"os"
Expand All @@ -30,6 +29,7 @@ import (
p2p "github.com/ipfs/go-ipfs/p2p"
pin "github.com/ipfs/go-ipfs/pin"
repo "github.com/ipfs/go-ipfs/repo"
provider "github.com/ipfs/go-ipfs/provider"

bitswap "github.com/ipfs/go-bitswap"
bsnet "github.com/ipfs/go-bitswap/network"
Expand Down
6 changes: 6 additions & 0 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const provideOutgoingWorkerLimit = 8

// Provider announces blocks to the network
type Provider interface {
// Run is used to begin processing the provider work
Run()
// Provide takes a cid and makes an attempt to announce it to the network
Provide(cid.Cid) error
}

Expand Down Expand Up @@ -54,6 +56,10 @@ func (p *provider) handleAnnouncements() {
for workers := 0; workers < provideOutgoingWorkerLimit; workers++ {
go func() {
for {
if err := p.ctx.Err(); err != nil {
log.Warningf("Provider context error: %s", err)
return
}
select {
case <-p.ctx.Done():
return
Expand Down

1 comment on commit 13e417e

@GitCop
Copy link

@GitCop GitCop commented on 13e417e Mar 20, 2019

Choose a reason for hiding this comment

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

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

Please sign in to comment.