diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-07 03:41:08 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-07 03:41:08 +0400 |
commit | 0968d03183996fb090bb7e8963eb97581538bfab (patch) | |
tree | b7982e2b7087979aaa1012178317f79a77b4a1b2 /src | |
parent | 10cebfb3bf311d386af2a849c13e5e99bd975f57 (diff) |
rename peerID field to peerId
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/BitTorrent/Core/PeerAddr.hs | 6 | ||||
-rw-r--r-- | src/Network/BitTorrent/Exchange/Wire.hs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/Core/PeerAddr.hs b/src/Network/BitTorrent/Core/PeerAddr.hs index 5173c4fc..77f042d5 100644 --- a/src/Network/BitTorrent/Core/PeerAddr.hs +++ b/src/Network/BitTorrent/Core/PeerAddr.hs | |||
@@ -56,7 +56,7 @@ instance Serialize PortNumber where | |||
56 | -- | Peer address info normally extracted from peer list or peer | 56 | -- | Peer address info normally extracted from peer list or peer |
57 | -- compact list encoding. | 57 | -- compact list encoding. |
58 | data PeerAddr = PeerAddr { | 58 | data PeerAddr = PeerAddr { |
59 | peerID :: !(Maybe PeerId) | 59 | peerId :: !(Maybe PeerId) |
60 | , peerIP :: {-# UNPACK #-} !HostAddress | 60 | , peerIP :: {-# UNPACK #-} !HostAddress |
61 | , peerPort :: {-# UNPACK #-} !PortNumber | 61 | , peerPort :: {-# UNPACK #-} !PortNumber |
62 | } deriving (Show, Eq, Ord, Typeable) | 62 | } deriving (Show, Eq, Ord, Typeable) |
@@ -82,14 +82,14 @@ instance BEncode PeerAddr where | |||
82 | -- For more info see: <http://www.bittorrent.org/beps/bep_0023.html> | 82 | -- For more info see: <http://www.bittorrent.org/beps/bep_0023.html> |
83 | -- | 83 | -- |
84 | instance Serialize PeerAddr where | 84 | instance Serialize PeerAddr where |
85 | put PeerAddr {..} = put peerID >> put peerPort | 85 | put PeerAddr {..} = put peerId >> put peerPort |
86 | {-# INLINE put #-} | 86 | {-# INLINE put #-} |
87 | get = PeerAddr Nothing <$> get <*> get | 87 | get = PeerAddr Nothing <$> get <*> get |
88 | {-# INLINE get #-} | 88 | {-# INLINE get #-} |
89 | 89 | ||
90 | instance Pretty PeerAddr where | 90 | instance Pretty PeerAddr where |
91 | pretty p @ PeerAddr {..} | 91 | pretty p @ PeerAddr {..} |
92 | | Just pid <- peerID = pretty (fingerprint pid) <+> "at" <+> paddr | 92 | | Just pid <- peerId = pretty (fingerprint pid) <+> "at" <+> paddr |
93 | | otherwise = paddr | 93 | | otherwise = paddr |
94 | where | 94 | where |
95 | paddr = text (show (peerSockAddr p)) | 95 | paddr = text (show (peerSockAddr p)) |
diff --git a/src/Network/BitTorrent/Exchange/Wire.hs b/src/Network/BitTorrent/Exchange/Wire.hs index 1cf14809..2c8eb316 100644 --- a/src/Network/BitTorrent/Exchange/Wire.hs +++ b/src/Network/BitTorrent/Exchange/Wire.hs | |||
@@ -233,7 +233,7 @@ connectWire hs addr extCaps wire = | |||
233 | unless (hsInfoHash hs == hsInfoHash hs') $ do | 233 | unless (hsInfoHash hs == hsInfoHash hs') $ do |
234 | throwIO $ ProtocolError $ UnexpectedTopic (hsInfoHash hs') | 234 | throwIO $ ProtocolError $ UnexpectedTopic (hsInfoHash hs') |
235 | 235 | ||
236 | unless (hsPeerId hs' == fromMaybe (hsPeerId hs') (peerID addr)) $ do | 236 | unless (hsPeerId hs' == fromMaybe (hsPeerId hs') (peerId addr)) $ do |
237 | throwIO $ ProtocolError $ UnexpectedPeerId (hsPeerId hs') | 237 | throwIO $ ProtocolError $ UnexpectedPeerId (hsPeerId hs') |
238 | 238 | ||
239 | let caps = hsReserved hs <> hsReserved hs' | 239 | let caps = hsReserved hs <> hsReserved hs' |