diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-11-22 02:19:59 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-11-22 02:19:59 +0400 |
commit | 1c0b414c732507851454cf75da1e74b1c89fed7d (patch) | |
tree | bbd3775fece96d83361c5e869b61c3051b5618d0 /src/Network/BitTorrent/Core | |
parent | 6634363e46211ebb65bae32d4e6cccd940f401c1 (diff) |
Add compact peer list constructor
Diffstat (limited to 'src/Network/BitTorrent/Core')
-rw-r--r-- | src/Network/BitTorrent/Core/PeerAddr.hs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/Network/BitTorrent/Core/PeerAddr.hs b/src/Network/BitTorrent/Core/PeerAddr.hs index 73aa69fd..a4f45e74 100644 --- a/src/Network/BitTorrent/Core/PeerAddr.hs +++ b/src/Network/BitTorrent/Core/PeerAddr.hs | |||
@@ -16,7 +16,6 @@ | |||
16 | module Network.BitTorrent.Core.PeerAddr | 16 | module Network.BitTorrent.Core.PeerAddr |
17 | ( -- * Peer address | 17 | ( -- * Peer address |
18 | PeerAddr(..) | 18 | PeerAddr(..) |
19 | , getCompactPeerList | ||
20 | , peerSockAddr | 19 | , peerSockAddr |
21 | , connectToPeer | 20 | , connectToPeer |
22 | , ppPeer | 21 | , ppPeer |
@@ -80,16 +79,14 @@ instance BEncode PeerAddr where | |||
80 | 79 | ||
81 | -- | The tracker "compact peer list" compatible encoding. The | 80 | -- | The tracker "compact peer list" compatible encoding. The |
82 | -- 'peerId' is always 'Nothing'. | 81 | -- 'peerId' is always 'Nothing'. |
82 | -- | ||
83 | -- For more info see: <http://www.bittorrent.org/beps/bep_0023.html> | ||
83 | instance Serialize PeerAddr where | 84 | instance Serialize PeerAddr where |
84 | put PeerAddr {..} = put peerID >> put peerPort | 85 | put PeerAddr {..} = put peerID >> put peerPort |
85 | {-# INLINE put #-} | 86 | {-# INLINE put #-} |
86 | get = PeerAddr Nothing <$> get <*> get | 87 | get = PeerAddr Nothing <$> get <*> get |
87 | {-# INLINE get #-} | 88 | {-# INLINE get #-} |
88 | 89 | ||
89 | -- | For more info see: <http://www.bittorrent.org/beps/bep_0023.html> | ||
90 | getCompactPeerList :: S.Get [PeerAddr] | ||
91 | getCompactPeerList = many get | ||
92 | |||
93 | -- TODO make platform independent, clarify htonl | 90 | -- TODO make platform independent, clarify htonl |
94 | 91 | ||
95 | -- | Convert peer info from tracker response to socket address. Used | 92 | -- | Convert peer info from tracker response to socket address. Used |