mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-16 23:22:31 +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;
|
||||
|
||||
Reference in New Issue
Block a user