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

Allow non-standard max length for a service name #96

Merged
merged 5 commits into from
Mar 6, 2023

Conversation

keepsimple1
Copy link
Owner

@keepsimple1 keepsimple1 commented Mar 5, 2023

This is to solve issue #94 .

A new method ServiceDaemon.set_service_name_len_max() is added to support setting a custom max length for the service name.

A public constant SERVICE_NAME_LEN_MAX_DEFAULT is defined for the default / standard value.

Service name length error reporting (a trade-off): it will no longer return Error directly from register() method for service name length errors. Instead, it will be reported in error log and DaemonEvent::Error received by any monitors. The register itself will not succeed in such error cases. See the test case changes for an example.


/// Validate the length of "service_name" in a "_<service_name>.<domain_name>." string.
fn check_service_name_length(ty_domain: &str, limit: u8) -> Result<()> {
println!("check_service_name_length: {}", ty_domain);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded println.

@smith61
Copy link

smith61 commented Mar 6, 2023

This PR resolves my issue. The only thing I noticed is the unneeded println in check_service_name_length

@keepsimple1
Copy link
Owner Author

This PR resolves my issue. The only thing I noticed is the unneeded println in check_service_name_length

Thanks for checking! I will remove the println and get it merged.

@keepsimple1 keepsimple1 merged commit a07f550 into main Mar 6, 2023
@keepsimple1 keepsimple1 deleted the service-name-limit branch March 6, 2023 02:00
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.

None yet

2 participants