fix uTP edge case where udp socket buffer fills up

This commit is contained in:
Arvid Norberg
2012-07-01 18:44:46 +00:00
parent 96aa1f162b
commit bd4f173bc5
7 changed files with 186 additions and 15 deletions

View File

@@ -276,6 +276,25 @@ namespace libtorrent
return false;
}
void utp_socket_manager::subscribe_writable(utp_socket_impl* s)
{
TORRENT_ASSERT(std::find(m_stalled_sockets.begin(), m_stalled_sockets.end()
, s) == m_stalled_sockets.end());
m_stalled_sockets.push_back(s);
}
void utp_socket_manager::writable()
{
std::vector<utp_socket_impl*> stalled_sockets;
m_stalled_sockets.swap(stalled_sockets);
for (std::vector<utp_socket_impl*>::iterator i = stalled_sockets.begin()
, end(stalled_sockets.end()); i != end; ++i)
{
utp_socket_impl* s = *i;
utp_writable(s);
}
}
void utp_socket_manager::socket_drained()
{
// flush all deferred acks