[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] Reseting list of NewsGroups
"Charlie Grosvenor" <charliemail@xxxxxxxxxxxxxxxx> writes:
> I tried 'fetchnews -f' it has not got rid of the non existent groups. I
> have my isp's news server and newsgroups.borland.com and
> msnews.microsoft.com the latter two only contain a sub set of groups.
> Any ideas?
Please try the patch below and let me know how it does with the
patch. It should fix the issue, it's along the lines of
leafnode-1. Unpack your leafnode-2.0.0.alpha20020921a tarball, apply the
patch, then recompile and reinstall leafnode and retry fetchnews -f.
Thanks in advance.
Index: leafnode-2/activutil.c
diff -u leafnode-2/activutil.c:1.34 leafnode-2/activutil.c:1.35
--- leafnode-2/activutil.c:1.34 Mon Sep 2 02:59:34 2002
+++ leafnode-2/activutil.c Mon Sep 30 03:31:28 2002
@@ -27,6 +27,7 @@
#define GROUPINFO "/leaf.node/groupinfo"
+static size_t oldactivesize = 0;
static size_t activesize = 0;
static time_t activetime = 0;
static ino_t activeinode = 0;
@@ -34,6 +35,7 @@
static ino_t localinode = 0;
struct newsgroup /*@null@*/ *active = NULL;
+struct newsgroup /*@null@*/ *oldactive = NULL;
struct nglist {
struct newsgroup *entry;
@@ -63,11 +65,23 @@
struct nglist *l;
static /*@dependent@*/ struct nglist *lold;
struct newsgroup *g;
+ unsigned long count = 0ul;
- /* interpret INN status characters */
+ /* interpret INN status characters x->n, j->y, =->y */
if (status == 'x') status = 'n';
if (strchr("j=", status)) status = 'y';
+ if (oldactive) {
+ g = findgroup(name, oldactive, -1);
+ if (g) {
+ last = g->last;
+ first = g->first;
+ count = g->count;
+ if (g->age) age = g->age;
+ if (g->desc) desc = g->desc;
+ }
+ }
+
if (active) {
g = findgroup(name, active, -1);
if (g) {
@@ -85,7 +99,7 @@
g->name = critstrdup(name, "insertgroup");
g->first = first;
g->last = last;
- g->count = 0;
+ g->count = count;
g->age = age;
g->desc = desc ? critstrdup(desc, "insertgroup") : NULL;
g->status = status;
@@ -522,7 +536,7 @@
* pointers in the newsgroup structure!
* (c) 2002 Joerg Dietrich
*/
-struct newsgroup *cpactive(struct newsgroup *a)
+struct newsgroup *mvactive(struct newsgroup *a)
{
static struct newsgroup *b;
@@ -530,5 +544,8 @@
sizeof(struct newsgroup),
"allocating active copy");
b = memcpy(b, a, (1+activesize) * sizeof(struct newsgroup));
+ oldactivesize = activesize;
+ active = NULL;
+ activesize = 0;
return b;
}
Index: leafnode-2/fetchnews.c
diff -u leafnode-2/fetchnews.c:1.99 leafnode-2/fetchnews.c:1.100
--- leafnode-2/fetchnews.c:1.99 Sat Sep 14 12:42:14 2002
+++ leafnode-2/fetchnews.c Mon Sep 30 03:31:28 2002
@@ -1234,7 +1234,6 @@
char *l, *p, *q;
struct stringlist *groups = NULL;
struct stringlist *helpptr = NULL;
- struct newsgroup *oldactive;
mastr *s = mastr_new(LN_PATH_MAX);
char timestr[64]; /* must store at least a date in YYMMDD HHMMSS format */
char portstr[20];
@@ -1332,7 +1331,6 @@
mastr_delete(s);
return;
}
- oldactive = cpactive(active);
while ((l = getaline(nntpin)) && (strcmp(l, "."))) {
last = first = 0;
count++;
@@ -1385,7 +1383,6 @@
ln_log(LNLOG_SERR, LNLOG_CSERVER,
"%s: reading newsgroups descriptions failed: %s",
current_server->name, l);
- free(oldactive);
mastr_delete(s);
return;
}
@@ -1393,7 +1390,6 @@
ln_log(LNLOG_SERR, LNLOG_CSERVER,
"%s: reading newsgroups descriptions failed",
current_server->name);
- free(oldactive);
mastr_delete(s);
return;
}
@@ -1404,15 +1400,10 @@
l = getaline(nntpin);
}
if (!l) {
- free(oldactive);
mastr_delete(s);
return; /* timeout */
}
}
- mergeactives(oldactive, active);
- free(oldactive); /* Do not call freeactive(). The pointers in
- oldactive will be free()d by freeactive(active)
- at the end. */
/* touch file */
{
int e = touch_truncate(mastr_str(s));
@@ -1956,8 +1947,9 @@
if (!forceactive)
forceactive |= checkactive();
- if (forceactive)
+ if (forceactive) {
markactive(AM_KILL);
+ }
/* If fetchnews should post only, no lockfile or filters are required.
* It is also sensible to check if there is anything to post when
@@ -1989,7 +1981,10 @@
}
rereadactive();
-
+ if (forceactive) {
+ oldactive = mvactive(active);
+ active = NULL;
+ }
feedincoming();
signal(SIGHUP, SIG_IGN);
@@ -2034,6 +2029,10 @@
signal(SIGTERM, SIG_IGN); /* FIXME */
if (!postonly) {
+ if (rc != 0) {
+ mergeactives(oldactive, active);
+ free(oldactive);
+ }
writeactive();
if (rc == 0 && forceactive)
markactive(AM_UPDATE);
Index: leafnode-2/leafnode.h
diff -u leafnode-2/leafnode.h:1.75 leafnode-2/leafnode.h:1.76
--- leafnode-2/leafnode.h:1.75 Tue Sep 10 01:28:41 2002
+++ leafnode-2/leafnode.h Mon Sep 30 03:31:28 2002
@@ -1,4 +1,4 @@
-/* $Id: leafnode.h,v 1.75 2002/09/09 23:28:41 emma Exp $ */
+/* $Id: leafnode.h,v 1.76 2002/09/30 01:31:28 emma Exp $ */
#ifndef LEAFNODE_H
#define LEAFNODE_H
@@ -206,6 +206,7 @@
};
extern /*@null@*/ /*@owned@*/ struct newsgroup *active;
+ extern /*@null@*/ /*@owned@*/ struct newsgroup *oldactive;
void insertgroup(const char *name, const char status, long unsigned first,
long unsigned last, time_t date, const char *desc)
@@ -221,7 +222,7 @@
int writeactive(void);
void freeactive(/*@null@*/ /*@only@*/ struct newsgroup *a);
void mergeactives(struct newsgroup *old, struct newsgroup *newng) ;
- struct newsgroup *cpactive(struct newsgroup *a);
+ struct newsgroup *mvactive(struct newsgroup *a);
/*
* local groups
*/
Index: leafnode-2/nntpd.c
diff -u leafnode-2/nntpd.c:1.110 leafnode-2/nntpd.c:1.111
--- leafnode-2/nntpd.c:1.110 Sat Sep 21 01:30:42 2002
+++ leafnode-2/nntpd.c Tue Sep 24 00:09:20 2002
@@ -1667,6 +1667,8 @@
break;
} /* switch(fork()) */
+ goto cleanup;
+
unlink_cleanup:
msgid_deallocate(inname, mid);
cleanup:
@@ -1679,7 +1681,7 @@
if (outgoingname) mastr_delete(outgoingname);
if (incomingname) mastr_delete(incomingname);
return;
- }
+ } /* if (havefrom && havesubject && havenewsgroups && !err) */
log_unlink(inname, 0);
if (!havefrom)
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.391 / Virus Database: 222 - Release Date: 19/09/2002
The mailing list is not interested in anti-virus ads. Please have them
turned off.
--
Matthias Andree
http://sourceforge.net/projects/leafnode/ - leafnode-1 tarballs
http://mandree.home.pages.de/leafnode/beta/ - leafnode-2 tarballs
--
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list