mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-07 14:49:21 +00:00
* Changing push_log calls to the new logging facility.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1284 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <torrent/dht_manager.h>
|
||||
#include <torrent/object_stream.h>
|
||||
#include <torrent/rate.h>
|
||||
#include <torrent/utils/log.h>
|
||||
|
||||
#include "rpc/parse_commands.h"
|
||||
|
||||
@@ -76,7 +77,7 @@ DhtManager::load_dht_cache() {
|
||||
// If the cache file is corrupted we will just discard it with an
|
||||
// error message.
|
||||
if (cache_file.fail()) {
|
||||
control->core()->push_log("DHT warning: Cache file corrupted, discarding.");
|
||||
lt_log_print(torrent::LOG_DHT_WARN, "DHT cache file corrupted, discarding.");
|
||||
cache = torrent::Object::create_map();
|
||||
}
|
||||
}
|
||||
@@ -88,7 +89,7 @@ DhtManager::load_dht_cache() {
|
||||
start_dht();
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
control->core()->push_log((std::string("DHT error: ") + e.what()).c_str());
|
||||
lt_log_print(torrent::LOG_DHT_WARN, "DHT failed: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,9 +108,7 @@ DhtManager::start_dht() {
|
||||
if (port <= 0)
|
||||
return;
|
||||
|
||||
char msg[128];
|
||||
snprintf(msg, sizeof(msg), "Starting DHT server on port %d.", port);
|
||||
control->core()->push_log(msg);
|
||||
lt_log_print(torrent::LOG_DHT_INFO, "Starting DHT server on port %d.", port);
|
||||
|
||||
try {
|
||||
torrent::dht_manager()->start(port);
|
||||
@@ -126,7 +125,7 @@ DhtManager::start_dht() {
|
||||
m_dhtPrevBytesDown = 0;
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
control->core()->push_log((std::string("DHT error: ") + e.what()).c_str());
|
||||
lt_log_print(torrent::LOG_DHT_ERROR, "DHT start failed: %s", e.what());
|
||||
m_start = dht_off;
|
||||
}
|
||||
}
|
||||
@@ -138,7 +137,7 @@ DhtManager::stop_dht() {
|
||||
|
||||
if (torrent::dht_manager()->is_active()) {
|
||||
log_statistics(true);
|
||||
control->core()->push_log("Stopping DHT server.");
|
||||
lt_log_print(torrent::LOG_DHT_INFO, "Stopping DHT server.");
|
||||
torrent::dht_manager()->stop();
|
||||
}
|
||||
}
|
||||
@@ -220,7 +219,7 @@ DhtManager::log_statistics(bool force) {
|
||||
// We should have had clients ping us at least but have received
|
||||
// nothing, that means the UDP port is probably unreachable.
|
||||
if (torrent::dht_manager()->can_receive_queries())
|
||||
control->core()->push_log("Warning: DHT port appears to be unreachable, no queries received.");
|
||||
lt_log_print(torrent::LOG_DHT_WARN, "DHT port appears to be unreachable, no queries received.");
|
||||
|
||||
torrent::dht_manager()->set_can_receive(false);
|
||||
}
|
||||
@@ -228,7 +227,7 @@ DhtManager::log_statistics(bool force) {
|
||||
if (stats.queries_sent - m_dhtPrevQueriesSent > stats.num_nodes * 2 + 20 && stats.replies_received == m_dhtPrevRepliesReceived) {
|
||||
// No replies to over 20 queries plus two per node we have. Probably firewalled.
|
||||
if (!m_warned)
|
||||
control->core()->push_log("Warning: DHT port appears to be firewalled, no replies received.");
|
||||
lt_log_print(torrent::LOG_DHT_WARN, "DHT port appears to be firewalled, no replies received.");
|
||||
|
||||
m_warned = true;
|
||||
return false;
|
||||
|
||||
+13
-12
@@ -50,6 +50,7 @@
|
||||
#include <torrent/object.h>
|
||||
#include <torrent/object_stream.h>
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/utils/log.h>
|
||||
|
||||
#include "rpc/parse_commands.h"
|
||||
|
||||
@@ -90,7 +91,7 @@ DownloadList::session_save() {
|
||||
unsigned int c = std::count_if(begin(), end(), std::bind1st(std::mem_fun(&DownloadStore::save_resume), control->core()->download_store()));
|
||||
|
||||
if (c != size())
|
||||
control->core()->push_log("Failed to save session torrents.");
|
||||
lt_log_print(torrent::LOG_ERROR, "Failed to save session torrents.");
|
||||
|
||||
control->dht_manager()->save_dht_cache();
|
||||
}
|
||||
@@ -128,7 +129,7 @@ DownloadList::create(torrent::Object* obj, bool printLog) {
|
||||
delete obj;
|
||||
|
||||
if (printLog)
|
||||
control->core()->push_log(e.what());
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not create download: %s", e.what());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -152,7 +153,7 @@ DownloadList::create(std::istream* str, bool printLog) {
|
||||
delete object;
|
||||
|
||||
if (printLog)
|
||||
control->core()->push_log("Could not create download, the input is not a valid torrent.");
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not create download, the input is not a valid torrent.");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -163,7 +164,7 @@ DownloadList::create(std::istream* str, bool printLog) {
|
||||
delete object;
|
||||
|
||||
if (printLog)
|
||||
control->core()->push_log(e.what());
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not create download: %s", e.what());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -232,7 +233,7 @@ DownloadList::open(Download* download) {
|
||||
return true;
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
control->core()->push_log(e.what());
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not open download: %s", e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -260,7 +261,7 @@ DownloadList::close(Download* download) {
|
||||
close_throw(download);
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
control->core()->push_log(e.what());
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not close download: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +409,7 @@ DownloadList::resume(Download* download, int flags) {
|
||||
DL_TRIGGER_EVENT(download, "event.download.resumed");
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
control->core()->push_log(e.what());
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not resume download: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,7 +456,7 @@ DownloadList::pause(Download* download, int flags) {
|
||||
//control->core()->download_store()->save(download);
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
control->core()->push_log(e.what());
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not pause download: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,7 +472,7 @@ DownloadList::check_hash(Download* download) {
|
||||
hash_queue(download, Download::variable_hashing_rehash);
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
control->core()->push_log(e.what());
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not check hash: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,7 +533,7 @@ DownloadList::hash_done(Download* download) {
|
||||
confirm_finished(download);
|
||||
} else {
|
||||
download->set_message("Hash check on download completion found bad chunks, consider using \"safe_sync\".");
|
||||
control->core()->push_log("Hash check on download completion found bad chunks, consider using \"safe_sync\".");
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Hash check on download completion found bad chunks, consider using \"safe_sync\".");
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_final_failed");
|
||||
}
|
||||
|
||||
@@ -670,7 +671,7 @@ DownloadList::process_meta_download(Download* download) {
|
||||
std::string metafile = (*download->file_list()->begin())->frozen_path();
|
||||
std::fstream file(metafile.c_str(), std::ios::in | std::ios::binary);
|
||||
if (!file.is_open()) {
|
||||
control->core()->push_log("Could not read download metadata.");
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not read download metadata.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -678,7 +679,7 @@ DownloadList::process_meta_download(Download* download) {
|
||||
file >> bencode->insert_key("info", torrent::Object());
|
||||
if (file.fail()) {
|
||||
delete bencode;
|
||||
control->core()->push_log("Could not create download, the input is not a valid torrent.");
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not create download, the input is not a valid torrent.");
|
||||
return;
|
||||
}
|
||||
file.close();
|
||||
|
||||
+2
-1
@@ -57,6 +57,7 @@
|
||||
#include <torrent/object_stream.h>
|
||||
#include <torrent/tracker_list.h>
|
||||
#include <torrent/throttle.h>
|
||||
#include <torrent/utils/log.h>
|
||||
|
||||
#include "rpc/parse_commands.h"
|
||||
#include "utils/directory.h"
|
||||
@@ -579,7 +580,7 @@ Manager::receive_hashing_changed() {
|
||||
|
||||
} else {
|
||||
(*itr)->set_hash_failed(true);
|
||||
push_log(e.what());
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Hashing failed: %s", e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user