From 4e48f5e6d61dbe423174a375971b523222a984d7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 12 Sep 2012 01:18:52 -0400 Subject: fixed the multicast socket fd leak Turns out sClose was working fine.. but it was not being run on every opened socket. The upstream bug is that multicastSender can crash on an invalid (or ipv6) address and when this happens it's already opened a socket, which just goes missing with no way to close it. A simple fix to the library can avoid this, as I describe here: https://github.com/audreyt/network-multicast/issues/2 In the meantime, just skipping ipv6 addresses will fix the fd leak. --- Assistant/Pairing/Network.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Assistant/Pairing/Network.hs') diff --git a/Assistant/Pairing/Network.hs b/Assistant/Pairing/Network.hs index 768d6b7c2..7ce34962d 100644 --- a/Assistant/Pairing/Network.hs +++ b/Assistant/Pairing/Network.hs @@ -57,6 +57,8 @@ multicastPairMsg repeats secret pairdata stage = go M.empty repeats mapM_ (sendinterface cache') addrs threadDelaySeconds (Seconds 2) go cache' $ pred <$> n + {- The multicast library currently chokes on ipv6 addresses. -} + sendinterface cache (IPv6Addr _) = noop sendinterface cache i = void $ catchMaybeIO $ withSocketsDo $ bracket setup cleanup use where -- cgit v1.2.3