r317 - in /apt-transport-debtorrent/trunk: debtorrent.cc debtorrent.h

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Mon Nov 5 07:34:10 UTC 2007


Author: camrdale-guest
Date: Mon Nov  5 07:34:10 2007
New Revision: 317

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=317
Log:
Fix some errors in the last 2 commits (sparse files still not working).

Modified:
    apt-transport-debtorrent/trunk/debtorrent.cc
    apt-transport-debtorrent/trunk/debtorrent.h

Modified: apt-transport-debtorrent/trunk/debtorrent.cc
URL: http://svn.debian.org/wsvn/debtorrent/apt-transport-debtorrent/trunk/debtorrent.cc?rev=317&op=diff
==============================================================================
--- apt-transport-debtorrent/trunk/debtorrent.cc (original)
+++ apt-transport-debtorrent/trunk/debtorrent.cc Mon Nov  5 07:34:10 2007
@@ -537,7 +537,7 @@
       if (sscanf(Val.c_str(),"bytes %lu/%lu",&StartPos,&Size) != 2)
 	 return _error->Error("The DebTorrent client sent an invalid Piece-Downloaded header");
       if ((unsigned)StartPos > Size)
-	 return _error->Error("This DebTorrent client has broken Piece-Downloaded support"); */
+	 return _error->Error("This DebTorrent client has broken Piece-Downloaded support");
       return true;
    }
    
@@ -655,7 +655,7 @@
       Req += string("Authorization: Basic ") + 
           Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n";
    
-   Req += "User-Agent: Debian APT-DEBTORRENT/0.1 ("VERSION")\r\n\r\n";
+   Req += "User-Agent: Debian APT-DEBTORRENT/0.2 ("VERSION")\r\n\r\n";
    
    if (Debug == true)
       cerr << Req << endl;
@@ -982,16 +982,26 @@
    }
 
    // Get the old size of the file
+   /*
    unsigned long OldSize = File->Size();
    if (_error->PendingError() == true)
    {
       delete File;
       File = 0;
       return false;
-   }
+   } */
 
    // Set the file to the new length
    File->Truncate(Res.ResumePoint);
+   if (_error->PendingError() == true)
+   {
+      delete File;
+      File = 0;
+      return false;
+   }
+
+   // Sync the file to disk and close it
+   File->Sync();
    delete File;
    File = 0;
    if (_error->PendingError() == true)

Modified: apt-transport-debtorrent/trunk/debtorrent.h
URL: http://svn.debian.org/wsvn/debtorrent/apt-transport-debtorrent/trunk/debtorrent.h?rev=317&op=diff
==============================================================================
--- apt-transport-debtorrent/trunk/debtorrent.h (original)
+++ apt-transport-debtorrent/trunk/debtorrent.h Mon Nov  5 07:34:10 2007
@@ -12,7 +12,7 @@
 #define APT_DEBTORRENT_H
 
 #define MAXLEN 360
-#define VERSION "0.1"
+#define VERSION "0.2"
 
 #include <iostream>
 
@@ -136,6 +136,7 @@
    bool ServerDie(ServerState *Srv);
    bool RearrangeQueue(ServerState *Srv);
    int DealWithHeaders(FetchResult &Res,ServerState *Srv);
+   bool UpdateFileSize(FetchResult &Res);
 
    virtual bool Fetch(FetchItem *);
    virtual bool Configuration(string Message);




More information about the Debtorrent-commits mailing list