lib/model, lib/protocol: Send ClusterConfig on config change (fixes #7020) (#7018)

This commit is contained in:
Simon Frei
2020-10-02 11:49:51 +02:00
committed by GitHub
parent e027175446
commit a20c6ca868
4 changed files with 155 additions and 116 deletions
+8 -1
View File
@@ -35,6 +35,7 @@ type fakeConnection struct {
indexFn func(context.Context, string, []protocol.FileInfo)
requestFn func(ctx context.Context, folder, name string, offset int64, size int, hash []byte, fromTemporary bool) ([]byte, error)
closeFn func(error)
clusterConfigFn func(protocol.ClusterConfig)
mut sync.Mutex
}
@@ -91,7 +92,13 @@ func (f *fakeConnection) Request(ctx context.Context, folder, name string, offse
return f.fileData[name], nil
}
func (f *fakeConnection) ClusterConfig(protocol.ClusterConfig) {}
func (f *fakeConnection) ClusterConfig(cc protocol.ClusterConfig) {
f.mut.Lock()
defer f.mut.Unlock()
if f.clusterConfigFn != nil {
f.clusterConfigFn(cc)
}
}
func (f *fakeConnection) Ping() bool {
f.mut.Lock()