src/local_ip.rs was calling out to the hostname binary, which isn't a portable way of getting the local address - macOS doesn't have the binary at all and on my Linux distro hostname takes -i instead of -I. Spark uses the SPARK_LOCAL_IP environmental variable, so I used it too.
The master address and port were passed around lots of places, then later converted to a SocketAddr, it's simpler to just immediately create a SocketAddr and pass that around without needing to worry about parsing errors.
I added unit tests for the reading of the addresses, but one part that needs more attention are the couple of places where 0.0.0.0:{} was hard coded as the master address, which now use the configurable value.
src/local_ip.rs
was calling out to the hostname binary, which isn't a portable way of getting the local address - macOS doesn't have the binary at all and on my Linux distro hostname takes-i
instead of-I
. Spark uses the SPARK_LOCAL_IP environmental variable, so I used it too.The master address and port were passed around lots of places, then later converted to a SocketAddr, it's simpler to just immediately create a SocketAddr and pass that around without needing to worry about parsing errors.
I added unit tests for the reading of the addresses, but one part that needs more attention are the couple of places where
0.0.0.0:{}
was hard coded as the master address, which now use the configurable value.