summaryrefslogtreecommitdiff
path: root/Assistant/Pairing
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-12 01:18:52 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-12 01:18:52 -0400
commit4e48f5e6d61dbe423174a375971b523222a984d7 (patch)
tree654d4c6d8a04ae7a40fb55fc13dea4c1436b4c9a /Assistant/Pairing
parent6b36c18f2daf681ca8fe84b551b323b7a422c23a (diff)
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.
Diffstat (limited to 'Assistant/Pairing')
-rw-r--r--Assistant/Pairing/Network.hs2
1 files changed, 2 insertions, 0 deletions
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