mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-24 15:38:27 +00:00
lib/model, lib/protocol: Sequence ClusterConfig properly (fixes #3448)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3452
This commit is contained in:
parent
7c7e8648ff
commit
aafc96f58f
@ -649,8 +649,11 @@ func (m *Model) ClusterConfig(deviceID protocol.DeviceID, cm protocol.ClusterCon
|
|||||||
tempIndexFolders := make([]string, 0, len(cm.Folders))
|
tempIndexFolders := make([]string, 0, len(cm.Folders))
|
||||||
|
|
||||||
m.pmut.RLock()
|
m.pmut.RLock()
|
||||||
conn := m.conn[deviceID]
|
conn, ok := m.conn[deviceID]
|
||||||
m.pmut.RUnlock()
|
m.pmut.RUnlock()
|
||||||
|
if !ok {
|
||||||
|
panic("bug: ClusterConfig called on closed or nonexistent connection")
|
||||||
|
}
|
||||||
|
|
||||||
m.fmut.Lock()
|
m.fmut.Lock()
|
||||||
for _, folder := range cm.Folders {
|
for _, folder := range cm.Folders {
|
||||||
|
@ -302,7 +302,7 @@ func (c *rawConnection) readerLoop() (err error) {
|
|||||||
if state != stateInitial {
|
if state != stateInitial {
|
||||||
return fmt.Errorf("protocol error: cluster config message in state %d", state)
|
return fmt.Errorf("protocol error: cluster config message in state %d", state)
|
||||||
}
|
}
|
||||||
go c.receiver.ClusterConfig(c.id, *msg)
|
c.receiver.ClusterConfig(c.id, *msg)
|
||||||
state = stateReady
|
state = stateReady
|
||||||
|
|
||||||
case *Index:
|
case *Index:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user