tradspool and ctlinnd newgroup

Katsuhiro Kondou Katsuhiro_Kondou at isc.org
Fri Jul 13 17:48:23 UTC 2001


In article <200107130322.f6D3Mud19965 at lima.epix.net>,
	"Forrest J. Cavalier III" <mibsoft at epix.net> wrote;

} I don't have a good suggestion for fixing the
} problem, but there is a bug which should be fixed:

I think we can avoid the problem in that case by attached.
-- 
Katsuhiro Kondou

Index: storage/tradspool/tradspool.c
===================================================================
RCS file: /home/kondou/news/inn/repository/inn/storage/tradspool/tradspool.c,v
retrieving revision 1.34
diff -u -r1.34 tradspool.c
--- storage/tradspool/tradspool.c	2001/06/30 05:15:01	1.34
+++ storage/tradspool/tradspool.c	2001/07/13 17:45:41
@@ -409,13 +409,13 @@
 #define RELOAD_TIME_CHECK 600
 
 void
-CheckNeedReloadDB(void) {
+CheckNeedReloadDB(bool force) {
     static TIMEINFO lastcheck, oldlastcheck, now;
     struct stat sb;
     char *fname;
 
     if (GetTimeInfo(&now) < 0) return; /* anyone ever seen gettimeofday fail? :-) */
-    if (lastcheck.time + RELOAD_TIME_CHECK > now.time) return;
+    if (!force && lastcheck.time + RELOAD_TIME_CHECK > now.time) return;
 
     oldlastcheck = lastcheck;
     lastcheck = now;
@@ -491,7 +491,7 @@
     unsigned long artnum;
     char *ng, *path;
 
-    CheckNeedReloadDB(); 
+    CheckNeedReloadDB(FALSE);
 
     memcpy(&ngnum, &token.token[0], sizeof(ngnum));
     memcpy(&artnum, &token.token[sizeof(ngnum)], sizeof(artnum));
@@ -499,7 +499,12 @@
     ngnum = ntohl(ngnum);
 
     ng = FindNGByNum(ngnum);
-    if (ng == NULL) return NULL;
+    if (ng == NULL) {
+	CheckNeedReloadDB(TRUE);
+	ng = FindNGByNum(ngnum);
+	if (ng == NULL)
+	    return NULL;
+    }
 
     path = NEW(char, strlen(ng)+20+strlen(innconf->patharticles));
     sprintf(path, "%s/%s/%lu", innconf->patharticles, ng, artnum);
@@ -1232,13 +1237,18 @@
     case SMARTNGNUM:
 	if ((ann = (struct artngnum *)value) == NULL)
 	    return FALSE;
-	CheckNeedReloadDB();
+	CheckNeedReloadDB(FALSE);
 	memcpy(&ngnum, &token->token[0], sizeof(ngnum));
 	memcpy(&artnum, &token->token[sizeof(ngnum)], sizeof(artnum));
 	artnum = ntohl(artnum);
 	ngnum = ntohl(ngnum);
 	ng = FindNGByNum(ngnum);
-	if (ng == NULL) return FALSE;
+	if (ng == NULL) {
+	    CheckNeedReloadDB(TRUE);
+	    ng = FindNGByNum(ngnum);
+	    if (ng == NULL)
+		return FALSE;
+	}
 	ann->groupname = COPY(ng);
 	ann->artnum = (ARTNUM)artnum;
 	return TRUE;


More information about the inn-workers mailing list