mirror of
https://github.com/transmission/transmission
synced 2024-12-31 20:16:57 +00:00
Allow the operating system to set the size of the listen queue connection backlog. (#922)
* Allow the operating system to determine the size of the listen queue connection backlog. * On Windows, set the listen queue backlog to SOMAXCONN, as advised in https://docs.microsoft.com/en-us/windows/desktop/api/winsock2/nf-winsock2-listen.
This commit is contained in:
parent
2da97b25fa
commit
6fee8724ab
1 changed files with 7 additions and 1 deletions
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -476,7 +477,12 @@ static tr_socket_t tr_netBindTCPImpl(tr_address const* addr, tr_port port, bool
|
|||
|
||||
#endif
|
||||
|
||||
if (listen(fd, 128) == -1)
|
||||
#ifdef _WIN32
|
||||
if (listen(fd, SOMAXCONN) == -1)
|
||||
#else /* _WIN32 */
|
||||
/* Listen queue backlog will be capped to the operating system's limit. */
|
||||
if (listen(fd, INT_MAX) == -1)
|
||||
#endif /* _WIN32 */
|
||||
{
|
||||
*errOut = sockerrno;
|
||||
tr_netCloseSocket(fd);
|
||||
|
|
Loading…
Reference in a new issue