counters for monitoring --fetch progress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Since it appears that nobody is watching patch manager over at sourceforge
(http://sourceforge.net/patch/?group_id=1044), let's try mailing list next
:-)

Attached diff shows which message (and of how many) are we downloading.
So instead of 

Retrieving <blah@bloh.bleh>
Retrieving <hoh@he.ho>
we have
[122/476] Retrieving <blah@bloh.bleh>
[123/476] Retrieving <hoh@he.ho>

etc.
So user have SOME feedback where are we and how long it is going to take to
finish --fetch.

-- 
Opinions above are GNU-copylefted.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/noffle/noffle/ChangeLog,v
retrieving revision 1.30
diff -u -w -r1.30 ChangeLog
--- ChangeLog	2000/06/30 07:09:53	1.30
+++ ChangeLog	2000/07/14 01:23:13
@@ -2,6 +2,11 @@
 NOFFLE ChangeLog
 -------------------------------------------------------------------------------
 
+Fri Jul 14 2000 Matija Nalis <mnalis-sf@voyager.hr>
+
+ * Added counter for --fetch so one can see how much it is until the
+   end of the transfer.
+
 Fri Jun 30 2000 Markus Enzenberger <markus.enzenberger@t-online.de>
 
   * src/server.c: Leave online mode, if the connection to a remote server
Index: src/client.c
===================================================================
RCS file: /cvsroot/noffle/noffle/src/client.c,v
retrieving revision 1.14
diff -u -w -r1.14 client.c
--- src/client.c	2000/06/24 20:29:52	1.14
+++ src/client.c	2000/07/14 01:23:14
@@ -957,13 +957,13 @@
 }
 
 static Bool
-retrieveAndStoreArt( const char *msgId )
+retrieveAndStoreArt( const char *msgId, int artcnt, int artmax )
 {
     Bool err;
     DynStr *s = NULL;
     Str line;
 
-    Log_inf( "Retrieving %s", msgId );
+    Log_inf( "[%d/%d] Retrieving %s", artcnt, artmax, msgId );
     s = new_DynStr( 5000 );
     while ( getTxtLn( line, &err ) && ! err )
         DynStr_appLn( s, line );
@@ -1015,11 +1015,11 @@
     else if ( getStat() != STAT_ART_FOLLOWS )
         retrievingFailed( msgId, client.lastStat );
     else
-        retrieveAndStoreArt( msgId );
+        retrieveAndStoreArt( msgId, 0, 0 );
 }
 
 void
-Client_retrieveArtList( const char *list )
+Client_retrieveArtList( const char *list, int *artcnt, int artmax )
 {
     Str msgId;
     DynStr *s;
@@ -1049,7 +1049,7 @@
     {
         if ( getStat() != STAT_ART_FOLLOWS )
             retrievingFailed( msgId, client.lastStat );
-        else if ( ! retrieveAndStoreArt( msgId ) )
+        else if ( ! retrieveAndStoreArt( msgId, ++(*artcnt), artmax ) )
             break;
     }
     del_DynStr( s );
Index: src/client.h
===================================================================
RCS file: /cvsroot/noffle/noffle/src/client.h,v
retrieving revision 1.3
diff -u -w -r1.3 client.h
--- src/client.h	2000/05/09 22:28:37	1.3
+++ src/client.h	2000/07/14 01:23:14
@@ -73,7 +73,7 @@
   All ARTICLE commands are sent and then all answers read.
 */
 void
-Client_retrieveArtList( const char *list );
+Client_retrieveArtList( const char *list, int *artcnt, int artmax );
 
 /*
   Store IDs of first and last article of group selected by
Index: src/fetch.c
===================================================================
RCS file: /cvsroot/noffle/noffle/src/fetch.c,v
retrieving revision 1.5
diff -u -w -r1.5 fetch.c
--- src/fetch.c	2000/06/05 08:57:05	1.5
+++ src/fetch.c	2000/07/14 01:23:14
@@ -153,11 +153,13 @@
     Str msgId;
     DynStr *list;
     const char *p;
-    int count = 0;
+    int count = 0, artcnt = 0, artmax = 0;
 
     ASSERT( fetch.ready );
     Log_dbg( "Retrieving articles marked for download" );
     list = new_DynStr( 10000 );
+    if ( Req_first( fetch.serv, msgId ) ) do { artmax++; } while ( Req_next( msgId ) );
+    Log_inf( "%d TOTAL messages to download", artmax);
     if ( Req_first( fetch.serv, msgId ) )
         do
         {
@@ -165,7 +167,7 @@
             if ( ++count % 20 == 0 ) /* Send max. 20 ARTICLE cmds at once */
             {
                 p = DynStr_str( list );
-                Client_retrieveArtList( p );
+                Client_retrieveArtList( p, &artcnt, artmax );
                 while ( ( p = Utl_getLn( msgId, p ) ) )
                     Req_remove( fetch.serv, msgId );
                 DynStr_clear( list );
@@ -173,7 +175,7 @@
         }
         while ( Req_next( msgId ) );
     p = DynStr_str( list );
-    Client_retrieveArtList( p );
+    Client_retrieveArtList( p, &artcnt, artmax );
     while ( ( p = Utl_getLn( msgId, p ) ) )
         Req_remove( fetch.serv, msgId );
     del_DynStr( list );

[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux