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

Multiple instances with same service #72

Open
soundprojects opened this issue Aug 11, 2022 · 2 comments
Open

Multiple instances with same service #72

soundprojects opened this issue Aug 11, 2022 · 2 comments

Comments

@soundprojects
Copy link
Contributor

soundprojects commented Aug 11, 2022

When trying to run the same code on two different clients, they both fight over the same name
Shouldn't hap-rs rename the service to 'service (1)' and so on?

And should this also mean that the c# number should be incremented when adding the second service? Now they have the same id's?

@ewilken
Copy link
Owner

ewilken commented Aug 11, 2022

When trying to run the same code on two different clients, they both fight over the same name
Shouldn't hap-rs rename the service to 'service (1)' and so on?

You mean running the program with the exact same parameters on different network clients at the same time? Good question, I don't know what the expected name collision behavior for mDNS clients is there. Do you? And is this a use case?

And should this also mean that the c# number should be incremented when adding the second service? Now they have the same id's?

Interesting. The HAP specification says

Must update when an accessory, service, or characteristic is added or removed on the accessory server.

about it. We're updating the number on accessory additions and removals. Since we don't have methods for dynamic addition and removal of services to accessories or characteristics to services, I'd say as of right now it's up to the crate user to bump the number whenever they change services or characteristics.

@soundprojects
Copy link
Contributor Author

I read into this with the (great) Oreilly book on zeroconf networking and the renaming behavior 'service (1)' should happen but when running two clients with the exact same configuration this doesn't happen. The second service simply replaces the DNS records. I think this is incorrect behavior.

I ran into this also because in the examples of your crate, you pass an example Mac Adress as the ID. This causes identical ID's to be generated when running the same code in different clients in the network. (My dev mac and the raspberry production device)

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

No branches or pull requests

2 participants