@@ -1944,21 +1944,21 @@ bool CAddrDB::Write(const CAddrMan& addr)
1944
1944
FILE *file = fopen (pathTmp.string ().c_str (), " wb" );
1945
1945
CAutoFile fileout = CAutoFile (file, SER_DISK, CLIENT_VERSION);
1946
1946
if (!fileout)
1947
- return error (" CAddrman::Write() : open failed " );
1947
+ return error (" %s : Failed to open file %s " , __func__, pathTmp. string () );
1948
1948
1949
1949
// Write and commit header, data
1950
1950
try {
1951
1951
fileout << ssPeers;
1952
1952
}
1953
1953
catch (std::exception &e) {
1954
- return error (" CAddrman::Write() : I/O error" );
1954
+ return error (" %s : Serialize or I/O error - %s " , __func__, e. what () );
1955
1955
}
1956
1956
FileCommit (fileout);
1957
1957
fileout.fclose ();
1958
1958
1959
1959
// replace existing peers.dat, if any, with new peers.dat.XXXX
1960
1960
if (!RenameOver (pathTmp, pathAddr))
1961
- return error (" CAddrman::Write() : Rename-into-place failed" );
1961
+ return error (" %s : Rename-into-place failed" , __func__ );
1962
1962
1963
1963
return true ;
1964
1964
}
@@ -1969,13 +1969,14 @@ bool CAddrDB::Read(CAddrMan& addr)
1969
1969
FILE *file = fopen (pathAddr.string ().c_str (), " rb" );
1970
1970
CAutoFile filein = CAutoFile (file, SER_DISK, CLIENT_VERSION);
1971
1971
if (!filein)
1972
- return error (" CAddrman::Read() : open failed " );
1972
+ return error (" %s : Failed to open file %s " , __func__, pathAddr. string () );
1973
1973
1974
1974
// use file size to size memory buffer
1975
1975
int fileSize = boost::filesystem::file_size (pathAddr);
1976
1976
int dataSize = fileSize - sizeof (uint256);
1977
1977
// Don't try to resize to a negative number if file is small
1978
- if ( dataSize < 0 ) dataSize = 0 ;
1978
+ if (dataSize < 0 )
1979
+ dataSize = 0 ;
1979
1980
vector<unsigned char > vchData;
1980
1981
vchData.resize (dataSize);
1981
1982
uint256 hashIn;
@@ -1986,7 +1987,7 @@ bool CAddrDB::Read(CAddrMan& addr)
1986
1987
filein >> hashIn;
1987
1988
}
1988
1989
catch (std::exception &e) {
1989
- return error (" CAddrman::Read() 2 : I/O error or stream data corrupted " );
1990
+ return error (" %s : Deserialize or I/O error - %s " , __func__, e. what () );
1990
1991
}
1991
1992
filein.fclose ();
1992
1993
@@ -1995,7 +1996,7 @@ bool CAddrDB::Read(CAddrMan& addr)
1995
1996
// verify stored checksum matches input data
1996
1997
uint256 hashTmp = Hash (ssPeers.begin (), ssPeers.end ());
1997
1998
if (hashIn != hashTmp)
1998
- return error (" CAddrman::Read() : checksum mismatch; data corrupted" );
1999
+ return error (" %s : Checksum mismatch, data corrupted" , __func__ );
1999
2000
2000
2001
unsigned char pchMsgTmp[4 ];
2001
2002
try {
@@ -2004,13 +2005,13 @@ bool CAddrDB::Read(CAddrMan& addr)
2004
2005
2005
2006
// ... verify the network matches ours
2006
2007
if (memcmp (pchMsgTmp, Params ().MessageStart (), sizeof (pchMsgTmp)))
2007
- return error (" CAddrman::Read() : invalid network magic number" );
2008
+ return error (" %s : Invalid network magic number" , __func__ );
2008
2009
2009
2010
// de-serialize address data into one CAddrMan object
2010
2011
ssPeers >> addr;
2011
2012
}
2012
2013
catch (std::exception &e) {
2013
- return error (" CAddrman::Read() : I/O error or stream data corrupted " );
2014
+ return error (" %s : Deserialize or I/O error - %s " , __func__, e. what () );
2014
2015
}
2015
2016
2016
2017
return true ;
0 commit comments