🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #48337

Re: slrnpull slow when reading a newsgroup first time

#48337
From: John E. Davis
Date: Mon, 03 May 1999 00:00
133 lines
4648 bytes
On Mon, 03 May 1999 09:10:43 GMT, Byrial Jensen <bjensen@nospam.dk>
wrote:
>I suggest that slrnpull is changed so that it will never request
>more Message-IDs from the server than the maximal number of
>articles to retrieve in the current newsgoup. Thank you.

Try the following patch to slrnpull.c.  This patch also includes the
--logfile feature:

--- ../../release/slrn/src/slrnpull.c	Sun Apr 25 16:41:46 1999
+++ slrnpull.c	Mon May  3 13:01:00 1999
@@ -785,7 +785,8 @@
 
 static unsigned int Num_Duplicates;
 
-static int *list_server_numbers (NNTP_Type *s, Active_Group_Type *g, unsigned int *nump) /*{{{*/
+static int *list_server_numbers (NNTP_Type *s, Active_Group_Type *g, 
+				 int server_max, unsigned int *nump) /*{{{*/
 {
    char *name; 
    unsigned int min, max;
@@ -803,18 +804,20 @@
    /* Server has XHDR.  Good. */
    min = g->min;
    max = g->max + 1;
-#if 0   
-   if (max >= min)
-     max++;
-#else
    if (max < min) max = min;
-#endif
 
-   status = nntp_server_vcmd (s, "XHDR Message-Id %d-", max);
+   /* If this is the first time this group has been visited, then do not grab
+    * all the message-ids when the user specifies a limit to grab.
+    */
+   if ((max <= 1) && (g->max_to_get != 0)
+       && ((unsigned int) server_max > g->max_to_get))
+     max = (unsigned int) server_max - g->max_to_get;
+
+   status = nntp_server_vcmd (s, "XHDR Message-Id %u-", max);
    if (status == -1)
      return NULL;			       /* server closed? */
    
-   if (status == 224) status = OK_HEAD;/* Micro$soft broken server */
+   if (status == 224) status = OK_HEAD;/* Micro$oft broken server */
    if (status != OK_HEAD)
      {
 	log_error ("Server failed XHDR command: %s", s->rspbuf);
@@ -1302,7 +1305,7 @@
      }
 
    Num_Duplicates = 0;
-   numbers = list_server_numbers (s, g, &num_numbers);
+   numbers = list_server_numbers (s, g, server_max, &num_numbers);
    if (Num_Duplicates)
      log_message ("%u duplicates removed leaving %u/%u.", 
 		  Num_Duplicates, num_numbers, num_numbers + Num_Duplicates);
@@ -1695,16 +1698,16 @@
 
 static void init_signals (void);
 
-static void open_log_files (void) /*{{{*/
+static void open_log_files (char *logfile) /*{{{*/
 {
    char file [SLRN_MAX_PATH_LEN + 1];
    
    ELog_Fp = stderr;
    MLog_Fp = stdout;
    
-   if (-1 == slrn_dircat (SlrnPull_Dir, SLRNPULL_LOGFILE, file))
+   if (-1 == slrn_dircat (SlrnPull_Dir, logfile, file))
      return;
-   
+
    MLog_Fp = fopen (file, "a");
    if (MLog_Fp == NULL)
      {
@@ -1743,6 +1746,7 @@
   --no-post         Do not post news\n\
   --new-groups      Get new groups\n\
   --version         Show version number\n\
+  --logfile FILE    Use FILE as the log file\n\
 ",
 	      pgm, pgm);
    close_log_files ();
@@ -1783,7 +1787,8 @@
    int post_mode;
    int check_new_groups = 0;
    char *dir;
-   
+   char *logfile;
+
    pgm = argv[0];
    argv++; argc--;
    
@@ -1793,6 +1798,7 @@
 
    MLog_Fp = stdout;
    ELog_Fp = stderr;
+   logfile = SLRNPULL_LOGFILE;
 
    dir = getenv ("SLRNPULL_ROOT");
    
@@ -1825,6 +1831,11 @@
 	  check_new_groups = 1;
 	else if (!strcmp (arg, "--version"))
 	  show_version (pgm);
+	else if (!strcmp (arg, "--logfile") && (argc > 0))
+	  {
+	     logfile = *argv;
+	     argv++; argc--;
+	  }
 	else usage (pgm);
      }
 
@@ -1837,7 +1848,7 @@
 	return 1;
      }
    
-   open_log_files ();
+   open_log_files (logfile);
 
    if (expire_mode)
      log_message ("slrnpull started in expire mode.");


-- 
John E. Davis                   Center for Space Research/AXAF Science Center
617-258-8119                    One Hampshire St., Building NE80-6019
http://space.mit.edu/~davis     Cambridge, MA  02139-4307

Technical Details
Message-ID: <slrn7irln7.f4q.davis@aluche.mit.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
References: <slrn7iqpnc.eb.bjensen@ask.ask>

Show Full Headers
Complete Article Headers
Message-ID: <slrn7irln7.f4q.davis@aluche.mit.edu>
Subject: Re: slrnpull slow when reading a newsgroup first time
Date: Mon, 03 May 1999 00:00:00 +0000
From: davis@space.mit.edu (John E. Davis)
References: <slrn7iqpnc.eb.bjensen@ask.ask>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 473568983
X-Complaints-To: usenet@eecs-usenet-02.mit.edu
X-Trace: eecs-usenet-02.mit.edu 925751017 14046 18.75.2.45 (3 May 1999 17:03:37 GMT)
Organization: Center for Space Research
User-Agent: slrn/0.9.5.5 (UNIX)
Reply-To: davis@space.mit.edu
NNTP-Posting-Date: 3 May 1999 17:03:37 GMT
Newsgroups: news.software.readers