INN commit: trunk/innd (art.c innd.h nc.c)

INN Commit Russ_Allbery at isc.org
Fri Apr 3 18:21:36 UTC 2009


    Date: Friday, April 3, 2009 @ 11:21:36
  Author: iulius
Revision: 8395

When the news server is throttled, log the rejected article
(with 400) in the news log file.

Modified:
  trunk/innd/art.c
  trunk/innd/innd.h
  trunk/innd/nc.c

--------+
 art.c  |    8 ++++----
 innd.h |    1 +
 nc.c   |   11 ++++++++---
 3 files changed, 13 insertions(+), 7 deletions(-)

Modified: art.c
===================================================================
--- art.c	2009-03-28 18:56:09 UTC (rev 8394)
+++ art.c	2009-04-03 18:21:36 UTC (rev 8395)
@@ -394,8 +394,8 @@
 **  We're rejecting an article.  Log a message to the news log about that,
 **  including all the interesting article information.
 */
-static void
-ARTlogreject(CHANNEL *cp)
+void
+ARTlogreject(CHANNEL *cp, const char *text)
 {
     ARTDATA *data = &cp->Data;
     HDRCONTENT *hc = data->HdrContent;
@@ -424,7 +424,7 @@
         else
             data->Feedsite = "localhost";
     }
-    ARTlog(data, ART_REJECT, cp->Error);
+    ARTlog(data, ART_REJECT, text != NULL ? text : cp->Error);
     HDR_PARSE_END(HDR__MESSAGE_ID);
 }
 
@@ -1011,7 +1011,7 @@
     ARTchecksize(cp);
     if (cp->State == CSgotarticle || cp->State == CSgotlargearticle)
         if (cp->Error[0] != '\0')
-            ARTlogreject(cp);
+            ARTlogreject(cp, NULL);
 }
 
 /*

Modified: innd.h
===================================================================
--- innd.h	2009-03-28 18:56:09 UTC (rev 8394)
+++ innd.h	2009-04-03 18:21:36 UTC (rev 8395)
@@ -693,6 +693,7 @@
 extern void		ARTsetup(void);
 extern void		ARTprepare(CHANNEL *cp);
 extern void		ARTparse(CHANNEL *cp);
+extern void             ARTlogreject(CHANNEL *cp, const char *text);
 extern void		ARTreject(Reject_type, CHANNEL *);
 
 extern bool		CHANsleeping(CHANNEL *cp);

Modified: nc.c
===================================================================
--- nc.c	2009-03-28 18:56:09 UTC (rev 8394)
+++ nc.c	2009-04-03 18:21:36 UTC (rev 8395)
@@ -997,7 +997,8 @@
 	break;
       }
 
-      /* If error is set, we're rejecting this article. */
+      /* If error is set, we're rejecting this article.  There is no need
+       * to call ARTlog() as it has already been done during ARTparse(). */
       if (*cp->Error != '\0') {
 	ARTreject(REJECT_OTHER, cp);
 	cp->State = CSgetcmd;
@@ -1020,10 +1021,11 @@
       readmore = false;
       movedata = false;
       if (Mode == OMthrottled) {
+        ARTreject(REJECT_OTHER, cp);
+        ARTlogreject(cp, ModeReason);
 	/* Clear the work-in-progress entry. */
 	NCclearwip(cp);
 	NCwriteshutdown(cp, ModeReason);
-	ARTreject(REJECT_OTHER, cp);
 	return;
       }
 
@@ -1156,8 +1158,11 @@
 	if (!failed) {
 	  NCwritereply(cp, NNTP_OK_XBATCHED);
 	  cp->Received++;
-	} else
+	} else {
+          /* Only reject, no call to ARTlog() because it will not be
+           * useful for XBATCH -- errors were logged to news.err. */
           ARTreject(REJECT_OTHER, cp);
+        }
       }
       syslog(L_NOTICE, "%s accepted batch size %d", CHANname(cp),
 	cp->XBatchSize);




More information about the inn-committers mailing list