nixcloud / ip2unix

Turn IP sockets into Unix domain sockets
GNU Lesser General Public License v3.0
361 stars 10 forks source link

add option to unlink socket before use #7

Closed riedel closed 4 years ago

riedel commented 4 years ago

Would be great if one would not have to unlink all sockets manually before running a command again. Should be an explicit option due to the chance of race conditions and unwanted side effects.

aszlig commented 4 years ago

@riedel: What do you think about unlinking the socket path whenever SO_REUSEADDR is set on the socket? That would pretty much mimick IP behaviour.

riedel commented 4 years ago

I think that is probably a good idea. But don't really ask me about all the semantics of SO_REUSEADDRand SO_REUSEPORT (here one would need to keep state across invocations). My gut feeling is that it leads to a bit of different behaviour, but it might be a sane default behaviour. I would maybe make add an option to force turning off and on this behaviour independent of the flag beeing set (After reading some considerations on UNIX socket locking and side effects I think it makes sense). The unlinking logic would be there and adding the option would add the possibility for manual override.