timer fixes for http_connection

This commit is contained in:
Arvid Norberg 2009-07-26 02:17:21 +00:00
parent c43229f89c
commit 5b604e2a3a
2 changed files with 9 additions and 4 deletions

View File

@ -254,7 +254,7 @@ void http_connection::on_timeout(boost::weak_ptr<http_connection> p
if (e == asio::error::operation_aborted) return;
if (c->m_last_receive + c->m_timeout < time_now())
if (c->m_last_receive + c->m_timeout < time_now_hires())
{
if (c->m_connection_ticket > -1 && !c->m_endpoints.empty())
{
@ -355,7 +355,7 @@ void http_connection::on_connect(error_code const& e)
m_connection_ticket = -1;
}
m_last_receive = time_now();
m_last_receive = time_now_hires();
if (!e)
{
if (m_connect_handler) m_connect_handler(*this);
@ -547,7 +547,7 @@ void http_connection::on_read(error_code const& e
callback(e, &m_recvbuffer[0] + m_parser.body_start()
, m_read_pos - m_parser.body_start());
m_read_pos = 0;
m_last_receive = time_now();
m_last_receive = time_now_hires();
}
else if (m_bottled && m_parser.finished())
{
@ -561,7 +561,7 @@ void http_connection::on_read(error_code const& e
TORRENT_ASSERT(!m_bottled);
callback(e, &m_recvbuffer[0], m_read_pos);
m_read_pos = 0;
m_last_receive = time_now();
m_last_receive = time_now_hires();
}
if (int(m_recvbuffer.size()) == m_read_pos)

View File

@ -105,6 +105,11 @@ void run_test(std::string const& url, int size, int status, int connected
std::cerr << " ===== TESTING: " << url << " =====" << std::endl;
std::cerr << " expecting: size: " << size
<< " status: " << status
<< " connected: " << connected
<< " error: " << (ec?ec->message():"no error") << std::endl;
boost::shared_ptr<http_connection> h(new http_connection(ios, cq
, &::http_handler, true, &::http_connect_handler));
h->get(url, seconds(1), 0, &ps);