if issue with large UDP packets on windows

This commit is contained in:
Arvid Norberg 2014-05-10 06:37:31 +00:00
parent e225259481
commit 9cc7c3bbf9
2 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,6 @@
1.0 release
* if issue with large UDP packets on windows
* remove set_ratio() feature
* improve piece_deadline/streaming
* honor pieces with priority 7 in sequential download mode

View File

@ -98,7 +98,7 @@ udp_socket::udp_socket(asio::io_service& ios
#endif
#endif
m_buf_size = 2000;
m_buf_size = 2048;
m_new_buf_size = m_buf_size;
m_buf = (char*)malloc(m_buf_size);
}
@ -278,6 +278,20 @@ void udp_socket::on_read(error_code const& ec, udp::socket* s)
--m_v4_outstanding;
}
// TODO: it would be nice to detect this on posix systems also
#ifdef TORRENT_WINDOWS
if ((ec == error_code(ERROR_MORE_DATA, get_system_category())
|| ec == error_code(WSAEMSGSIZE, get_system_category()))
&& m_buf_size < 65536)
{
// if this function fails to allocate memory, m_buf_size
// is set to 0. In that case, don't issue the async_read().
set_buf_size(m_buf_size * 2);
if (m_buf_size != 0) setup_read(s);
return;
}
#endif
if (ec == asio::error::operation_aborted) return;
if (m_abort) return;