mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-17 02:48:57 -07:00
Don't crash on new nodes (fixes #656)
This commit is contained in:
parent
5537d53f9a
commit
1e51fca0b0
@ -565,10 +565,10 @@ func (cf cFiler) CurrentFile(file string) protocol.FileInfo {
|
|||||||
// ConnectedTo returns true if we are connected to the named node.
|
// ConnectedTo returns true if we are connected to the named node.
|
||||||
func (m *Model) ConnectedTo(nodeID protocol.NodeID) bool {
|
func (m *Model) ConnectedTo(nodeID protocol.NodeID) bool {
|
||||||
m.pmut.RLock()
|
m.pmut.RLock()
|
||||||
_, ok := m.protoConn[nodeID]
|
if statRef, ok := m.nodeStatRefs[nodeID]; ok {
|
||||||
if ok {
|
statRef.WasSeen()
|
||||||
m.nodeStatRefs[nodeID].WasSeen()
|
|
||||||
}
|
}
|
||||||
|
_, ok := m.protoConn[nodeID]
|
||||||
m.pmut.RUnlock()
|
m.pmut.RUnlock()
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user