audreyt / network-multicast

[Haskell] The "Network.Multicast" module is for sending UDP datagrams over multicast (class D) addresses.
http://github.com/audreyt/network-multicast
Other
23 stars 12 forks source link

fix multicastReceiver socket leak when unable to set up socket #6

Closed joeyh closed 11 years ago

joeyh commented 11 years ago

bracketOnError the socket setup, so that the socket can be closed if setup fails. The exception is still propigated to the caller as before, the only difference is the file descriptor leak is fixed. Fixes issue #4

Also fixed issue #5, since I cannot test without it. Avoid trying to use SO_REUSEPORT on Linux, since it fails with Linux 3.10 here. It's not clear why the linux kernel headers define SO_REUSEPORT if the kernel does not support it. This may change in a future version of Linux or possibly Glibc.