lib/model: Refactor folderRunners to use a serviceMap (#9071)
Instead of separately tracking the token.
Also changes serviceMap to have a channel version of RemoveAndWait, so
that it's possible to do the removal under a lock but wait outside of
the lock. And changed where we do that in connection close, reversing
the change that happened when I added the serviceMap in 40b3b9ad1.
This commit is contained in:
@@ -1241,7 +1241,7 @@ func TestAutoAcceptPausedWhenFolderConfigChanged(t *testing.T) {
|
||||
if fcfg, ok := m.cfg.Folder(id); !ok || !fcfg.SharedWith(device1) {
|
||||
t.Error("missing folder, or not shared", id)
|
||||
}
|
||||
if _, ok := m.folderRunners[id]; ok {
|
||||
if _, ok := m.folderRunners.Get(id); ok {
|
||||
t.Fatal("folder running?")
|
||||
}
|
||||
|
||||
@@ -1261,7 +1261,7 @@ func TestAutoAcceptPausedWhenFolderConfigChanged(t *testing.T) {
|
||||
t.Error("device missing")
|
||||
}
|
||||
|
||||
if _, ok := m.folderRunners[id]; ok {
|
||||
if _, ok := m.folderRunners.Get(id); ok {
|
||||
t.Error("folder started")
|
||||
}
|
||||
}
|
||||
@@ -1290,7 +1290,7 @@ func TestAutoAcceptPausedWhenFolderConfigNotChanged(t *testing.T) {
|
||||
if fcfg, ok := m.cfg.Folder(id); !ok || !fcfg.SharedWith(device1) {
|
||||
t.Error("missing folder, or not shared", id)
|
||||
}
|
||||
if _, ok := m.folderRunners[id]; ok {
|
||||
if _, ok := m.folderRunners.Get(id); ok {
|
||||
t.Fatal("folder running?")
|
||||
}
|
||||
|
||||
@@ -1310,7 +1310,7 @@ func TestAutoAcceptPausedWhenFolderConfigNotChanged(t *testing.T) {
|
||||
t.Error("device missing")
|
||||
}
|
||||
|
||||
if _, ok := m.folderRunners[id]; ok {
|
||||
if _, ok := m.folderRunners.Get(id); ok {
|
||||
t.Error("folder started")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user