Ramakrishnan Muthukrishnan [Sun, 28 Feb 2016 12:02:05 +0000 (17:32 +0530)]
Tracker: add UDP tracker error response parsing
Ramakrishnan Muthukrishnan [Sat, 27 Feb 2016 11:57:42 +0000 (17:27 +0530)]
Peer: catchall case statement to catch any invalid msgs
Ramakrishnan Muthukrishnan [Sat, 27 Feb 2016 09:33:53 +0000 (15:03 +0530)]
HaveMsg: minor debug print
Ramakrishnan Muthukrishnan [Sat, 27 Feb 2016 09:27:35 +0000 (14:57 +0530)]
Peer.hs: handle HaveMsg
Ramakrishnan Muthukrishnan [Fri, 19 Feb 2016 05:24:17 +0000 (10:54 +0530)]
stack.yaml: bump up the lts version
Ramakrishnan Muthukrishnan [Tue, 15 Dec 2015 17:31:41 +0000 (23:01 +0530)]
Tracker: remove redundant import
Ramakrishnan Muthukrishnan [Tue, 15 Dec 2015 17:31:21 +0000 (23:01 +0530)]
main: remove redundant import
Ramakrishnan Muthukrishnan [Tue, 15 Dec 2015 17:30:56 +0000 (23:00 +0530)]
FileSystem: bug fix, run should run for ever
Ramakrishnan Muthukrishnan [Tue, 15 Dec 2015 17:18:23 +0000 (22:48 +0530)]
FileSystem: typo updateState -> updateStats
Ramakrishnan Muthukrishnan [Tue, 15 Dec 2015 16:55:49 +0000 (22:25 +0530)]
FileSystem: add read/write stats
Ramakrishnan Muthukrishnan [Fri, 11 Dec 2015 16:48:39 +0000 (22:18 +0530)]
main: kill FS thread on exit (revisit)
Ramakrishnan Muthukrishnan [Fri, 11 Dec 2015 15:49:59 +0000 (21:19 +0530)]
FileSystem: do not expose msgs outside the module, instead expose helper fns
Ramakrishnan Muthukrishnan [Thu, 10 Dec 2015 13:23:21 +0000 (18:53 +0530)]
FileSystem: encapsulate more filesystem functionality into the module
Ramakrishnan Muthukrishnan [Wed, 9 Dec 2015 06:21:53 +0000 (11:51 +0530)]
new modules FileSystem and PieceManager
FileSystem module abstracts the filesystem operations for the download
and upload via a message channel that peers can send messages to.
Ramakrishnan Muthukrishnan [Sun, 6 Dec 2015 09:09:42 +0000 (14:39 +0530)]
rename tracker response function, Utils, catch exceptions.
Ramakrishnan Muthukrishnan [Mon, 5 Oct 2015 01:36:00 +0000 (07:06 +0530)]
Tracker: identify tracker protocol from the tracker server url
Ramakrishnan Muthukrishnan [Sun, 4 Oct 2015 15:59:54 +0000 (21:29 +0530)]
WIP: UDP tracker: send/receive request/response
Ramakrishnan Muthukrishnan [Sun, 4 Oct 2015 09:59:10 +0000 (15:29 +0530)]
WIP: udp tracker: get the peer ip, port pairs
Ramakrishnan Muthukrishnan [Sun, 4 Oct 2015 06:27:03 +0000 (11:57 +0530)]
WIP: UDP Tracker support
Add binary packet creation/parsing of the UDP request and response
packets.
Ramakrishnan Muthukrishnan [Sat, 3 Oct 2015 04:21:45 +0000 (09:51 +0530)]
Tracker: remove vestiges of the older code and module imports
Ramakrishnan Muthukrishnan [Fri, 2 Oct 2015 10:57:57 +0000 (16:27 +0530)]
Peer: rename identifiers that are shadowing already defined identifiers
Ramakrishnan Muthukrishnan [Fri, 2 Oct 2015 09:15:08 +0000 (14:45 +0530)]
Network.httpget -> Network.sendGetRequest
Ramakrishnan Muthukrishnan [Fri, 2 Oct 2015 09:03:59 +0000 (14:33 +0530)]
Tracker is a separate thread now
Ramakrishnan Muthukrishnan [Fri, 2 Oct 2015 09:03:08 +0000 (14:33 +0530)]
remove an unused type
Ramakrishnan Muthukrishnan [Tue, 29 Sep 2015 13:50:41 +0000 (19:20 +0530)]
Nuke the gitter.im link, Nix insructions etc
Ramakrishnan Muthukrishnan [Mon, 21 Sep 2015 09:07:57 +0000 (10:07 +0100)]
version 0.2.0
I am declaring victory and bumping up the version. The client has
come a long way, though it is far from being anywhere 'functional'.
Ramakrishnan Muthukrishnan [Fri, 18 Sep 2015 13:10:41 +0000 (18:40 +0530)]
fix hlint suggestions
Ramakrishnan Muthukrishnan [Fri, 18 Sep 2015 07:04:52 +0000 (12:34 +0530)]
handle Choke, interested, notinterested, cancel and port msgs
Ramakrishnan Muthukrishnan [Fri, 18 Sep 2015 06:32:42 +0000 (12:02 +0530)]
refactor doHandshake to use pattern matching
Ramakrishnan Muthukrishnan [Fri, 18 Sep 2015 02:58:51 +0000 (08:28 +0530)]
handshake for server and client
Earlier implementation used a wrong handhake sequence for the server.
This commit fixes it. It is untested at the moment.
Ramakrishnan Muthukrishnan [Thu, 17 Sep 2015 22:10:10 +0000 (03:40 +0530)]
refactoring: move verifyHash to Utils module
Ramakrishnan Muthukrishnan [Thu, 17 Sep 2015 22:04:12 +0000 (03:34 +0530)]
refactor the piecemap initialization
Move parts of the download resume code into Main, since it avoids
duplication of some code and makes the flow, a lot more easy to
understand.
Ramakrishnan Muthukrishnan [Wed, 16 Sep 2015 16:00:21 +0000 (21:30 +0530)]
README: misc indents
Ramakrishnan Muthukrishnan [Wed, 16 Sep 2015 15:59:23 +0000 (21:29 +0530)]
Fileops merged into Utils module
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.
Ramakrishnan Muthukrishnan [Tue, 15 Sep 2015 12:07:44 +0000 (17:37 +0530)]
refactor mkPieceMap -> initPieceMap
Ramakrishnan Muthukrishnan [Mon, 14 Sep 2015 01:14:05 +0000 (06:44 +0530)]
Use the server port number in the tracker request
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 16:52:17 +0000 (22:22 +0530)]
a crude server implementation
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 14:48:07 +0000 (20:18 +0530)]
Main: generate random peerid
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 14:47:48 +0000 (20:17 +0530)]
remove the use of ReaderT
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 08:44:16 +0000 (14:14 +0530)]
fix hlint suggestions
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 07:16:07 +0000 (12:46 +0530)]
tasty and hunit dependencies are not lib dependencies
Ramakrishnan Muthukrishnan [Sun, 13 Sep 2015 07:15:35 +0000 (12:45 +0530)]
wip: Use reader to pass around metainfo
Ramakrishnan Muthukrishnan [Sat, 12 Sep 2015 17:54:28 +0000 (23:24 +0530)]
preparations to introduce Metainfo as an environment
Ramakrishnan Muthukrishnan [Fri, 11 Sep 2015 08:03:11 +0000 (13:33 +0530)]
functorrent.cabal: avoid double compilation, one for lib, another for exe
Ramakrishnan Muthukrishnan [Tue, 8 Sep 2015 11:17:54 +0000 (16:47 +0530)]
README: indent usage examples
Ramakrishnan Muthukrishnan [Tue, 8 Sep 2015 11:17:35 +0000 (16:47 +0530)]
Peer: cosmetic indentation fixes
Ramakrishnan Muthukrishnan [Fri, 4 Sep 2015 06:38:58 +0000 (12:08 +0530)]
remove a few reduntant stuff
Ramakrishnan Muthukrishnan [Sat, 5 Sep 2015 17:23:01 +0000 (22:53 +0530)]
Peer: export bytesDownloaded function
Ramakrishnan Muthukrishnan [Sat, 5 Sep 2015 17:11:47 +0000 (22:41 +0530)]
Peer: function to calculate the total bytes downloaded so far
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.
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.
Ramakrishnan Muthukrishnan [Thu, 3 Sep 2015 13:07:18 +0000 (18:37 +0530)]
peer: more refactoring. Supports all messages as before
Ramakrishnan Muthukrishnan [Thu, 3 Sep 2015 12:34:11 +0000 (18:04 +0530)]
Peer: more refactoring
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.
Ramakrishnan Muthukrishnan [Thu, 3 Sep 2015 11:02:11 +0000 (16:32 +0530)]
add mtl, organize packages alphabetically
Ramakrishnan Muthukrishnan [Sun, 30 Aug 2015 12:34:54 +0000 (18:04 +0530)]
remove redundant module imports for ghc 7.10
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
Ramakrishnan Muthukrishnan [Mon, 17 Aug 2015 16:37:21 +0000 (22:07 +0530)]
bit torrent -> BitTorrent
Ramakrishnan Muthukrishnan [Sat, 15 Aug 2015 08:27:44 +0000 (13:57 +0530)]
Not using travis-ci anymore
Ramakrishnan Muthukrishnan [Mon, 3 Aug 2015 14:38:03 +0000 (20:08 +0530)]
misc formatting
Ramakrishnan Muthukrishnan [Mon, 3 Aug 2015 14:37:34 +0000 (20:07 +0530)]
Now that functorrent is becoming useful, README should be more clear
Ramakrishnan Muthukrishnan [Sun, 2 Aug 2015 15:27:28 +0000 (20:57 +0530)]
write to the file name specified in the info structure
Ramakrishnan Muthukrishnan [Sun, 2 Aug 2015 14:47:19 +0000 (20:17 +0530)]
refactor Peer module
Ramakrishnan Muthukrishnan [Mon, 27 Jul 2015 14:41:00 +0000 (20:11 +0530)]
refactor msgloop a bit
Ramakrishnan Muthukrishnan [Mon, 27 Jul 2015 14:28:53 +0000 (19:58 +0530)]
peer is needed only for debug print
Ramakrishnan Muthukrishnan [Mon, 27 Jul 2015 13:27:44 +0000 (18:57 +0530)]
refactor handshake msg
Ramakrishnan Muthukrishnan [Sun, 26 Jul 2015 06:38:53 +0000 (12:08 +0530)]
refactor file operations into Fileops module
Ramakrishnan Muthukrishnan [Sat, 25 Jul 2015 06:42:03 +0000 (12:12 +0530)]
bugfix: calculate proper file offset
Ramakrishnan Muthukrishnan [Sat, 25 Jul 2015 06:40:09 +0000 (12:10 +0530)]
hlint caught some ugly code
Ramakrishnan Muthukrishnan [Sat, 25 Jul 2015 03:02:24 +0000 (08:32 +0530)]
add a warning in the README
Ramakrishnan Muthukrishnan [Sat, 25 Jul 2015 02:32:03 +0000 (08:02 +0530)]
README: update the current status. ☺
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
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 18:54:24 +0000 (00:24 +0530)]
turn on hash verification of every downloaded piece
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).
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
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 15:43:10 +0000 (21:13 +0530)]
verify SHA1 hash of each piece after assembling the blocks
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.
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 14:19:32 +0000 (19:49 +0530)]
return a list of bytestring blocks corresponding to the piece index
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 14:08:54 +0000 (19:38 +0530)]
Peer: debug prints
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 13:32:32 +0000 (19:02 +0530)]
get rid of (some of) the compiler warnings
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.
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 11:04:53 +0000 (16:34 +0530)]
fix the comments
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.
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 09:23:05 +0000 (14:53 +0530)]
send request msg and get the piecemsg back
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 08:36:18 +0000 (14:06 +0530)]
pickPiece: a simple algorithm to download the pieces in order
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
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 07:11:03 +0000 (12:41 +0530)]
update piece availability list based on the bitmap
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 06:17:38 +0000 (11:47 +0530)]
msgLoop: more refactoring, better debug prints
Ramakrishnan Muthukrishnan [Fri, 24 Jul 2015 04:42:39 +0000 (10:12 +0530)]
more refactoring around msgLoop
Ramakrishnan Muthukrishnan [Thu, 23 Jul 2015 08:42:06 +0000 (14:12 +0530)]
refactor PeerState: Add connection handle to be part of peerstate
Ramakrishnan Muthukrishnan [Tue, 21 Jul 2015 06:21:33 +0000 (11:51 +0530)]
sendMsg: equiv of getMsg but on the sending side
Ramakrishnan Muthukrishnan [Mon, 20 Jul 2015 16:31:32 +0000 (22:01 +0530)]
thread peerstate along msgloop
msgLoop needs a major rethink.
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 10:17:49 +0000 (15:47 +0530)]
gitignore .stack-work directory
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.
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.
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 08:47:50 +0000 (14:17 +0530)]
keep hlint happy
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 06:33:23 +0000 (12:03 +0530)]
helper function: havePiece
Ramakrishnan Muthukrishnan [Sun, 19 Jul 2015 06:16:25 +0000 (11:46 +0530)]
add piece hash into the pieceMap
Ramakrishnan Muthukrishnan [Fri, 17 Jul 2015 14:10:25 +0000 (19:40 +0530)]
new type synonym for a Piece Map