-
Notifications
You must be signed in to change notification settings - Fork 724
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
Create a function to check the connection port #1686
base: unstable
Are you sure you want to change the base?
Conversation
470e164
to
007f9c6
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1686 +/- ##
============================================
+ Coverage 71.06% 71.10% +0.04%
============================================
Files 121 123 +2
Lines 65254 65538 +284
============================================
+ Hits 46371 46604 +233
- Misses 18883 18934 +51
|
src/cluster.c
Outdated
@@ -778,6 +778,33 @@ int isValidAuxString(char *s, unsigned int length) { | |||
return 1; | |||
} | |||
|
|||
int verifyPortNumber(client *c, long long *port, long long *cport) { |
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.
Is there a reason this function is in cluster.c/h instead of static in cluster_legacy.c? It seems to be used only in one place.
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.
The function resetClusterStats() , isNodeAvailable() , clusterNodeIsMyself() are declared in cluster.h, and defined in cluster.c, I just follow the rule.
src/cluster.h
Outdated
@@ -134,4 +134,5 @@ int isNodeAvailable(clusterNode *node); | |||
long long getNodeReplicationOffset(clusterNode *node); | |||
sds aggregateClientOutputBuffer(client *c); | |||
void resetClusterStats(void); | |||
int verifyPortNumber(client *c, long long *port, long long *cport); |
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.
This function does more than just verification, it also parses and assigns port values. Consider renaming it to something like parseAndValidatePorts
for better clarity.
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.
It makes sense to me. Will update.
Signed-off-by: hwware <[email protected]>
Signed-off-by: hwware <[email protected]>
Signed-off-by: hwware <[email protected]>
56b0034
to
1ab8b98
Compare
This PR add a new function, verifyPortNumber() to check the valid port number for cluster meet command