haskell-distributed / network-transport-tcp

TCP Realisation of Network.Transport
http://haskell-distributed.github.com
BSD 3-Clause "New" or "Revised" License
30 stars 25 forks source link

Allow binding to a random port. #3

Closed mboes closed 9 years ago

mboes commented 10 years ago

In TCP, binding to port 0 means asking the OS to choose an available port to bind to. In this case, network-transport-tcp erroneously thinks the address is then "host:0", which has no meaning to any peer.

This patch fixes the situation, by querying what port was obtained from the OS before constructing the endpoint address.