diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-11 02:47:45 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-11 02:47:45 +0400 |
commit | 772e0d6974f955465345fd3055a3ffde71282a4d (patch) | |
tree | 3a512137097e21ad7d4286c0f11d0213784dd510 | |
parent | 38c1f019d4fdb0fa776c7364d28a2cc96d570bb3 (diff) |
Add defaultKeepAliveTimeout constant
-rw-r--r-- | src/Network/BitTorrent/Exchange/Message.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/Exchange/Message.hs b/src/Network/BitTorrent/Exchange/Message.hs index 335a9050..f848f4cb 100644 --- a/src/Network/BitTorrent/Exchange/Message.hs +++ b/src/Network/BitTorrent/Exchange/Message.hs | |||
@@ -54,6 +54,7 @@ module Network.BitTorrent.Exchange.Message | |||
54 | 54 | ||
55 | -- * Messages | 55 | -- * Messages |
56 | , Message (..) | 56 | , Message (..) |
57 | , defaultKeepAliveTimeout | ||
57 | , defaultKeepAliveInterval | 58 | , defaultKeepAliveInterval |
58 | , PeerMessage (..) | 59 | , PeerMessage (..) |
59 | 60 | ||
@@ -982,9 +983,15 @@ instance PeerMessage PortNumber where | |||
982 | requires _ = Just ExtDHT | 983 | requires _ = Just ExtDHT |
983 | {-# INLINE requires #-} | 984 | {-# INLINE requires #-} |
984 | 985 | ||
985 | -- | In seconds. | 986 | -- | How long /this/ peer should wait before dropping connection, in |
987 | -- seconds. | ||
988 | defaultKeepAliveTimeout :: Int | ||
989 | defaultKeepAliveTimeout = 2 * 60 | ||
990 | |||
991 | -- | How often /this/ peer should send 'KeepAlive' messages, in | ||
992 | -- seconds. | ||
986 | defaultKeepAliveInterval :: Int | 993 | defaultKeepAliveInterval :: Int |
987 | defaultKeepAliveInterval = 2 * 60 | 994 | defaultKeepAliveInterval = 60 |
988 | 995 | ||
989 | getInt :: S.Get Int | 996 | getInt :: S.Get Int |
990 | getInt = fromIntegral <$> S.getWord32be | 997 | getInt = fromIntegral <$> S.getWord32be |