]> git.rkrishnan.org Git - functorrent.git/log
functorrent.git
8 years agoResume download from where it was left off last time
Ramakrishnan Muthukrishnan [Tue, 15 Sep 2015 16:11:36 +0000 (21:41 +0530)]
Resume download from where it was left off last time

This commit looks at the downloaded file, verifies the hashes of
the downloaded pieces, marks them as "have" pieces and proceeds
to download those that are not in its posession.

8 years agorefactor mkPieceMap -> initPieceMap
Ramakrishnan Muthukrishnan [Tue, 15 Sep 2015 12:07:44 +0000 (17:37 +0530)]
refactor mkPieceMap -> initPieceMap

8 years agoUse the server port number in the tracker request
Ramakrishnan Muthukrishnan [Mon, 14 Sep 2015 01:14:05 +0000 (06:44 +0530)]
Use the server port number in the tracker request

8 years agoa crude server implementation
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 16:52:17 +0000 (22:22 +0530)]
a crude server implementation

8 years agoMain: generate random peerid
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 14:48:07 +0000 (20:18 +0530)]
Main: generate random peerid

8 years agoremove the use of ReaderT
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 14:47:48 +0000 (20:17 +0530)]
remove the use of ReaderT

8 years agofix hlint suggestions
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 08:44:16 +0000 (14:14 +0530)]
fix hlint suggestions

8 years agotasty and hunit dependencies are not lib dependencies
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 07:16:07 +0000 (12:46 +0530)]
tasty and hunit dependencies are not lib dependencies

8 years agowip: Use reader to pass around metainfo
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 07:15:35 +0000 (12:45 +0530)]
wip: Use reader to pass around metainfo

8 years agopreparations to introduce Metainfo as an environment
Ramakrishnan Muthukrishnan [Sat, 12 Sep 2015 17:54:28 +0000 (23:24 +0530)]
preparations to introduce Metainfo as an environment

8 years agofunctorrent.cabal: avoid double compilation, one for lib, another for exe
Ramakrishnan Muthukrishnan [Fri, 11 Sep 2015 08:03:11 +0000 (13:33 +0530)]
functorrent.cabal: avoid double compilation, one for lib, another for exe

8 years agoREADME: indent usage examples
Ramakrishnan Muthukrishnan [Tue, 8 Sep 2015 11:17:54 +0000 (16:47 +0530)]
README: indent usage examples

8 years agoPeer: cosmetic indentation fixes
Ramakrishnan Muthukrishnan [Tue, 8 Sep 2015 11:17:35 +0000 (16:47 +0530)]
Peer: cosmetic indentation fixes

8 years agoremove a few reduntant stuff
Ramakrishnan Muthukrishnan [Fri, 4 Sep 2015 06:38:58 +0000 (12:08 +0530)]
remove a few reduntant stuff

8 years agoPeer: export bytesDownloaded function
Ramakrishnan Muthukrishnan [Sat, 5 Sep 2015 17:23:01 +0000 (22:53 +0530)]
Peer: export bytesDownloaded function

8 years agoPeer: function to calculate the total bytes downloaded so far
Ramakrishnan Muthukrishnan [Sat, 5 Sep 2015 17:11:47 +0000 (22:41 +0530)]
Peer: function to calculate the total bytes downloaded so far

8 years agoPeer: refactor pickPiece function
Ramakrishnan Muthukrishnan [Fri, 4 Sep 2015 06:15:39 +0000 (11:45 +0530)]
Peer: refactor pickPiece function

Use the headMay from the Safe package to get a Maybe list head and
lift fst to Maybe to get the key.

8 years agobug: initial state should be meInterested = false, heChoking = true
Ramakrishnan Muthukrishnan [Thu, 3 Sep 2015 13:42:41 +0000 (19:12 +0530)]
bug: initial state should be meInterested = false, heChoking = true

Otherwise, the "InterestedMsg" never get sent.

8 years agopeer: more refactoring. Supports all messages as before
Ramakrishnan Muthukrishnan [Thu, 3 Sep 2015 13:07:18 +0000 (18:37 +0530)]
peer: more refactoring. Supports all messages as before

8 years agoPeer: more refactoring
Ramakrishnan Muthukrishnan [Thu, 3 Sep 2015 12:34:11 +0000 (18:04 +0530)]
Peer: more refactoring

