mirror of https://github.com/aria2/aria2
2009-07-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten RequestGroupMan::saveServerStat() * src/RequestGroupMan.ccpull/1/head
parent
1c6a0962a1
commit
8d2b9f0aa1
|
@ -13,6 +13,11 @@
|
||||||
Rewritten Signature::save()
|
Rewritten Signature::save()
|
||||||
* src/Signature.cc
|
* src/Signature.cc
|
||||||
|
|
||||||
|
2009-07-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Rewritten RequestGroupMan::saveServerStat()
|
||||||
|
* src/RequestGroupMan.cc
|
||||||
|
|
||||||
2009-07-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-07-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Rewritten stream error handling
|
Rewritten stream error handling
|
||||||
|
|
|
@ -763,21 +763,25 @@ bool RequestGroupMan::saveServerStat(const std::string& filename) const
|
||||||
{
|
{
|
||||||
std::string tempfile = filename;
|
std::string tempfile = filename;
|
||||||
tempfile += "__temp";
|
tempfile += "__temp";
|
||||||
std::ofstream out(tempfile.c_str(), std::ios::binary);
|
{
|
||||||
if(!out) {
|
std::ofstream out(tempfile.c_str(), std::ios::binary);
|
||||||
_logger->error(MSG_OPENING_WRITABLE_SERVER_STAT_FILE_FAILED,
|
if(!out) {
|
||||||
tempfile.c_str());
|
_logger->error(MSG_OPENING_WRITABLE_SERVER_STAT_FILE_FAILED,
|
||||||
return false;
|
filename.c_str());
|
||||||
}
|
return false;
|
||||||
if (_serverStatMan->save(out)) {
|
}
|
||||||
out.close();
|
if(!_serverStatMan->save(out)) {
|
||||||
if (File(tempfile).renameTo(filename)) {
|
_logger->error(MSG_WRITING_SERVER_STAT_FILE_FAILED, filename.c_str());
|
||||||
_logger->notice(MSG_SERVER_STAT_SAVED, filename.c_str());
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logger->error(MSG_WRITING_SERVER_STAT_FILE_FAILED, filename.c_str());
|
if(File(tempfile).renameTo(filename)) {
|
||||||
return false;
|
_logger->notice(MSG_SERVER_STAT_SAVED, filename.c_str());
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
_logger->error(MSG_WRITING_SERVER_STAT_FILE_FAILED, filename.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestGroupMan::removeStaleServerStat(time_t timeout)
|
void RequestGroupMan::removeStaleServerStat(time_t timeout)
|
||||||
|
|
Loading…
Reference in New Issue