summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Exchange/Message.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Exchange/Message.hs')
-rw-r--r--src/Network/BitTorrent/Exchange/Message.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/Exchange/Message.hs b/src/Network/BitTorrent/Exchange/Message.hs
index eccffc77..f29dec10 100644
--- a/src/Network/BitTorrent/Exchange/Message.hs
+++ b/src/Network/BitTorrent/Exchange/Message.hs
@@ -48,6 +48,7 @@ module Network.BitTorrent.Exchange.Message
48 -- * Messages 48 -- * Messages
49 , Message (..) 49 , Message (..)
50 , PeerMessage (..) 50 , PeerMessage (..)
51 , defaultKeepAliveInterval
51 52
52 -- ** Core messages 53 -- ** Core messages
53 , StatusUpdate (..) 54 , StatusUpdate (..)
@@ -581,9 +582,9 @@ type MessageId = Word8
581data Message 582data Message
582 -- | Peers may close the TCP connection if they have not received 583 -- | Peers may close the TCP connection if they have not received
583 -- any messages for a given period of time, generally 2 584 -- any messages for a given period of time, generally 2
584 -- minutes. Thus, the "keep-alive" message is sent tot keep the 585 -- minutes. Thus, the KeepAlive message is sent to keep the
585 -- connection between two peers alive, if no /other/ message has 586 -- connection between two peers alive, if no /other/ message has
586 -- been sentin a given period of time. 587 -- been sent in a given period of time.
587 = KeepAlive 588 = KeepAlive
588 | Status !StatusUpdate 589 | Status !StatusUpdate
589 | Regular !RegularMessage 590 | Regular !RegularMessage
@@ -623,6 +624,10 @@ instance PeerMessage PortNumber where
623 requires _ = Just ExtDHT 624 requires _ = Just ExtDHT
624 {-# INLINE requires #-} 625 {-# INLINE requires #-}
625 626
627-- | In seconds.
628defaultKeepAliveInterval :: Int
629defaultKeepAliveInterval = 2 * 60
630
626getInt :: S.Get Int 631getInt :: S.Get Int
627getInt = fromIntegral <$> S.getWord32be 632getInt = fromIntegral <$> S.getWord32be
628{-# INLINE getInt #-} 633{-# INLINE getInt #-}