summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/BitTorrent/Core/Node.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/Core/Node.hs b/src/Network/BitTorrent/Core/Node.hs
index 116333c5..82f05de4 100644
--- a/src/Network/BitTorrent/Core/Node.hs
+++ b/src/Network/BitTorrent/Core/Node.hs
@@ -118,10 +118,14 @@ genNodeId = NodeId <$> getEntropy nodeIdSize
118data NodeAddr a = NodeAddr 118data NodeAddr a = NodeAddr
119 { nodeHost :: !a 119 { nodeHost :: !a
120 , nodePort :: {-# UNPACK #-} !PortNumber 120 , nodePort :: {-# UNPACK #-} !PortNumber
121 } deriving (Show, Eq, Typeable) 121 } deriving (Eq, Typeable)
122 122
123$(deriveJSON omitRecordPrefix ''NodeAddr) 123$(deriveJSON omitRecordPrefix ''NodeAddr)
124 124
125instance Show a => Show (NodeAddr a) where
126 showsPrec i NodeAddr {..}
127 = showsPrec i nodeHost <> showString ":" <> showsPrec i nodePort
128
125instance Read (NodeAddr IPv4) where 129instance Read (NodeAddr IPv4) where
126 readsPrec i x = [ (fromPeerAddr a, s) | (a, s) <- readsPrec i x ] 130 readsPrec i x = [ (fromPeerAddr a, s) | (a, s) <- readsPrec i x ]
127 131