mirror of
https://github.com/sot-tech/mochi.git
synced 2026-04-30 01:19:59 -07:00
clear store error in responseHook if ErrResourceDoesNotExist appear
This commit is contained in:
@@ -50,7 +50,7 @@ func (h *swarmInteractionHook) HandleAnnounce(ctx context.Context, req *bittorre
|
||||
err = h.store.GraduateLeecher(req.InfoHash, req.Peer)
|
||||
return ctx, err
|
||||
case req.Left == 0:
|
||||
// Completed events will also have Key == 0, but by making this
|
||||
// Completed events will also have Left == 0, but by making this
|
||||
// an extra case we can treat "old" seeders differently from
|
||||
// graduating leechers. (Calling PutSeeder is probably faster
|
||||
// than calling GraduateLeecher.)
|
||||
@@ -110,6 +110,7 @@ func (h *responseHook) appendPeers(req *bittorrent.AnnounceRequest, resp *bittor
|
||||
if err != nil && !errors.Is(err, storage.ErrResourceDoesNotExist) {
|
||||
return err
|
||||
}
|
||||
err = nil
|
||||
|
||||
// Some clients expect a minimum of their own peer representation returned to
|
||||
// them if they are the only peer in a swarm.
|
||||
|
||||
@@ -611,7 +611,9 @@ func (ps *store) collectGarbage(cutoff time.Time) error {
|
||||
func (ps *store) Stop() stop.Result {
|
||||
c := make(stop.Channel)
|
||||
go func() {
|
||||
close(ps.closed)
|
||||
if ps.closed != nil {
|
||||
close(ps.closed)
|
||||
}
|
||||
ps.wg.Wait()
|
||||
|
||||
// Explicitly deallocate our storage.
|
||||
|
||||
Reference in New Issue
Block a user