8 years agoPeer: Use Monad Transformers to simplify code
Ramakrishnan Muthukrishnan [Thu, 3 Sep 2015 11:02:49 +0000 (16:32 +0530)]
Peer: Use Monad Transformers to simplify code

Wrap PState in a State Monad. Reorganization of the code in progress.

8 years agoadd mtl, organize packages alphabetically
Ramakrishnan Muthukrishnan [Thu, 3 Sep 2015 11:02:11 +0000 (16:32 +0530)]
add mtl, organize packages alphabetically

8 years agoremove redundant module imports for ghc 7.10
Ramakrishnan Muthukrishnan [Sun, 30 Aug 2015 12:34:54 +0000 (18:04 +0530)]
remove redundant module imports for ghc 7.10

8 years agobump up the version of stackage/lts to 3.2 and use GHC 7.10.x
Ramakrishnan Muthukrishnan [Sun, 30 Aug 2015 08:59:26 +0000 (14:29 +0530)]
bump up the version of stackage/lts to 3.2 and use GHC 7.10.x

8 years agobit torrent -> BitTorrent
Ramakrishnan Muthukrishnan [Mon, 17 Aug 2015 16:37:21 +0000 (22:07 +0530)]
bit torrent -> BitTorrent

8 years agoNot using travis-ci anymore
Ramakrishnan Muthukrishnan [Sat, 15 Aug 2015 08:27:44 +0000 (13:57 +0530)]
Not using travis-ci anymore

8 years agomisc formatting
Ramakrishnan Muthukrishnan [Mon, 3 Aug 2015 14:38:03 +0000 (20:08 +0530)]
misc formatting

8 years agoNow that functorrent is becoming useful, README should be more clear
Ramakrishnan Muthukrishnan [Mon, 3 Aug 2015 14:37:34 +0000 (20:07 +0530)]
Now that functorrent is becoming useful, README should be more clear

8 years agowrite to the file name specified in the info structure
Ramakrishnan Muthukrishnan [Sun, 2 Aug 2015 15:27:28 +0000 (20:57 +0530)]
write to the file name specified in the info structure

8 years agorefactor Peer module
Ramakrishnan Muthukrishnan [Sun, 2 Aug 2015 14:47:19 +0000 (20:17 +0530)]
refactor Peer module

8 years agorefactor msgloop a bit
Ramakrishnan Muthukrishnan [Mon, 27 Jul 2015 14:41:00 +0000 (20:11 +0530)]
refactor msgloop a bit

8 years agopeer is needed only for debug print
Ramakrishnan Muthukrishnan [Mon, 27 Jul 2015 14:28:53 +0000 (19:58 +0530)]
peer is needed only for debug print

8 years agorefactor handshake msg
Ramakrishnan Muthukrishnan [Mon, 27 Jul 2015 13:27:44 +0000 (18:57 +0530)]
refactor handshake msg

8 years agorefactor file operations into Fileops module
Ramakrishnan Muthukrishnan [Sun, 26 Jul 2015 06:38:53 +0000 (12:08 +0530)]
refactor file operations into Fileops module

8 years agobugfix: calculate proper file offset
Ramakrishnan Muthukrishnan [Sat, 25 Jul 2015 06:42:03 +0000 (12:12 +0530)]
bugfix: calculate proper file offset

8 years agohlint caught some ugly code
Ramakrishnan Muthukrishnan [Sat, 25 Jul 2015 06:40:09 +0000 (12:10 +0530)]
hlint caught some ugly code

8 years agoadd a warning in the README
Ramakrishnan Muthukrishnan [Sat, 25 Jul 2015 03:02:24 +0000 (08:32 +0530)]
add a warning in the README

8 years agoREADME: update the current status. ☺
Ramakrishnan Muthukrishnan [Sat, 25 Jul 2015 02:32:03 +0000 (08:02 +0530)]
README: update the current status. ☺

8 years agobugfix: use the previous piece length times number of pieces to calculate offset
Ramakrishnan Muthukrishnan [Sat, 25 Jul 2015 01:29:20 +0000 (06:59 +0530)]
bugfix: use the previous piece length times number of pieces to calculate offset

8 years agoturn on hash verification of every downloaded piece
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 18:54:24 +0000 (00:24 +0530)]
turn on hash verification of every downloaded piece

