don't accept incoming uTP connections indefinitely

This commit is contained in:
Arvid Norberg 2012-05-19 20:39:55 +00:00
parent 403c49ac29
commit ddbae1da86
1 changed files with 4 additions and 0 deletions

View File

@ -245,6 +245,10 @@ namespace libtorrent
// create a new utp_stream
if (ph->get_type() == ST_SYN)
{
// possible SYN flood. Just ignore
if (m_utp_sockets.size() > m_sett.connections_limit * 2)
return false;
// create the new socket with this ID
m_new_connection = id;