Skip to content

Commit

Permalink
Move the version string to the Version.hs.in file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlouis committed May 1, 2010
1 parent 8f72bd5 commit 2b9a39e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 2 additions & 8 deletions src/Torrent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module Torrent (
, defaultBlockSize
, defaultOptimisticSlots
, defaultPort
, haskellTorrentVersion
, mkPeerId
, mkTorrentInfo
)
Expand All @@ -45,6 +44,7 @@ import Test.QuickCheck

import Protocol.BCode
import Digest
import Version

-- | The type of Infohashes as used in torrents. These are identifiers
-- of torrents
Expand Down Expand Up @@ -131,12 +131,6 @@ defaultOptimisticSlots = 2
defaultPort :: PortNumber
defaultPort = PortNum $ fromInteger 1579

-- | The current version of the Combinatorrent protocol string. This is bumped
-- whenever we make a radical change to the protocol communication or fix a grave bug.
-- It provides a way for trackers to disallow versions of the client which are misbehaving.
haskellTorrentVersion :: String
haskellTorrentVersion = "d001"

-- | Convert a BCode block into its corresponding TorrentInfo block, perhaps
-- failing in the process.
mkTorrentInfo :: BCode -> IO TorrentInfo
Expand All @@ -158,4 +152,4 @@ mkPeerId gen = header ++ take (20 - length header) ranString
randomList n = take n . unfoldr (Just . random)
rs = randomList 10 gen
ranString = concatMap (\i -> showHex (abs i) "") rs
header = "-HT" ++ haskellTorrentVersion ++ "-"
header = "-CT" ++ protoVersion ++ "-"
8 changes: 7 additions & 1 deletion src/Version.hs.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
-- | Combinatorrent version
module Version (version) where
module Version (protoVersion, version) where

-- | The current version of the Combinatorrent protocol string. This is bumped
-- whenever we make a radical change to the protocol communication or fix a grave bug.
-- It provides a way for trackers to disallow versions of the client which are misbehaving.
protoVersion :: String
protoVersion = "d001"

githead :: String
githead = "@GITHEAD@"
Expand Down

0 comments on commit 2b9a39e

Please sign in to comment.