Skip to content

Commit

Permalink
Windows: Increase connection limit to 8192 where supported.
Browse files Browse the repository at this point in the history
Closes #2732. Thanks to zhousongsong.
  • Loading branch information
ralight committed Apr 7, 2023
1 parent 4f9c556 commit 3b2f3c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/mosquitto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 3b2f3c6

Please sign in to comment.