forked from premiere/premiere-libtorrent
make the listen argument configurable
This commit is contained in:
parent
0ef5d25d46
commit
2e05dc765a
|
@ -3879,6 +3879,8 @@ session_settings
|
|||
int unchoke_slots_limit;
|
||||
int half_open_limit;
|
||||
int connections_limit;
|
||||
|
||||
int listen_queue_size;
|
||||
};
|
||||
|
||||
``version`` is automatically set to the libtorrent version you're using
|
||||
|
@ -4596,6 +4598,13 @@ opened. The number of connections is set to a hard minimum of at least two per
|
|||
torrent, so if you set a too low connections limit, and open too many torrents,
|
||||
the limit will not be met.
|
||||
|
||||
``listen_queue_size`` is the value passed in to listen() for the listen socket.
|
||||
It is the number of outstanding incoming connections to queue up while we're not
|
||||
actively waiting for a connection to be accepted. The default is 5 which should
|
||||
be sufficient for any normal client. If this is a high performance server which
|
||||
expects to receive a lot of connections, or used in a simulator or test, it
|
||||
might make sense to raise this number. It will not take affect until listen_on()
|
||||
is called again (or for the first time).
|
||||
|
||||
pe_settings
|
||||
===========
|
||||
|
|
|
@ -233,6 +233,7 @@ namespace libtorrent
|
|||
, unchoke_slots_limit(8)
|
||||
, half_open_limit(0)
|
||||
, connections_limit(200)
|
||||
, listen_queue_size(5)
|
||||
{}
|
||||
|
||||
// libtorrent version. Used for forward binary compatibility
|
||||
|
@ -892,6 +893,11 @@ namespace libtorrent
|
|||
|
||||
// the max number of connections in the session
|
||||
int connections_limit;
|
||||
|
||||
// this is the number passed in to listen(). i.e.
|
||||
// the number of connections to accept while we're
|
||||
// not waiting in an accept() call.
|
||||
int listen_queue_size;
|
||||
};
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
|
|
@ -1455,7 +1455,7 @@ namespace aux {
|
|||
return listen_socket_t();
|
||||
}
|
||||
s.external_port = s.sock->local_endpoint(ec).port();
|
||||
s.sock->listen(5, ec);
|
||||
s.sock->listen(m_settings.listen_queue_size, ec);
|
||||
if (ec)
|
||||
{
|
||||
if (m_alerts.should_post<listen_failed_alert>())
|
||||
|
|
Loading…
Reference in New Issue