From a001d6a9415e61a31b8d0abcddb20ed638fd9916 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Wed, 25 Dec 2013 19:35:43 +0000 Subject: Use proper address family when creating Socket from (PeerAddr IP) --- src/Network/BitTorrent/Exchange/Wire.hs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/Network/BitTorrent/Exchange/Wire.hs') diff --git a/src/Network/BitTorrent/Exchange/Wire.hs b/src/Network/BitTorrent/Exchange/Wire.hs index a3b60b99..31da3f0c 100644 --- a/src/Network/BitTorrent/Exchange/Wire.hs +++ b/src/Network/BitTorrent/Exchange/Wire.hs @@ -518,13 +518,6 @@ initiateHandshake sock hs = do sendHandshake sock hs recvHandshake sock --- | Tries to connect to peer using reasonable default parameters. -connectToPeer :: PeerAddr IP -> IO Socket -connectToPeer p = do - sock <- socket AF_INET Stream Network.Socket.defaultProtocol - connect sock (peerSockAddr p) - return sock - {----------------------------------------------------------------------- -- Wire -----------------------------------------------------------------------} @@ -648,7 +641,7 @@ reconnect = undefined -- connectWire :: Handshake -> PeerAddr IP -> ExtendedCaps -> Wire () -> IO () connectWire hs addr extCaps wire = - bracket (connectToPeer addr) close $ \ sock -> do + bracket (peerSocket Stream addr) close $ \ sock -> do hs' <- initiateHandshake sock hs Prelude.mapM_ (\(t,e) -> unless t $ throwIO $ ProtocolError e) [ -- cgit v1.2.3