Return on file error in address manager save.
This commit modifies the address manager save code to exit when there is an error creating the file used to store addresses. Previously the error was only logged leaving the invalid file handle to be used later.
This commit is contained in:
parent
6212a7daff
commit
44aafcf742
1 changed files with 1 additions and 0 deletions
|
@ -466,6 +466,7 @@ func (a *AddrManager) savePeers() {
|
||||||
w, err := os.Create(filePath)
|
w, err := os.Create(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error opening file: ", filePath, err)
|
log.Error("Error opening file: ", filePath, err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
enc := json.NewEncoder(w)
|
enc := json.NewEncoder(w)
|
||||||
defer w.Close()
|
defer w.Close()
|
||||||
|
|
Loading…
Reference in a new issue