Log an error when json encoding of peers.json fails.
This commit is contained in:
parent
5966a5230d
commit
79fe7aadd6
1 changed files with 4 additions and 1 deletions
|
@ -481,7 +481,10 @@ func (a *AddrManager) savePeers() {
|
||||||
}
|
}
|
||||||
enc := json.NewEncoder(w)
|
enc := json.NewEncoder(w)
|
||||||
defer w.Close()
|
defer w.Close()
|
||||||
enc.Encode(&sam)
|
if err := enc.Encode(&sam); err != nil {
|
||||||
|
amgrLog.Errorf("Failed to encode %s: %v", filePath, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// loadPeers loads the known address from the saved file. If empty, missing, or
|
// loadPeers loads the known address from the saved file. If empty, missing, or
|
||||||
|
|
Loading…
Reference in a new issue