Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following emojis are used to highlight certain changes:

### Changed

- `provider`: Prevent multiple instances of reprovider.Reprovide() from running at the same time. [#834](https://github.com/ipfs/boxo/pull/834)
- upgrade to `go-libp2p` [v0.39.0](https://github.com/libp2p/go-libp2p/releases/tag/v0.39.0)

### Removed
Expand Down
7 changes: 7 additions & 0 deletions provider/reprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
ctx context.Context
close context.CancelFunc
closewg sync.WaitGroup
mu sync.Mutex

reprovideInterval time.Duration
initalReprovideDelay time.Duration
Expand Down Expand Up @@ -470,6 +471,12 @@
return nil
}

ok := s.mu.TryLock()
if !ok {
return fmt.Errorf("instance of reprovide already running")
}

Check warning on line 477 in provider/reprovider.go

View check run for this annotation

Codecov / codecov/patch

provider/reprovider.go#L476-L477

Added lines #L476 - L477 were not covered by tests
defer s.mu.Unlock()

kch, err := s.keyProvider(ctx)
if err != nil {
return err
Expand Down