Allow refusing all client connections with max_conns: 0#7877
Merged
neilalexander merged 1 commit intomainfrom Feb 25, 2026
Merged
Allow refusing all client connections with max_conns: 0#7877neilalexander merged 1 commit intomainfrom
max_conns: 0#7877neilalexander merged 1 commit intomainfrom
Conversation
963b977 to
d177d18
Compare
Member
MauriceVanVeen
left a comment
There was a problem hiding this comment.
Principally LGTM, but should the server config be max_conns: 0?
The users generally know -1 to mean 'infinite', so having max_conns: -1 might be interpreted as "allow infinite connections".
We could detect max_conns is explicitly set to 0 and update the internal opts.MaxConn to -1 still, but then at least it's a bit clearer that max_conns: 0 actually means "no connections allowed" and the internal opts.MaxConn: 0 still means "default connections".
Signed-off-by: Neil Twigg <neil@nats.io>
d177d18 to
8bd9923
Compare
max_conns: -1max_conns: 0
Member
Author
|
Updated so that you can do so with |
neilalexander
added a commit
that referenced
this pull request
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By setting
max_connsto0, we will refuse all client, MQTT and WebSocket connections. On reloadingmax_connsto0, we will disconnect all clients.Signed-off-by: Neil Twigg neil@nats.io