-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Make port, tls-port and bind configurations modifiable #8510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4fda8d1 to
33078f5
Compare
Add ability to modify port, tls-port and bind configurations by CONFIG SET command. To simplify the code and make it cleaner, a new structure added, socketFds, which contains the file descriptors array and its counter, and used for TCP, TLS and Cluster sockets file descriptors.
33078f5 to
94efa49
Compare
code review: - fix failure handling in listenToPort by rollback successful listens - add return value to createSocketAcceptHandler instead of panic - increasing tests coverage
yossigo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YaacovHazan just a small comment nitpick.
src/server.c
Outdated
| /* Create an event handler for accepting new connections in TCP and TLS | ||
| * domain sockets. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YaacovHazan Consider moving this comment up to document the function and indicate that it works atomically for all socket fds.
|
@redis/core-team please review. |
src/config.c
Outdated
| int vlen; | ||
| sds *v = sdssplitlen(o->ptr,sdslen(o->ptr)," ",1,&vlen); | ||
|
|
||
| if (vlen < 1 || vlen > CONFIG_BINDADDR_MAX) { | ||
| addReplyError(c, "Too many bind addresses specified."); | ||
| sdsfreesplitres(v, vlen); | ||
| return; | ||
| } | ||
|
|
||
| if (changeBindAddr(v, vlen) == C_ERR) { | ||
| addReplyError(c, "Failed to bind to specified addresses."); | ||
| sdsfreesplitres(v, vlen); | ||
| return; | ||
| } | ||
| sdsfreesplitres(v, vlen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too much indentation.
| /* Integer configs */ | ||
| createIntConfig("databases", NULL, IMMUTABLE_CONFIG, 1, INT_MAX, server.dbnum, 16, INTEGER_CONFIG, NULL, NULL), | ||
| createIntConfig("port", NULL, IMMUTABLE_CONFIG, 0, 65535, server.port, 6379, INTEGER_CONFIG, NULL, NULL), /* TCP port. */ | ||
| createIntConfig("port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.port, 6379, INTEGER_CONFIG, NULL, updatePort), /* TCP port. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remember to remove these from the non-mutable config list in tests/unit/introspection.tcl
code review: - fix indentation - remove these configurations from skip_configs in introspection.tcl
| } | ||
|
|
||
| if (changeListenPort(val, &server.ipfd, acceptTcpHandler) == C_ERR) { | ||
| *err = "Unable to listen on this port. Check server logs."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see new information added to the logs in changeListenPort, so perhaps change the message to something like:
"Unable to bind to port %d."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suppose it refers to the log print in listenToPort
Add ability to modify port, tls-port and bind configurations by CONFIG SET command. To simplify the code and make it cleaner, a new structure added, socketFds, which contains the file descriptors array and its counter, and used for TCP, TLS and Cluster sockets file descriptors.
Add ability to modify port, tls-port and bind configurations by CONFIG SET command.
To simplify the code and make it cleaner, a new structure
added, socketFds, which contains the file descriptors array and its counter,
and used for TCP, TLS and Cluster sockets file descriptors.