Skip to content
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

Open
wants to merge 3 commits into
base: unstable
Choose a base branch
from

Conversation

hwware
Copy link
Member

@hwware hwware commented Feb 7, 2025

This PR add a new function, verifyPortNumber() to check the valid port number for cluster meet command

@hwware hwware force-pushed the cluster-meet-port-check branch from 470e164 to 007f9c6 Compare February 7, 2025 18:39
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 71.10%. Comparing base (da3f1c6) to head (1ab8b98).
Report is 17 commits behind head on unstable.

Files with missing lines Patch % Lines
src/cluster.c 46.66% 8 Missing ⚠️
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     
Files with missing lines Coverage Δ
src/cluster_legacy.c 86.37% <100.00%> (+0.11%) ⬆️
src/cluster.c 88.34% <46.66%> (-0.89%) ⬇️

... and 30 files with indirect coverage changes

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) {
Copy link
Member

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.

Copy link
Member Author

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);
Copy link
Member

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.

Copy link
Member Author

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.

@hwware hwware force-pushed the cluster-meet-port-check branch from 56b0034 to 1ab8b98 Compare February 10, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants