]> git.rkrishnan.org Git - functorrent.git/blobdiff - src/main/Main.hs
Resume download from where it was left off last time
[functorrent.git] / src / main / Main.hs
index 0a514104703485beda12b9206226fe44acbb6bc5..ae3c0354e76a7b714db629388211551bd091600f 100644 (file)
@@ -57,9 +57,13 @@ main = do
     case torrentToMetainfo torrentStr of
      Left e -> logError e log
      Right m -> do
-       log "Input File OK"
-       log $ "Downloading file : " ++ name (info m)
-
+       let p = name (info m)
+       log $ "Downloading file : " ++ p
+       -- if we had downloaded the file before (partly or completely)
+       -- then we should check the current directory for the existence
+       -- of the file and then update the map of each piece' availability.
+       -- This can be donw by reading each piece and verifying the checksum.
+       -- If the checksum does not match, we don't have that piece.
        log $ "starting server"
        (serverSock, (PortNumber portnum)) <- Server.start
        log $ "server started on " ++ show portnum