bitwalker / libcluster

Automatic cluster formation/healing for Elixir applications
MIT License
1.97k stars 188 forks source link

Add_membership should use the supplied if address. #164

Closed veedo closed 3 years ago

veedo commented 3 years ago

Summary of changes

Kernels react differently to adding mcast membership to the "0.0.0.0" address depending on how interfaces are set up and how the kernel is configured. In some situations, on Linux, the socket won't even receive Any traffic. There's no perfect way to solve this, but it makes more sense to add the multicast membership to the same interface address being used by the underlying socket. The other option is to allow the user to supply all the interface IPs to listen on or force them to use setsockopts through a function.

Using if_addr was the smallest change I could think of to fix the weird behaviour. If people do not supply if_addr or use "0.0.0.0", this essentially reverts back to the previous behaviour.

Checklist

veedo commented 3 years ago

Something about this doesn't fix the issue on windows. Checking socket stuff to see why.