Comments (4)
Looks like this test got flakier with the recent changes.
from zeroconf.
I just ran the race detector in my project and it caught the TTL issue immediately. In my case:
server, _ := zeroconf.Register(...) // Starts the server, which can read the ttl value at any point
server.TTL(1234) // Writes the ttl value without thread safety
So I'd upgrade this from "flaky test" to "actual bug" that will happen. We could:
- Use atomic load/store on the ttl value. Note this still has a logical race condition between default ttl and user-provided.
- Provide ttl in a new spread arg
opts ...
toRegister
(similar toBrowse
to avoid breaking API).
I'd prefer 2, WDYT? Accepting PRs?
from zeroconf.
- Use atomic load/store on the ttl value. Note this still has a logical race condition between default ttl and user-provided.
Agreed. This is ugly.
- Provide ttl in a new spread arg opts ... to Register (similar to Browse to avoid breaking API).
Sounds good. Looking at the API, it would be nice to get rid of the []net.Interface
as well (as we do for the client), but that would be breaking interface change, so let's not do that. Strictly speaking, adding an ...Option
is also a breaking change, but we can probably just ignore that to avoid cutting v3 ;)
Is there any real use case for modifying the TTL after the fact? Otherwise, we can just deprecate that function.
Accepting PRs?
Yes! That would be highly appreciated!
from zeroconf.
Great! Sent a PR your way. Left the test itself alone for now, since it uses a harness method that I didn't want to fiddle with too much.
Is there any real use case for modifying the TTL after the fact? Otherwise, we can just deprecate that function.
I don't think so either. Something along the lines of "I'm going away soon, so please overwrite your previous TTL with a shorter one" perhaps, and if so also v3 material? Deprecated it in the PR.
from zeroconf.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zeroconf.