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

[leafnode-list] Re: patch to get rid of "Reading new newsgroups failed" message



Andrey Khavryuchenko on 05 Sep 2001 00:56:38 +0300 wrote:
> I use news.gnus.org to fetch gnus.ding newsgroup.  The later server is
> misconfigured as I've mentioned earlier here (AFAIR :)
>
> So, tired from seeing 
>        Reading new newsgroups failed
> message in my mail and logs, I've managed to produce such rude patch
> (below).  It adds -q switch which makes fetchnews quiet about such server
> misconfiguration.

I'm using leafnode-1.9.19 and got the same error message from 
"forum.mclink.it" (my provider's "custom" nntp server), but I think that 
disabing the NEWGROUPS command would be a better solution.

Moreover, forum.mclink.it replies to NEWGROUPS as if it were LIST: response 
code 215 followed by the list of all groups.

So I have:
- added a "nonewgroups" option
- changed fetchnews.c to eat up that list if the server behaves as 
forum.mclink.it.

Here is my patch:

--- leafnode-1.9.19/config.example	Tue Jun  5 17:36:14 2001
+++ leafnode-1.9.20/config.example	Sat Nov 10 11:38:37 2001
@@ -34,6 +34,13 @@
 # server = broken.upstream.server
 # nodesc = 1
 
+## This is a news server which does not process the
+## NEWGROUPS command correctly. For this reason, we don't try to
+## download the list of new newsgroups. This is achieved by putting
+## "nonewgroups = 1" somewhere behind the server line.
+# server = broken.upstream.server
+# nonewgroups = 1
+
 ## Here we have another news server which has a very slow connection. For
 ## that reason, we wait a full minute before we give up trying to connect.
 ## The default is 10 seconds.
--- leafnode-1.9.19/leafnode.h	Sat Nov 10 11:05:33 2001
+++ leafnode-1.9.20/leafnode.h	Fri Nov  9 20:15:19 2001
@@ -180,6 +180,7 @@
 struct serverlist {
     int port ;
     int descriptions ;		/* download descriptions as well */
+    int newgroups;              /* ask for new groups */
     int timeout ;		/* timeout in seconds before we give up */
     struct serverlist * next;
     char * name ;		/* Servername */
--- leafnode-1.9.19/configutil.c	Sat Nov 10 11:05:45 2001
+++ leafnode-1.9.20/configutil.c	Sat Nov 10 00:10:18 2001
@@ -297,6 +297,17 @@
 		    syslog( LOG_ERR, "config: no server for nodesc = %s",
 			    value );
 	    }
+	    else if ( strcmp( "nonewgroups", param ) == 0 ) {
+		if ( p ) {
+		    p->newgroups = FALSE;
+		    if ( debugmode )
+			syslog( LOG_DEBUG, "config: no NEWGROUPS for %s",
+			p->name );
+		}
+		else
+		    syslog( LOG_ERR, "config: no server for nonewgroups = %s",
+			    value );
+	    }
 	    else if ( strcmp( "initialfetch", param ) == 0 ) {
 	        initiallimit = atol ( value );
 		if ( debugmode )
@@ -311,6 +322,7 @@
 		     "allocating space for server name");
 		p->name = strdup( value );
 		p->descriptions = TRUE;
+		p->newgroups = TRUE;
 		p->next = NULL;
 		p->timeout = 30;	/* default 30 seconds */
 		p->port = 0;
--- leafnode-1.9.19/fetchnews.c	Sat Nov 10 11:05:45 2001
+++ leafnode-1.9.20/fetchnews.c	Sat Nov 10 11:03:18 2001
@@ -1084,9 +1084,20 @@
 	strftime( timestr, 64, "%Y%m%d %H%M00", gmtime( &update ) );
 	sprintf( lineout, "NEWGROUPS %s GMT\r\n", timestr+2 );
 	putaline();
-	if ( nntpreply() != 231 ) {
+	if ( (reply = nntpreply()) != 231 ) {
 	    printf( "Reading new newsgroups failed.\n" );
 	    syslog( LOG_ERR, "Reading new newsgroups failed" );
+	    if ( reply == 215 ) {
+                /* some servers return 215 and the list of all groups */
+                syslog( LOG_NOTICE, "warning: %s does not process "
+                       "NEWGROUPS correctly: use nonewgroups\n",
+                       current_server->name );
+                printf("warning: %s does not process "
+                       "NEWGROUPS correctly: use nonewgroups\n",
+                       current_server->name );
+                while ( (l=getaline(nntpin)) && (*l != '.') )
+		    ;
+	    }
 	    return;
 	}
 	while ( (l=getaline(nntpin)) && ( *l != '.' ) ) {
@@ -1618,7 +1629,8 @@
 		if ( reply == 200 )
 		    ( void ) postarticles();
 		if ( !postonly ) {
-		    nntpactive( lastrun );
+                    if ( current_server->newgroups || forceactive )
+		        nntpactive( lastrun );
 				/* get list of newsgroups or new newsgroups */
 		    processupstream( current_server->name );
 		}


Hope this will helps someone else.

Sergio

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list