mirror of
https://github.com/datarhei/core.git
synced 2025-10-16 21:10:41 +08:00
Fix crash when updating unavailable node
This commit is contained in:
@@ -66,19 +66,21 @@ func (n *Core) SetEssentials(address string, config *config.Config) {
|
|||||||
n.lock.Lock()
|
n.lock.Lock()
|
||||||
defer n.lock.Unlock()
|
defer n.lock.Unlock()
|
||||||
|
|
||||||
if address != n.address {
|
if n.address != address {
|
||||||
n.address = address
|
n.address = address
|
||||||
n.client = nil // force reconnet
|
n.client = nil // force reconnet
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.config == nil && config != nil {
|
if config != nil {
|
||||||
n.config = config
|
if n.config == nil {
|
||||||
n.client = nil // force reconnect
|
n.config = config
|
||||||
}
|
n.client = nil // force reconnect
|
||||||
|
}
|
||||||
|
|
||||||
if n.config.UpdatedAt != config.UpdatedAt {
|
if n.config != nil && n.config.UpdatedAt != config.UpdatedAt {
|
||||||
n.config = config
|
n.config = config
|
||||||
n.client = nil // force reconnect
|
n.client = nil // force reconnect
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user