🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #83684

Re: [INN] pullnews byte count

#83684
From: Julien ÉLIE
Date: Wed, 17 Nov 2010 19:29
81 lines
4222 bytes
Hi Edmund,

>> Here is a patch:
>> [...]
>
>   thanks, your patch works

Unless you're using rnews, in which case the new byte count might be
wrong...  We should keep length($article->[$idx]) at this place, so
that $tx_len is correctly updated.

+  # Do not use $line_len here because $article->[$idx] has been modified
+  # since the length was computed.
   $tx_len -= length($article->[$idx]) - 1;
   $article->[$idx] = "\n";



>   E.g. the flag '-k 50' gets only honoured when there are >50
> articles in one group. If all groups have <50 articles respectively,
> the config file is only updated after all groups have been pulled,
> i.e. when pullnews terminates.

You're right.  This patch should do the trick.
I also renamed the global $count variable because I do not like much
two variables named the same way (one global and another one local).


--- pullnews.in (révision 9149)
+++ pullnews.in (copie de travail)
@@ -302,14 +302,14 @@

 open(FILE, "<$groupFile") || die "can't open group file $groupFile\n";

-my $count = 0;
+my $array_order = 0;
 while (<FILE>) {
     next if m!^\s*\#! || m!^\s*$!;

     if (m!^(\S+)(\s+(\S+)\s+(\S+))?\s*$!) {
         $sname = $1;
         $servers->{$sname} = {};
-        $servers->{$sname}->{_order} = $count++;
+        $servers->{$sname}->{_order} = $array_order++;
         $passwd{$sname} = [ $3, $4 ] if defined $3 and $3 ne "";
     } elsif (m!^\s+(\S+)\s+(\d+)\s+(\d+)!) {
         my ($group,$date,$high) = ($1,$2,$3);
@@ -330,6 +330,7 @@
 die "No servers!\n" if ! @servers;

 my $localcxn;
+my $art_total_count = 0;    # The number of articles transferred during the 
session.

 if ( not $rnews ) {
     print LOG "Connecting to downstream host: $localServer " .
@@ -621,6 +622,7 @@
         last if defined $maxArts and $count >= $maxArts;
         last if defined $opt_f and $count >= $toget;
         $count++;
+        $art_total_count++;
         sleep $opt_z if defined $opt_z and $count > 1;
         # "Optimized mode" -- check if the article is wanted *before* downloading 
it.
         if (defined $opt_O) {
@@ -868,7 +870,7 @@
             printf LOG ("\nDEBUGGING $i %s %s\n", $fromServer->code(),
                         $fromServer->message()) if $debug >= 2;
         }
-        saveConfig() if $checkPoint and ($count % $checkPoint) == 0;
+        saveConfig() if $checkPoint and ($art_total_count % $checkPoint) == 0;
         print LOG "\n" if (!$quiet && (($count % $progressWidth) == 0));
         last if defined $opt_S and time >= $^T+$opt_S;
     }


-- 
Julien ÉLIE

« Ira furor breuis est. » (Horace) 
Technical Details
Message-ID: <ic1af4$irk$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.news-service.com!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!gegeweb.org!news.trigofacile.com!.POSTED.aaubervilliers-151-1-51-137.w83-114.abo.wanadoo.fr!not-for-mail
References: <ibuccd$8n5$1@dk3uz.ampr.org> <ibun7q$kt2$1@news.trigofacile.com> <ibv7h5$gv8$1@dk3uz.ampr.org>

Show Full Headers
Complete Article Headers
Message-ID: <ic1af4$irk$1@news.trigofacile.com>
Subject: Re: [INN] pullnews byte count
Date: Wed, 17 Nov 2010 20:29:39 +0100
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <ibuccd$8n5$1@dk3uz.ampr.org> <ibun7q$kt2$1@news.trigofacile.com> <ibv7h5$gv8$1@dk3uz.ampr.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.news-service.com!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!gegeweb.org!news.trigofacile.com!.POSTED.aaubervilliers-151-1-51-137.w83-114.abo.wanadoo.fr!not-for-mail
Newsgroups: news.software.nntp
Organization: TrigoFACILE -- http://www.trigofacile.com/
Lines: 81
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset="Windows-1252";
 reply-type=original
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 17 Nov 2010 19:29:40 +0000 (UTC)
Injection-Info: news.trigofacile.com;
 posting-host="aaubervilliers-151-1-51-137.w83-114.abo.wanadoo.fr:83.114.129.137";
 logging-data="19316"; mail-complaints-to="abuse@trigofacile.com"
In-Reply-To: <ibv7h5$gv8$1@dk3uz.ampr.org>
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6002.18197
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18263
X-Original-Bytes: 3976