forked from premiere/premiere-libtorrent
improved logging
This commit is contained in:
parent
e7f4d6984f
commit
a85f1f5c61
|
@ -349,6 +349,10 @@ namespace libtorrent
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
// PEER MANAGEMENT
|
// PEER MANAGEMENT
|
||||||
|
|
||||||
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||||
|
void log_to_all_peers(char const* message);
|
||||||
|
#endif
|
||||||
|
|
||||||
// add or remove a url that will be attempted for
|
// add or remove a url that will be attempted for
|
||||||
// finding the file(s) in this torrent.
|
// finding the file(s) in this torrent.
|
||||||
void add_web_seed(std::string const& url, web_seed_entry::type_t type)
|
void add_web_seed(std::string const& url, web_seed_entry::type_t type)
|
||||||
|
|
|
@ -191,7 +191,8 @@ namespace libtorrent
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_logger = m_ses.create_log(m_remote.address().to_string(ec) + "_"
|
m_logger = m_ses.create_log(m_remote.address().to_string(ec) + "_"
|
||||||
+ to_string(m_remote.port()).elems, m_ses.listen_port());
|
+ to_string(m_remote.port()).elems, m_ses.listen_port());
|
||||||
(*m_logger) << time_now_string() << " *** OUTGOING CONNECTION\n";
|
(*m_logger) << time_now_string() << " *** OUTGOING CONNECTION: "
|
||||||
|
<< print_endpoint(m_remote) << "\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef TORRENT_DEBUG
|
#ifdef TORRENT_DEBUG
|
||||||
piece_failed = false;
|
piece_failed = false;
|
||||||
|
@ -328,7 +329,8 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(m_socket->remote_endpoint(ec) == m_remote || ec);
|
TORRENT_ASSERT(m_socket->remote_endpoint(ec) == m_remote || ec);
|
||||||
m_logger = m_ses.create_log(remote().address().to_string(ec) + "_"
|
m_logger = m_ses.create_log(remote().address().to_string(ec) + "_"
|
||||||
+ to_string(remote().port()).elems, m_ses.listen_port());
|
+ to_string(remote().port()).elems, m_ses.listen_port());
|
||||||
(*m_logger) << time_now_string() << " *** INCOMING CONNECTION\n";
|
(*m_logger) << time_now_string() << " *** INCOMING CONNECTION: "
|
||||||
|
<< print_endpoint(m_remote) << "\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_GEO_IP
|
#ifndef TORRENT_DISABLE_GEO_IP
|
||||||
|
|
|
@ -2557,12 +2557,18 @@ namespace aux {
|
||||||
--type_limit;
|
--type_limit;
|
||||||
--dht_limit;
|
--dht_limit;
|
||||||
--tracker_limit;
|
--tracker_limit;
|
||||||
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||||
|
t->log_to_all_peers("AUTO MANAGER STARTING TORRENT");
|
||||||
|
#endif
|
||||||
t->set_announce_to_dht(dht_limit >= 0);
|
t->set_announce_to_dht(dht_limit >= 0);
|
||||||
t->set_announce_to_trackers(tracker_limit >= 0);
|
t->set_announce_to_trackers(tracker_limit >= 0);
|
||||||
t->set_allow_peers(true);
|
t->set_allow_peers(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||||
|
t->log_to_all_peers("AUTO MANAGER PAUSING TORRENT");
|
||||||
|
#endif
|
||||||
t->set_allow_peers(false);
|
t->set_allow_peers(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -500,12 +500,8 @@ namespace libtorrent
|
||||||
|
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||||
for (peer_iterator i = m_connections.begin();
|
log_to_all_peers("DESTRUCTING TORRENT");
|
||||||
i != m_connections.end(); ++i)
|
|
||||||
{
|
|
||||||
(*(*i)->m_logger) << "*** DESTRUCTING TORRENT\n";
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TORRENT_ASSERT(m_abort);
|
TORRENT_ASSERT(m_abort);
|
||||||
|
@ -2491,12 +2487,8 @@ namespace libtorrent
|
||||||
stop_announcing();
|
stop_announcing();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||||
for (peer_iterator i = m_connections.begin();
|
log_to_all_peers("ABORTING TORRENT");
|
||||||
i != m_connections.end(); ++i)
|
|
||||||
{
|
|
||||||
(*(*i)->m_logger) << time_now_string() << " *** ABORTING TORRENT\n";
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// disconnect all peers and close all
|
// disconnect all peers and close all
|
||||||
|
@ -5217,12 +5209,9 @@ namespace libtorrent
|
||||||
void torrent::delete_files()
|
void torrent::delete_files()
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_ses.is_network_thread());
|
TORRENT_ASSERT(m_ses.is_network_thread());
|
||||||
#if defined TORRENT_VERBOSE_LOGGING
|
|
||||||
for (peer_iterator i = m_connections.begin();
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||||
i != m_connections.end(); ++i)
|
log_to_all_peers("DELETING FILES IN TORRENT");
|
||||||
{
|
|
||||||
(*(*i)->m_logger) << "*** DELETING FILES IN TORRENT\n";
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
disconnect_all(errors::torrent_removed);
|
disconnect_all(errors::torrent_removed);
|
||||||
|
@ -5257,6 +5246,16 @@ namespace libtorrent
|
||||||
bool checking_files = should_check_files();
|
bool checking_files = should_check_files();
|
||||||
m_error = ec;
|
m_error = ec;
|
||||||
m_error_file = error_file;
|
m_error_file = error_file;
|
||||||
|
|
||||||
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||||
|
if (ec)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
snprintf(buf, sizeof(buf), "TORRENT ERROR: %s: %s", ec.message().c_str(), error_file.c_str());
|
||||||
|
log_to_all_peers(buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (checking_files && !should_check_files())
|
if (checking_files && !should_check_files())
|
||||||
{
|
{
|
||||||
// stop checking
|
// stop checking
|
||||||
|
@ -5456,12 +5455,8 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||||
for (peer_iterator i = m_connections.begin();
|
log_to_all_peers("PAUSING TORRENT");
|
||||||
i != m_connections.end(); ++i)
|
|
||||||
{
|
|
||||||
(*(*i)->m_logger) << "*** PAUSING TORRENT\n";
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// this will make the storage close all
|
// this will make the storage close all
|
||||||
|
@ -5483,6 +5478,17 @@ namespace libtorrent
|
||||||
stop_announcing();
|
stop_announcing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||||
|
void torrent::log_to_all_peers(char const* message)
|
||||||
|
{
|
||||||
|
for (peer_iterator i = m_connections.begin();
|
||||||
|
i != m_connections.end(); ++i)
|
||||||
|
{
|
||||||
|
(*(*i)->m_logger) << time_now_string() << " *** " << message << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void torrent::set_allow_peers(bool b)
|
void torrent::set_allow_peers(bool b)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_ses.is_network_thread());
|
TORRENT_ASSERT(m_ses.is_network_thread());
|
||||||
|
|
Loading…
Reference in New Issue