diff --git a/Assistant/Pairing/Network.hs b/Assistant/Pairing/Network.hs index 694dcbbcc3..09f0fc3207 100644 --- a/Assistant/Pairing/Network.hs +++ b/Assistant/Pairing/Network.hs @@ -20,6 +20,8 @@ import Utility.Verifiable import Network.Multicast import Network.Info import Network.Socket +import qualified Network.Socket.ByteString as B +import qualified Data.ByteString.UTF8 as BU8 import qualified Data.Map as M import Control.Concurrent @@ -63,10 +65,11 @@ multicastPairMsg repeats secret pairdata stage = go M.empty repeats withSocketsDo $ bracket setup cleanup use where setup = multicastSender (multicastAddress IPv4AddrClass) pairingPort - cleanup (sock, _) = sClose sock -- FIXME does not work + cleanup (sock, _) = close sock -- FIXME does not work use (sock, addr) = do setInterface sock (showAddr i) - maybe noop (\s -> void $ sendTo sock s addr) + maybe noop + (\s -> void $ B.sendTo sock (BU8.fromString s) addr) (M.lookup i cache) updatecache cache [] = cache updatecache cache (i:is) diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index 29deb24df4..3d2c31a897 100644 --- a/Utility/WebApp.hs +++ b/Utility/WebApp.hs @@ -127,12 +127,12 @@ getSocket h = do go' :: Int -> AddrInfo -> IO Socket go' 0 _ = error "unable to bind to local socket" go' n addr = do - r <- tryIO $ bracketOnError (open addr) sClose (useaddr addr) + r <- tryIO $ bracketOnError (open addr) close (useaddr addr) either (const $ go' (pred n) addr) return r open addr = socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr) useaddr addr sock = do preparesocket sock - bindSocket sock (addrAddress addr) + bind sock (addrAddress addr) use sock #endif preparesocket sock = setSocketOption sock ReuseAddr 1