switch away from deprecated interface

Again the new stuff works back to network-2.4, so no need to adjust cabal
bounds.
This commit is contained in:
Joey Hess 2016-09-05 14:39:44 -04:00
parent 12db586469
commit 29b6ab467a
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
2 changed files with 7 additions and 4 deletions

View file

@ -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)