Log an error when json encoding of peers.json fails.

This commit is contained in:
David Hill 2014-07-03 14:33:56 -04:00
parent 5966a5230d
commit 79fe7aadd6

View file

@ -481,7 +481,10 @@ func (a *AddrManager) savePeers() {
}
enc := json.NewEncoder(w)
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