diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2013-12-25 19:35:43 +0000 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-05 06:44:04 +0400 |
commit | a001d6a9415e61a31b8d0abcddb20ed638fd9916 (patch) | |
tree | 7d9aeacb0c1b3f051005bf69ef6ffa933648edbd /src/Network/BitTorrent/Exchange | |
parent | 66901ca70551105a6eb05c676b0dded8b1af3bfd (diff) |
Use proper address family when creating Socket from (PeerAddr IP)
Diffstat (limited to 'src/Network/BitTorrent/Exchange')
-rw-r--r-- | src/Network/BitTorrent/Exchange/Wire.hs | 9 |
1 files changed, 1 insertions, 8 deletions
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 | |||
518 | sendHandshake sock hs | 518 | sendHandshake sock hs |
519 | recvHandshake sock | 519 | recvHandshake sock |
520 | 520 | ||
521 | -- | Tries to connect to peer using reasonable default parameters. | ||
522 | connectToPeer :: PeerAddr IP -> IO Socket | ||
523 | connectToPeer p = do | ||
524 | sock <- socket AF_INET Stream Network.Socket.defaultProtocol | ||
525 | connect sock (peerSockAddr p) | ||
526 | return sock | ||
527 | |||
528 | {----------------------------------------------------------------------- | 521 | {----------------------------------------------------------------------- |
529 | -- Wire | 522 | -- Wire |
530 | -----------------------------------------------------------------------} | 523 | -----------------------------------------------------------------------} |
@@ -648,7 +641,7 @@ reconnect = undefined | |||
648 | -- | 641 | -- |
649 | connectWire :: Handshake -> PeerAddr IP -> ExtendedCaps -> Wire () -> IO () | 642 | connectWire :: Handshake -> PeerAddr IP -> ExtendedCaps -> Wire () -> IO () |
650 | connectWire hs addr extCaps wire = | 643 | connectWire hs addr extCaps wire = |
651 | bracket (connectToPeer addr) close $ \ sock -> do | 644 | bracket (peerSocket Stream addr) close $ \ sock -> do |
652 | hs' <- initiateHandshake sock hs | 645 | hs' <- initiateHandshake sock hs |
653 | 646 | ||
654 | Prelude.mapM_ (\(t,e) -> unless t $ throwIO $ ProtocolError e) [ | 647 | Prelude.mapM_ (\(t,e) -> unless t $ throwIO $ ProtocolError e) [ |