Skip to content

Commit

Permalink
Downloader main loop wait on close (erigontech#7082)
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored and ty-sentio-xyz committed Mar 16, 2023
1 parent c676aa8 commit 956e972
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/downloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func Downloader(ctx context.Context) error {
}
defer d.Close()
log.Info("[torrent] Start", "my peerID", fmt.Sprintf("%x", d.Torrent().PeerID()))
go downloader.MainLoop(ctx, d, false)
d.MainLoopInBackground(ctx, false)

bittorrentServer, err := downloader.NewGrpcServer(d)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/erigon-el/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ func (s *Ethereum) setUpBlockReader(ctx context.Context, dirs datadir.Dirs, snCo
if err != nil {
return nil, nil, nil, err
}
go downloader3.MainLoop(ctx, s.downloader, true)
s.downloader.MainLoopInBackground(ctx, true)
bittorrentServer, err := downloader3.NewGrpcServer(s.downloader)
if err != nil {
return nil, nil, nil, fmt.Errorf("new server: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ func (s *Ethereum) setUpBlockReader(ctx context.Context, dirs datadir.Dirs, snCo
if err != nil {
return nil, nil, nil, err
}
go downloader3.MainLoop(ctx, s.downloader, true)
s.downloader.MainLoopInBackground(ctx, true)
bittorrentServer, err := downloader3.NewGrpcServer(s.downloader)
if err != nil {
return nil, nil, nil, fmt.Errorf("new server: %w", err)
Expand Down

0 comments on commit 956e972

Please sign in to comment.