Windows: Increase connection limit to 8192 where supported.

Closes #2732. Thanks to zhousongsong.
This commit is contained in:
Roger A. Light 2023-04-07 19:29:13 +01:00
parent 4f9c5567ba
commit 3b2f3c6d8a
2 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,8 @@ Broker:
assertions removed. Closes #2708.
- Fix default settings incorrectly allowing TLS v1.1. Closes #2722.
- Use line buffered mode for stdout. Closes #2354. Closes #2749.
- Fix connections being limited to 2048 on Windows. The limit is now 8192,
where supported. Closes #2732.
Client library:
- Use CLOCK_BOOTTIME when available, to keep track of time. This solves the

View File

@ -484,7 +484,12 @@ int main(int argc, char *argv[])
#endif
#ifdef WIN32
_setmaxstdio(2048);
if(_setmaxstdio(8192) != 8192){
/* Old limit was 2048 */
if(_setmaxstdio(2048) != 2048){
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Unable to increase maximum allowed connections. This session may be limited to 512 connections.");
}
}
#endif
memset(&db, 0, sizeof(struct mosquitto_db));