8 years agobugfix: Hash string needs to be split into 20 bytes
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 17:32:12 +0000 (23:02 +0530)]
bugfix: Hash string needs to be split into 20 bytes

Not the other way round (i.e. split by number of pieces, that' plain
wrong).

8 years agofix file download to create a dummy and write into specific offsets
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 17:06:09 +0000 (22:36 +0530)]
fix file download to create a dummy and write into specific offsets

8 years agoverify SHA1 hash of each piece after assembling the blocks
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 15:43:10 +0000 (21:13 +0530)]
verify SHA1 hash of each piece after assembling the blocks

8 years agowriteFileAtOffset: name says it all
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 14:39:54 +0000 (20:09 +0530)]
writeFileAtOffset: name says it all

Perhaps this should be moved to Util module.

8 years agoreturn a list of bytestring blocks corresponding to the piece index
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 14:19:32 +0000 (19:49 +0530)]
return a list of bytestring blocks corresponding to the piece index

8 years agoPeer: debug prints
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 14:08:54 +0000 (19:38 +0530)]
Peer: debug prints

8 years agoget rid of (some of) the compiler warnings
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 13:32:32 +0000 (19:02 +0530)]
get rid of (some of) the compiler warnings

8 years agosplit download of a piece into chunks of 16384 bytes
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 12:46:27 +0000 (18:16 +0530)]
split download of a piece into chunks of 16384 bytes

The pieceLenth can often be quite big, so we need to split the piece
into smaller blocks of size 16384 bytes. Why 16384? Just an arbit
number. It seem to work okay.

8 years agofix the comments
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 11:04:53 +0000 (16:34 +0530)]
fix the comments

8 years agoget the piece length and store it as piecestate
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 11:00:24 +0000 (16:30 +0530)]
get the piece length and store it as piecestate

This needs to be revisited. Piece Length is the same for all pieces
but we are storing it for every piece number, which is a waste.

8 years agosend request msg and get the piecemsg back
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 09:23:05 +0000 (14:53 +0530)]
send request msg and get the piecemsg back

8 years agopickPiece: a simple algorithm to download the pieces in order
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 08:36:18 +0000 (14:06 +0530)]
pickPiece: a simple algorithm to download the pieces in order

8 years agobug: if I am uninterested and he is choking, send interested msg
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 08:22:36 +0000 (13:52 +0530)]
bug: if I am uninterested and he is choking, send interested msg

8 years agoupdate piece availability list based on the bitmap
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 07:11:03 +0000 (12:41 +0530)]
update piece availability list based on the bitmap

8 years agomsgLoop: more refactoring, better debug prints
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 06:17:38 +0000 (11:47 +0530)]
msgLoop: more refactoring, better debug prints

8 years agomore refactoring around msgLoop
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 04:42:39 +0000 (10:12 +0530)]
more refactoring around msgLoop

8 years agorefactor PeerState: Add connection handle to be part of peerstate
Ramakrishnan Muthukrishnan [Thu, 23 Jul 2015 08:42:06 +0000 (14:12 +0530)]
refactor PeerState: Add connection handle to be part of peerstate

8 years agosendMsg: equiv of getMsg but on the sending side
Ramakrishnan Muthukrishnan [Tue, 21 Jul 2015 06:21:33 +0000 (11:51 +0530)]
sendMsg: equiv of getMsg but on the sending side

8 years agothread peerstate along msgloop
Ramakrishnan Muthukrishnan [Mon, 20 Jul 2015 16:31:32 +0000 (22:01 +0530)]
thread peerstate along msgloop

msgLoop needs a major rethink.

8 years agogitignore .stack-work directory
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 10:17:49 +0000 (15:47 +0530)]
gitignore .stack-work directory

8 years agoupdate REAME.
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 09:58:44 +0000 (15:28 +0530)]
update REAME.

Builds with stack. It is a lot less hasstle now.

8 years agosrc/Main.hs: if no input file is given, read from stdin
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 08:58:32 +0000 (14:28 +0530)]
src/Main.hs: if no input file is given, read from stdin

This change makes it play nicely as a Unix program that consumes
streams of bytes. One possible usage is to do a 'curl' of the torrent
file and pipe into the functorrent program.

