🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #83741

Re: [INN] pullnews byte count

#83741
From: Julien ÉLIE
Date: Tue, 16 Nov 2010 19:49
98 lines
4768 bytes
Hi Edmund,

>   After having pulled all articles of a group pullnews prints,
> among other statistics, a byte count. This byte count only
> represents the number of bytes downloaded for said group after the
> first group, because it is the cumulative (and global)
> $info{server}->{$server}->{bytes} instead of the local $len.

"44 articles retrieved in 3 seconds (103412 bytes, 34470 cps)"


> Feature or bug?

It's a bug.  Thanks for having reported it!


Here is a patch:


Index: pullnews.in
===================================================================
--- pullnews.in (révision 9135)
+++ pullnews.in (copie de travail)
@@ -565,6 +570,7 @@
     my ($prevDate,$prevHigh) = @{$shash->{$group}};
     my ($narticles,$first,$last,$name) = $fromServer->group($group);
     my $count = 0;
+    my $len = 0;                 # Received article length (bytes) (for stats).
     my $code;
     my $startTime = time;
     my ($prevRefused, $prevRejected) = ($info{refused}, $info{rejected});
@@ -649,7 +655,7 @@
             my $xref = 0;
             my $headers = 1;
             my $idx;
-            my $len = 0;                 # Received article length (bytes) (for 
stats).
+            my $line_len = 0;
             my $tx_len = 0;              # Transmitted article length (bytes) (for 
rnews).
             my @header_nums_to_go = ();
             my $match_all_hdrs = 1;      # Assume no headers to match.
@@ -658,8 +664,12 @@
             my $curr_hdr = '';

             for ($idx = 0 ; $idx < @{$article} ; $idx++) {
-                $len += length($article->[$idx]);
-                $tx_len += length($article->[$idx]);
+                $line_len = length($article->[$idx]);
+                $len += $line_len;
+                $tx_len += $line_len;
+                $info{server}->{$server}->{bytes} += $line_len;
+                $info{bytes} += $line_len;
+
                 next if not $headers;

                 $curr_hdr = lc($1) if $article->[$idx] =~ /^([^:[:blank:]]+):/;
@@ -730,7 +740,7 @@
                     print STDERR "Fixing bad header line[$idx]-1: 
$article->[$idx-1]" if $idx > 0;
                     print STDERR "Fixing bad header line[$idx]::: 
$article->[$idx]";
                     print STDERR "Fixing bad header line[$idx]+1: 
$article->[$idx+1]";
-                    $tx_len -= length($article->[$idx])-1;
+                    $tx_len -= $line_len - 1;
                     $article->[$idx] = "\n";
                 }

@@ -770,8 +780,6 @@
             }

             $pulled->{$server}->{$group}++;
-            $info{server}->{$server}->{bytes} += $len;
-            $info{bytes} += $len;

             if ($skip_due_to_hdrs) {
                 print LOG "m" unless $quiet;
@@ -880,8 +888,7 @@
     } else {
         printf LOG "%s article%s retrieved in %d seconds (%d bytes, %d cps)\n",
                 $count, ($count == 1 ? "" : "s"), $elapsed_time,
-                $info{server}->{$server}->{bytes},
-                int($info{server}->{$server}->{bytes}*100/$elapsed_time)/100;
+                $len, int($len*100/$elapsed_time)/100;
     }
     return 1;
 }





-- 
Julien ÉLIE

« Sol lucet omnibus. » 
Technical Details
Message-ID: <ibun7q$kt2$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.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!weretis.net!feeder4.news.weretis.net!news.trigofacile.com!.POSTED.aaubervilliers-151-1-51-137.w83-114.abo.wanadoo.fr!not-for-mail
References: <ibuccd$8n5$1@dk3uz.ampr.org>

Show Full Headers
Complete Article Headers
Message-ID: <ibun7q$kt2$1@news.trigofacile.com>
Subject: Re: [INN] pullnews byte count
Date: Tue, 16 Nov 2010 20:49:17 +0100
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <ibuccd$8n5$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.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!weretis.net!feeder4.news.weretis.net!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: 98
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset="Windows-1252";
 reply-type=original
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 16 Nov 2010 19:49:14 +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="21410"; mail-complaints-to="abuse@trigofacile.com"
In-Reply-To: <ibuccd$8n5$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: 4582