diff options
Diffstat (limited to 'Assistant/Pairing')
-rw-r--r-- | Assistant/Pairing/MakeRemote.hs | 22 | ||||
-rw-r--r-- | Assistant/Pairing/Network.hs | 14 |
2 files changed, 18 insertions, 18 deletions
diff --git a/Assistant/Pairing/MakeRemote.hs b/Assistant/Pairing/MakeRemote.hs index 7c971c2e1..8324fe1bd 100644 --- a/Assistant/Pairing/MakeRemote.hs +++ b/Assistant/Pairing/MakeRemote.hs @@ -23,8 +23,8 @@ setupAuthorizedKeys msg = do validateSshPubKey pubkey unlessM (liftIO $ addAuthorizedKeys False pubkey) $ error "failed setting up ssh authorized keys" - where - pubkey = remoteSshPubKey $ pairMsgData msg + where + pubkey = remoteSshPubKey $ pairMsgData msg {- When pairing is complete, this is used to set up the remote for the host - we paired with. -} @@ -78,12 +78,12 @@ bestHostName msg = case remoteHostName $ pairMsgData msg of getAddrInfo Nothing (Just localname) Nothing maybe fallback (const $ return localname) (headMaybe addrs) Nothing -> fallback - where - fallback = do - let a = pairMsgAddr msg - let sockaddr = case a of - IPv4Addr addr -> SockAddrInet (PortNum 0) addr - IPv6Addr addr -> SockAddrInet6 (PortNum 0) 0 addr 0 - fromMaybe (showAddr a) - <$> catchDefaultIO Nothing - (fst <$> getNameInfo [] True False sockaddr) + where + fallback = do + let a = pairMsgAddr msg + let sockaddr = case a of + IPv4Addr addr -> SockAddrInet (PortNum 0) addr + IPv6Addr addr -> SockAddrInet6 (PortNum 0) 0 addr 0 + fromMaybe (showAddr a) + <$> catchDefaultIO Nothing + (fst <$> getNameInfo [] True False sockaddr) diff --git a/Assistant/Pairing/Network.hs b/Assistant/Pairing/Network.hs index 9ee1db3c6..44a63df36 100644 --- a/Assistant/Pairing/Network.hs +++ b/Assistant/Pairing/Network.hs @@ -62,13 +62,13 @@ multicastPairMsg repeats secret pairdata stage = go M.empty repeats sendinterface _ (IPv6Addr _) = noop sendinterface cache i = void $ catchMaybeIO $ withSocketsDo $ bracket setup cleanup use - where - setup = multicastSender (multicastAddress i) pairingPort - cleanup (sock, _) = sClose sock -- FIXME does not work - use (sock, addr) = do - setInterface sock (showAddr i) - maybe noop (\s -> void $ sendTo sock s addr) - (M.lookup i cache) + where + setup = multicastSender (multicastAddress i) pairingPort + cleanup (sock, _) = sClose sock -- FIXME does not work + use (sock, addr) = do + setInterface sock (showAddr i) + maybe noop (\s -> void $ sendTo sock s addr) + (M.lookup i cache) updatecache cache [] = cache updatecache cache (i:is) | M.member i cache = updatecache cache is |