8 years agokeep hlint happy
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 08:47:50 +0000 (14:17 +0530)]
keep hlint happy

8 years agohelper function: havePiece
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 06:33:23 +0000 (12:03 +0530)]
helper function: havePiece

8 years agoadd piece hash into the pieceMap
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 06:16:25 +0000 (11:46 +0530)]
add piece hash into the pieceMap

8 years agonew type synonym for a Piece Map
Ramakrishnan Muthukrishnan [Fri, 17 Jul 2015 14:10:25 +0000 (19:40 +0530)]
new type synonym for a Piece Map

8 years agoMain.hs: move peer handling into Peer module
Ramakrishnan Muthukrishnan [Thu, 16 Jul 2015 08:32:11 +0000 (14:02 +0530)]
Main.hs: move peer handling into Peer module

8 years agomove torrentToMetainfo into Metainfo module
Ramakrishnan Muthukrishnan [Sun, 12 Jul 2015 15:52:30 +0000 (21:22 +0530)]
move torrentToMetainfo into Metainfo module

8 years agoMerge branch 'piece-manager'
Ramakrishnan Muthukrishnan [Sun, 12 Jul 2015 10:53:54 +0000 (16:23 +0530)]
Merge branch 'piece-manager'

8 years agorefactoring to make Main simpler
Ramakrishnan Muthukrishnan [Sun, 12 Jul 2015 10:52:26 +0000 (16:22 +0530)]
refactoring to make Main simpler

8 years agoMain: we are parsing arguments, not the input file itself
Ramakrishnan Muthukrishnan [Sun, 12 Jul 2015 08:59:06 +0000 (14:29 +0530)]
Main: we are parsing arguments, not the input file itself

8 years agofunctorrent.cabal: rename README to README.md
Ramakrishnan Muthukrishnan [Fri, 3 Jul 2015 14:48:24 +0000 (20:18 +0530)]
functorrent.cabal: rename README to README.md

8 years agostack config file
Ramakrishnan Muthukrishnan [Thu, 2 Jul 2015 06:15:49 +0000 (11:45 +0530)]
stack config file

Delete cabal.config, as it is no longer relevant. Use stackage using
stack instead of cabal-install.

8 years agomisc formatting
Ramakrishnan Muthukrishnan [Fri, 29 May 2015 02:02:08 +0000 (07:32 +0530)]
misc formatting

8 years agonew test data file: ubuntu 14.10 i386 release iso
Ramakrishnan Muthukrishnan [Fri, 29 May 2015 02:01:40 +0000 (07:31 +0530)]
new test data file: ubuntu 14.10 i386 release iso

8 years agocreate a dummy file on the disk for a given path
Ramakrishnan Muthukrishnan [Sun, 17 May 2015 07:53:04 +0000 (13:23 +0530)]
create a dummy file on the disk for a given path

8 years agorewrite bitfieldToList
Ramakrishnan Muthukrishnan [Sun, 17 May 2015 07:52:12 +0000 (13:22 +0530)]
rewrite bitfieldToList

8 years agoconvert bitfield from a peer into piece list
Ramakrishnan Muthukrishnan [Sat, 16 May 2015 16:41:22 +0000 (22:11 +0530)]
convert bitfield from a peer into piece list

8 years agoREADME: add a link to the official spec
Ramakrishnan Muthukrishnan [Sat, 16 May 2015 06:46:32 +0000 (12:16 +0530)]
README: add a link to the official spec

8 years agoremove the debug prints
Ramakrishnan Muthukrishnan [Sat, 16 May 2015 06:45:57 +0000 (12:15 +0530)]
remove the debug prints

8 years agoreceive the full handshake msg from peer
Ramakrishnan Muthukrishnan [Thu, 7 May 2015 05:53:17 +0000 (11:23 +0530)]
receive the full handshake msg from peer

8 years agocleanup unused imports/functions
Ramakrishnan Muthukrishnan [Thu, 7 May 2015 05:52:14 +0000 (11:22 +0530)]
cleanup unused imports/functions

Cleanup the debug identifiers/prints.

8 years agomore debugging prints
Ramakrishnan Muthukrishnan [Wed, 6 May 2015 17:58:11 +0000 (23:28 +0530)]
more debugging prints

8 years agoWIP: receive msgs from a connected peer and print them
Ramakrishnan Muthukrishnan [Wed, 6 May 2015 17:33:53 +0000 (23:03 +0530)]
WIP: receive msgs from a connected peer and print them

Something wierd going on. Getting an incorrect length prefix.

8 years agoadd a simple message loop to print out received msgs
Ramakrishnan Muthukrishnan [Wed, 6 May 2015 09:47:19 +0000 (15:17 +0530)]
add a simple message loop to print out received msgs

This is just to study what messages come after the handshake.

8 years agoread bytes off the handle and parse a message
Ramakrishnan Muthukrishnan [Wed, 6 May 2015 08:38:04 +0000 (14:08 +0530)]
read bytes off the handle and parse a message

9 years agoMerge pull request #31 from gitter-badger/gitter-badge
Ramakrishnan Muthukrishnan [Wed, 6 May 2015 05:06:53 +0000 (10:36 +0530)]
Merge pull request #31 from gitter-badger/gitter-badge

Add a Gitter chat badge to README.md

9 years agoREADME: update on the current state
Ramakrishnan Muthukrishnan [Wed, 6 May 2015 05:00:39 +0000 (10:30 +0530)]
README: update on the current state

9 years agorename shadowing identifiers
Ramakrishnan Muthukrishnan [Tue, 5 May 2015 16:54:48 +0000 (22:24 +0530)]
rename shadowing identifiers

9 years agoWIP: deserialize peer messages
Ramakrishnan Muthukrishnan [Tue, 5 May 2015 16:41:13 +0000 (22:11 +0530)]
WIP: deserialize peer messages

serialize/deserialize is implemented as instances of Data.Binary
which allows us to just do get/put.

9 years agoWIP: Peer protocol message marshalling
Ramakrishnan Muthukrishnan [Mon, 4 May 2015 16:59:58 +0000 (22:29 +0530)]
WIP: Peer protocol message marshalling

9 years agoRemove the redundant withSocketsDo call wrapping simpleHTTP
Ramakrishnan Muthukrishnan [Sun, 3 May 2015 09:14:58 +0000 (14:44 +0530)]
Remove the redundant withSocketsDo call wrapping simpleHTTP

simpleHTTP calls withSocketsDo deep inside, so no need to wrap
it outside.

9 years agoremove hardcoded Peer
Ramakrishnan Muthukrishnan [Fri, 1 May 2015 15:38:49 +0000 (21:08 +0530)]
remove hardcoded Peer

Works fine for the Ubuntu torrent file, but not for the Debian
torrent file.

9 years agoPeer constructor also takes the peerid argument now: experimental
Ramakrishnan Muthukrishnan [Fri, 1 May 2015 15:19:17 +0000 (20:49 +0530)]
Peer constructor also takes the peerid argument now: experimental

9 years agoWIP: peer handshake
Ramakrishnan Muthukrishnan [Fri, 1 May 2015 10:20:21 +0000 (15:50 +0530)]
WIP: peer handshake

9 years agowrap network calls with withSocketsDo for multiplatform initialization
Ramakrishnan Muthukrishnan [Thu, 30 Apr 2015 11:29:59 +0000 (16:59 +0530)]
wrap network calls with withSocketsDo for multiplatform initialization

9 years agoWIP: FuncTorrent as a nix package
Ramakrishnan Muthukrishnan [Wed, 29 Apr 2015 00:08:07 +0000 (05:38 +0530)]
WIP: FuncTorrent as a nix package

9 years agoadd quickcheck as a test dependency
Ramakrishnan Muthukrishnan [Sun, 26 Apr 2015 01:49:40 +0000 (07:19 +0530)]
add quickcheck as a test dependency

9 years agoAdded Gitter badge
The Gitter Badger [Tue, 28 Apr 2015 11:10:32 +0000 (11:10 +0000)]
Added Gitter badge

9 years agoRevert "travis.yml: install "happy" which is a dependency for haskell-src-exts"
Ramakrishnan Muthukrishnan [Tue, 28 Apr 2015 07:52:46 +0000 (13:22 +0530)]
Revert "travis.yml: install "happy" which is a dependency for haskell-src-exts"

This reverts commit 5d631c39efab1fdcae829f8048be1925ccaefc39. This commit is not
required anymore, since hlint test is removed and so haskell-src-exts is not
needed.