Closed nolith closed 5 years ago
Thank you for your contribution! Agree that HasParent
makes sense.
Are you experiencing problems with dangling Unix sockets? The library should handle removing them if they are unused in the child.
Thanks @lmb, no I had no direct problem with the library.
What happened in my case is that the codebase I'm working on removes all the Unix sockets on boot before listening.
This is useful in case something went south on a previous run and you have the unix files left on disk.
With tableflip this approach will remove the unix socket during an upgrade and then even if upg.Fds.Listen("unix", path)
returns a valid socket, you no longer have the file and clients can't connect.
As a first attempt I had to:
con, err = upg.Fds.Listen("unix", path)
return nil, err
return upg.Fds.Listen("unix", path)
return con, err
But I think you will agree that this adds a lot of complexity for no good reason
Sure thing! I was contemplating whether this should be exposed, but didn't have a good use case in mind.
Thanks again for contributing, and for writing tests as well!
There are situations in which is useful to detect the first invocation, i.e. you may want to cleanup dangling unix sockets, but not during an upgrade.
Closes #23