include TCP handshake overhead

This commit is contained in:
Arvid Norberg 2008-09-26 06:10:21 +00:00
parent a93ae86d85
commit 47c476dc0a
2 changed files with 15 additions and 0 deletions

View File

@ -122,6 +122,18 @@ namespace libtorrent
m_stat[i] += s.m_stat[i]; m_stat[i] += s.m_stat[i];
} }
void sent_syn()
{
m_stat[upload_ip_protocol].add(40);
}
void received_synack()
{
// we received SYN-ACK and also sent ACK back
m_stat[download_ip_protocol].add(40);
m_stat[upload_ip_protocol].add(40);
}
void received_dht_bytes(int bytes) void received_dht_bytes(int bytes)
{ {
TORRENT_ASSERT(bytes >= 0); TORRENT_ASSERT(bytes >= 0);

View File

@ -3668,6 +3668,7 @@ namespace libtorrent
m_socket->async_connect(m_remote m_socket->async_connect(m_remote
, bind(&peer_connection::on_connection_complete, self(), _1)); , bind(&peer_connection::on_connection_complete, self(), _1));
m_connect = time_now(); m_connect = time_now();
m_statistics.sent_syn();
if (t->alerts().should_post<peer_connect_alert>()) if (t->alerts().should_post<peer_connect_alert>())
{ {
@ -3706,6 +3707,8 @@ namespace libtorrent
// this means the connection just succeeded // this means the connection just succeeded
m_statistics.received_synack();
TORRENT_ASSERT(m_socket); TORRENT_ASSERT(m_socket);
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
(*m_ses.m_logger) << time_now_string() << " COMPLETED: " << m_remote.address().to_string() (*m_ses.m_logger) << time_now_string() << " COMPLETED: " << m_remote.address().to_string()