comparison src/fetch.c @ 120:05f50c1761d9 noffle

[svn] Applied patch from Matija Nalis: Counters for monitoring --fetch progress.
author enz
date Wed, 19 Jul 2000 08:02:45 +0100
parents 38b0a1532a37
children 3c71e28c8eef
comparison
equal deleted inserted replaced
119:f50cc311e29a 120:05f50c1761d9
1 /* 1 /*
2 fetch.c 2 fetch.c
3 3
4 $Id: fetch.c 135 2000-06-05 08:57:05Z bears $ 4 $Id: fetch.c 174 2000-07-19 07:02:45Z enz $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
151 Fetch_getReq_( void ) 151 Fetch_getReq_( void )
152 { 152 {
153 Str msgId; 153 Str msgId;
154 DynStr *list; 154 DynStr *list;
155 const char *p; 155 const char *p;
156 int count = 0; 156 int count = 0, artcnt = 0, artmax = 0;
157 157
158 ASSERT( fetch.ready ); 158 ASSERT( fetch.ready );
159 Log_dbg( "Retrieving articles marked for download" ); 159 Log_dbg( "Retrieving articles marked for download" );
160 list = new_DynStr( 10000 ); 160 list = new_DynStr( 10000 );
161 if ( Req_first( fetch.serv, msgId ) ) do { artmax++; } while ( Req_next( msgId ) );
162 Log_inf( "%d TOTAL messages to download", artmax);
161 if ( Req_first( fetch.serv, msgId ) ) 163 if ( Req_first( fetch.serv, msgId ) )
162 do 164 do
163 { 165 {
164 DynStr_appLn( list, msgId ); 166 DynStr_appLn( list, msgId );
165 if ( ++count % 20 == 0 ) /* Send max. 20 ARTICLE cmds at once */ 167 if ( ++count % 20 == 0 ) /* Send max. 20 ARTICLE cmds at once */
166 { 168 {
167 p = DynStr_str( list ); 169 p = DynStr_str( list );
168 Client_retrieveArtList( p ); 170 Client_retrieveArtList( p, &artcnt, artmax );
169 while ( ( p = Utl_getLn( msgId, p ) ) ) 171 while ( ( p = Utl_getLn( msgId, p ) ) )
170 Req_remove( fetch.serv, msgId ); 172 Req_remove( fetch.serv, msgId );
171 DynStr_clear( list ); 173 DynStr_clear( list );
172 } 174 }
173 } 175 }
174 while ( Req_next( msgId ) ); 176 while ( Req_next( msgId ) );
175 p = DynStr_str( list ); 177 p = DynStr_str( list );
176 Client_retrieveArtList( p ); 178 Client_retrieveArtList( p, &artcnt, artmax );
177 while ( ( p = Utl_getLn( msgId, p ) ) ) 179 while ( ( p = Utl_getLn( msgId, p ) ) )
178 Req_remove( fetch.serv, msgId ); 180 Req_remove( fetch.serv, msgId );
179 del_DynStr( list ); 181 del_DynStr( list );
180 } 182 }
181 183