lib/model: Clean up index handler life cycle (fixes #9021) (#9038)

Co-authored-by: Simon Frei <freisim93@gmail.com>
This commit is contained in:
Jakob Borg
2023-08-21 18:39:13 +02:00
committed by GitHub
co-authored by Simon Frei
parent c2c6133aa5
commit 40b3b9ad15
6 changed files with 300 additions and 61 deletions
+3 -1
View File
@@ -14,6 +14,7 @@ import (
"github.com/syncthing/syncthing/lib/protocol"
protocolmocks "github.com/syncthing/syncthing/lib/protocol/mocks"
"github.com/syncthing/syncthing/lib/rand"
"github.com/syncthing/syncthing/lib/scanner"
)
@@ -36,10 +37,11 @@ func newFakeConnection(id protocol.DeviceID, model Model) *fakeConnection {
f.CloseCalls(func(err error) {
f.closeOnce.Do(func() {
close(f.closed)
model.Closed(f, err)
})
model.Closed(f, err)
f.ClosedReturns(f.closed)
})
f.StringReturns(rand.String(8))
return f
}