make socket buffer sizes affect the udp socket as well. for high_performance_seed preset, set 1 MB socket buffers. only run test_rate() in proper release mode (without invariant checks and debug-iterators). lower the time limit of test_rate. update regression tests to disable invariant checks and debug iterators when building release mode

This commit is contained in:
Arvid Norberg 2013-09-02 09:24:34 +00:00
parent 124dbfb6ad
commit 275c340231
5 changed files with 43 additions and 5 deletions

View File

@ -11,7 +11,7 @@ clean:
time_limit: 180
features:
- variant=release asserts=production
- variant=release asserts=production invariant-checks=off debug-iterators=off
- encryption=openssl statistics=on logging=verbose disk-stats=on dht=logging request-log=on
- ipv6=off dht=off extensions=off logging=none deprecated-functions=off

View File

@ -255,6 +255,9 @@ namespace libtorrent
set.max_rejects = 10;
set.recv_socket_buffer_size = 1024 * 1024;
set.send_socket_buffer_size = 1024 * 1024;
set.optimize_hashing_for_speed = true;
// don't let connections linger for too long

View File

@ -2082,6 +2082,21 @@ namespace aux {
#endif
}
if (m_settings.send_socket_buffer_size != s.send_socket_buffer_size)
{
error_code ec;
stream_socket::send_buffer_size option(
m_settings.send_socket_buffer_size);
m_udp_socket.set_option(option, ec);
}
if (m_settings.recv_socket_buffer_size != s.recv_socket_buffer_size)
{
error_code ec;
stream_socket::receive_buffer_size option(
m_settings.recv_socket_buffer_size);
m_udp_socket.set_option(option, ec);
}
bool reopen_listen_port = false;
if (m_settings.ssl_listen != s.ssl_listen)
reopen_listen_port = true;
@ -2464,6 +2479,18 @@ retry:
(*m_logger) << ">>> SET_TOS[ udp_socket tos: " << m_settings.peer_tos << " e: " << ec.message() << " ]\n";
#endif
ec.clear();
if (m_settings.send_socket_buffer_size)
{
stream_socket::send_buffer_size option(
m_settings.send_socket_buffer_size);
m_udp_socket.set_option(option, ec);
}
if (m_settings.recv_socket_buffer_size)
{
stream_socket::receive_buffer_size option(
m_settings.recv_socket_buffer_size);
m_udp_socket.set_option(option, ec);
}
// initiate accepting on the listen sockets
for (std::list<listen_socket_t>::iterator i = m_listen_sockets.begin()

View File

@ -2667,7 +2667,7 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
{
// LOSS
UTP_LOGV("%8p: Packet %d lost.\n", this, m_fast_resend_seq_nr);
UTP_LOGV("%8p: Packet %d lost. (%d duplicate acks, trigger fast-resend)\n", this, m_fast_resend_seq_nr, m_duplicate_acks);
// resend the lost packet
packet* p = (packet*)m_outbuf.at(m_fast_resend_seq_nr);
@ -3253,7 +3253,7 @@ void utp_socket_impl::tick(ptime const& now)
p->need_resend = true;
TORRENT_ASSERT(m_bytes_in_flight >= p->size - p->header_size);
m_bytes_in_flight -= p->size - p->header_size;
UTP_LOGV("%8p: Packet %d lost.\n", this, i);
UTP_LOGV("%8p: Packet %d lost (timeout).\n", this, i);
}
TORRENT_ASSERT(m_bytes_in_flight == 0);

View File

@ -101,12 +101,17 @@ void test_rate()
peer_disconnects = 0;
session_settings sett = high_performance_seed();
ses1.set_settings(sett);
ses2.set_settings(sett);
boost::tie(tor1, tor2, ignore) = setup_transfer(&ses1, &ses2, 0
, true, false, true, "_transfer", 0, &t);
ptime start = time_now();
for (int i = 0; i < 70; ++i)
// it shouldn't take more than 2 seconds
for (int i = 0; i < 20; ++i)
{
print_alerts(ses1, "ses1", true, true, true, &on_alert);
print_alerts(ses2, "ses2", true, true, true, &on_alert);
@ -622,9 +627,12 @@ int test_main()
{
using namespace libtorrent;
#ifdef NDEBUG
#if !defined TORRENT_DEBUG \
&& defined TORRENT_DISABLE_INVARIANT_CHECKS \
&& !defined _GLIBCXX_DEBUG
// test rate only makes sense in release mode
test_rate();
return 0;
#endif
// test with all kinds of proxies