From 688450c2d9998db7b4389dc9642d219774c23857 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Sun, 16 Dec 2018 13:51:02 -0500 Subject: More TCP work. --- src/Data/Torrent.hs | 18 +++++++++--------- src/Data/Tox/Onion.hs | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src/Data') diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs index 69461488..32c709be 100644 --- a/src/Data/Torrent.hs +++ b/src/Data/Torrent.hs @@ -42,7 +42,7 @@ module Data.Torrent , FileOffset , FileSize , FileInfo (..) -#ifdef VERSION_lens +#ifdef USE_lens , fileLength , filePath , fileMD5Sum @@ -50,7 +50,7 @@ module Data.Torrent -- ** Layout info , LayoutInfo (..) -#ifdef VERSION_lens +#ifdef USE_lens , singleFile , multiFile , rootDirName @@ -90,7 +90,7 @@ module Data.Torrent -- ** Piece control , HashList (..) , PieceInfo (..) -#ifdef VERSION_lens +#ifdef USE_lens , pieceLength , pieceHashes #endif @@ -102,7 +102,7 @@ module Data.Torrent -- * Info dictionary , InfoDict (..) -#ifdef VERSION_lens +#ifdef USE_lens , infohash , layoutInfo , pieceInfo @@ -115,7 +115,7 @@ module Data.Torrent -- * Torrent file , Torrent(..) -#ifdef VERSION_lens +#ifdef USE_lens -- ** Lenses , announce , announceList @@ -378,7 +378,7 @@ data FileInfo a = FileInfo { , Functor, Foldable ) -#ifdef VERSION_lens +#ifdef USE_lens makeLensesFor [ ("fiLength", "fileLength") , ("fiMD5Sum", "fileMD5Sum") @@ -467,7 +467,7 @@ data LayoutInfo , liDirName :: !BS.ByteString } deriving (Show, Read, Eq, Typeable) -#ifdef VERSION_lens +#ifdef USE_lens makeLensesFor [ ("liFile" , "singleFile" ) , ("liFiles" , "multiFile" ) @@ -695,7 +695,7 @@ data PieceInfo = PieceInfo -- ^ Concatenation of all 20-byte SHA1 hash values. } deriving (Show, Read, Eq, Typeable) -#ifdef VERSION_lens +#ifdef USE_lens -- | Number of bytes in each piece. makeLensesFor [("piPieceLength", "pieceLength")] ''PieceInfo @@ -902,7 +902,7 @@ data Torrent = Torrent -- encrypted SHA-1 hash of the info dictionary). } deriving (Show, Eq, Typeable) -#ifdef VERSION_lens +#ifdef USE_lens makeLensesFor [ ("tAnnounce" , "announce" ) , ("tAnnounceList", "announceList") diff --git a/src/Data/Tox/Onion.hs b/src/Data/Tox/Onion.hs index 85a9d21e..bd802c75 100644 --- a/src/Data/Tox/Onion.hs +++ b/src/Data/Tox/Onion.hs @@ -704,6 +704,7 @@ data DataToRoute = DataToRoute { dataFromKey :: PublicKey -- Real public key of sender , dataToRoute :: Encrypted OnionData -- (Word8,ByteString) -- DHTPK 0x9c } + deriving Show instance Sized DataToRoute where size = ConstSize 32 <> contramap dataToRoute size -- cgit v1.2.3