-
Notifications
You must be signed in to change notification settings - Fork 3
fix: Allow multiple dispatch instances to work #16
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
base: main
Are you sure you want to change the base?
Conversation
1567d5a to
9e4efee
Compare
|
Outdated Note that, even with this patch, if you use the same dispatch command line that you've been using, you may still encounter the issue. The idea is to use one of the new command line options, --avahi-random or --avahi-suffix. |
|
Outdated This PR adds and uses the rand crate but does not include changes to Cargo.lock. What's our convention for picking the version that goes into Cargo.lock? |
3b401cd to
234f9a6
Compare
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.
Pull request overview
This PR enables multiple dispatch instances to run simultaneously by preventing Avahi service name collisions. The implementation adds a random hexadecimal suffix to service names, though the PR description mentions command-line options (--avahi-random and --avahi-suffix) that are not present in the code changes.
Key Changes:
- Automatic generation of random 4-digit hex suffix for Avahi service names
- Addition of
randcrate dependency to support random suffix generation
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/avahi.rs | Implements random suffix generation and appends it to service names during registration |
| Cargo.toml | Adds rand crate as a dependency with minimal features enabled |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b711b88 to
2a17b51
Compare
Add 16-bit random suffix to Avahi service name. Add rand crate as a dependency of dispatch in a way that doesn't add new deps. Resolves: AMDEPYC#4
2a17b51 to
a0faf69
Compare
| let random_suffix: u16 = rand::random(); | ||
| let service_name = format!("{name}-{random_suffix:04x}"); |
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.
| let random_suffix: u16 = rand::random(); | |
| let service_name = format!("{name}-{random_suffix:04x}"); | |
| let service_name = format!("{name}-{:04x}", rand::random::<u16>()); |
| http-body-util = { version = "0.1", default-features = false } | ||
| serde_json = { version = "1.0", default-features = false } | ||
| anyhow = { version = "1.0", default-features = false } | ||
| rand = { version = "0.9", default-features = false, features = ["std", "std_rng", "thread_rng"] } |
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.
Are all those features really required? I suspect maybe "thread_rng" is the only required feature.
This PR has been updated twice. Description of current version:
Add 16-bit random suffix to Avahi service name to avoid collisions.
Add rand crate as a dependency of dispatch in a way that doesn't add new deps.
Resolves: #4