increase default connect speed. minor cleanup. add logging for short lived connections

This commit is contained in:
arvidn 2016-03-01 01:57:24 -05:00
parent 6ab596be17
commit b9ec183e24
4 changed files with 39 additions and 23 deletions

View File

@ -3461,7 +3461,7 @@ namespace libtorrent
#endif
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::incoming_message, "HANDSHAKE");
peer_log(peer_log_alert::incoming_message, "HANDSHAKE", "connection ready");
#endif
// consider this a successful connection, reset the failcount
if (peer_info_struct())

View File

@ -3495,8 +3495,8 @@ namespace libtorrent
if (t->alerts().should_post<block_downloading_alert>())
{
t->alerts().emplace_alert<block_downloading_alert>(t->get_handle(),
remote(), pid(), block.block_index, block.piece_index);
t->alerts().emplace_alert<block_downloading_alert>(t->get_handle()
, remote(), pid(), block.block_index, block.piece_index);
}
pending_block pb(block);
@ -3643,6 +3643,8 @@ namespace libtorrent
TORRENT_ASSERT(is_single_thread());
INVARIANT_CHECK;
TORRENT_ASSERT(!is_connecting());
if (m_choked)
{
TORRENT_ASSERT(m_peer_info == NULL
@ -4082,6 +4084,15 @@ namespace libtorrent
, op, ec.message().c_str());
break;
}
if (ec == error_code(boost::asio::error::eof
, boost::asio::error::get_misc_category())
&& !in_handshake()
&& !is_connecting()
&& clock_type::now() - connected_time() < seconds(15))
{
peer_log(peer_log_alert::info, "SHORT_LIVED_DISCONNECT", "");
}
#endif
if ((m_channel_state[upload_channel] & peer_info::bw_network) == 0)
@ -4955,8 +4966,8 @@ namespace libtorrent
boost::int64_t piece_size = t->torrent_file().piece_length();
if (m_remote_dl_rate > 0)
m_remote_dl_rate = int((m_remote_dl_rate * 2 / 3) +
((boost::int64_t(m_remote_pieces_dled) * piece_size / 3) / 60));
m_remote_dl_rate = int((m_remote_dl_rate * 2 / 3)
+ ((boost::int64_t(m_remote_pieces_dled) * piece_size / 3) / 60));
else
m_remote_dl_rate = int(boost::int64_t(m_remote_pieces_dled)
* piece_size / 60);
@ -5980,8 +5991,11 @@ namespace libtorrent
if (error)
{
TORRENT_ASSERT_VAL(error.value() != 0, error.value());
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "ERROR", "in peer_connection::on_receive_data_nb error: %s"
peer_log(peer_log_alert::info, "ERROR"
, "in peer_connection::on_receive_data_nb error: (%s:%d) %s"
, error.category().name(), error.value()
, error.message().c_str());
#endif
on_receive(error, bytes_transferred);
@ -6106,8 +6120,10 @@ namespace libtorrent
{
TORRENT_ASSERT(is_single_thread());
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::incoming, "ON_RECEIVE_DATA", "bytes: %d error: %s"
, int(bytes_transferred), error.message().c_str());
peer_log(peer_log_alert::incoming, "ON_RECEIVE_DATA"
, "bytes: %d error: (%s:%d) %s"
, int(bytes_transferred), error.category().name(), error.value()
, error.message().c_str());
#endif
// submit all disk jobs later

View File

@ -233,7 +233,7 @@ namespace libtorrent
SET(max_failcount, 3, &session_impl::update_max_failcount),
SET(min_reconnect_time, 60, 0),
SET(peer_connect_timeout, 15, 0),
SET(connection_speed, 6, &session_impl::update_connection_speed),
SET(connection_speed, 10, &session_impl::update_connection_speed),
SET(inactivity_timeout, 600, 0),
SET(unchoke_interval, 15, 0),
SET(optimistic_unchoke_interval, 30, 0),