Ronald Florence wrote: > > I couldn't get this to work, and don't see how this hack can work. > The function set_rebuild_time(), in nntpcache.c, is never called. Or > am I missing something? Oops, I should really start using CVS. My hand editing of the patch removed a crucial line:) Here is it again. -- Debian GNU/Linux 1.2 is out! { http://www.debian.org/ } Email: Herbert Xu ~{PmV>HI~} <herbert@greathan.apana.org.au> { http://greathan.apana.org.au/~herbert/ } PGP Key: pgp-public-keys@pgp.mit.edu or any other key sites -- diff -ur --new-file nntpcache-1.0.1.orig/list.c nntpcache-1.0.1/list.c --- nntpcache-1.0.1.orig/list.c Sat Nov 9 07:29:00 1996 +++ nntpcache-1.0.1/list.c Fri Feb 14 11:38:04 1997 @@ -552,19 +551,19 @@ { case l_active: timeout = scfg->active_timeout; - rebuild = scfg->active_rebuild; + rebuild = scfg->rebuild_time->active_rebuild; break; case l_active_times: timeout = scfg->active_times_timeout; - rebuild = scfg->active_times_rebuild; + rebuild = scfg->rebuild_time->active_times_rebuild; break; case l_newsgroups: timeout = scfg->newsgroups_timeout; - rebuild = scfg->newsgroups_rebuild; + rebuild = scfg->rebuild_time->newsgroups_rebuild; break; case l_overview_fmt: timeout = scfg->overview_fmt_timeout; - rebuild = scfg->overview_fmt_rebuild; + rebuild = scfg->rebuild_time->overview_fmt_rebuild; break; default: break; @@ -593,30 +592,30 @@ { if (pid>0) if (getListServer(list, scfg)>0) - scfg->overview_fmt_rebuild = tim; + scfg->rebuild_time->overview_fmt_rebuild = tim; } else if (pid == 0) #endif - getListServer(list, scfg); - switch (list->type) - { - case l_active: - scfg->active_rebuild = tim; - break; - case l_active_times: - scfg->active_times_rebuild = tim; - break; - case l_newsgroups: - scfg->newsgroups_rebuild = tim; - break; + if (getListServer(list, scfg) > 0) + switch (list->type) + { + case l_active: + scfg->rebuild_time->active_rebuild = tim; + break; + case l_active_times: + scfg->rebuild_time->active_times_rebuild = tim; + break; + case l_newsgroups: + scfg->rebuild_time->newsgroups_rebuild = tim; + break; #ifndef MMALLOC - case l_overview_fmt: - scfg->overview_fmt_rebuild = tim; - break; + case l_overview_fmt: + scfg->rebuild_time->overview_fmt_rebuild = tim; + break; #endif - default: - break; - } + default: + break; + } } } #ifdef MMALLOC diff -ur --new-file nntpcache-1.0.1.orig/ll.h nntpcache-1.0.1/ll.h --- nntpcache-1.0.1.orig/ll.h Sat Oct 5 19:18:31 1996 +++ nntpcache-1.0.1/ll.h Fri Feb 14 11:31:06 1997 @@ -8,6 +8,13 @@ struct server_cfg *server_cfg; }; +struct rebuild_cfg { + time_t active_rebuild; /* Last rebuild */ + time_t active_times_rebuild; /* Last rebuild */ + time_t newsgroups_rebuild; /* Last rebuild */ + time_t overview_fmt_rebuild; /* Last rebuild */ +}; + struct server_cfg { struct server_cfg *next; struct server_cfg *head; @@ -15,13 +22,10 @@ int fd; /* Socket fd. -1 means not connected */ char *us; /* Our bind address. From nntpcache.servers */ FILE *fh; /* A FILE struct for the descriptor (fdreopen()ed) */ + struct rebuild_cfg *rebuild_time; /* Last Rebuild */ int active_timeout; /* Active timeout. From nntpcache.servers */ - time_t active_rebuild; /* Last rebuild */ int active_times_timeout; /* Active.times timeout. From nntpcache.servers */ - time_t active_times_rebuild; /* Last rebuild */ int newsgroups_timeout; /* Newsgroups timeout. From nntpcache.servers */ - time_t newsgroups_rebuild; /* Last rebuild */ - time_t overview_fmt_rebuild; /* Last rebuild */ int xover_timeout; /* Xover timeout. From nntpcache.servers */ int group_timeout; /* group timeout */ int listgroup_timeout; /* listgroup timeout */ diff -ur --new-file nntpcache-1.0.1.orig/nntpcache.c nntpcache-1.0.1/nntpcache.c --- nntpcache-1.0.1.orig/nntpcache.c Sat Nov 9 07:47:38 1996 +++ nntpcache-1.0.1/nntpcache.c Fri Feb 14 11:57:11 1997 @@ -266,6 +268,16 @@ return TRUE; } +static void set_rebuild_time() +{ + struct server_cfg *l; + for (l=ServerList; l; l=l->next) + { + if (!l->rebuild_time) + l->rebuild_time = XMcalloc(1, sizeof *l->rebuild_time); + } +} + static bool load_servers(char *file) { FILE *fp; @@ -361,6 +373,7 @@ list->article_timeout = article_timeout; list->overview_fmt_timeout = con.overviewFmtTimeout; list->fd=-1; + list->rebuild_time = 0; } if (ferror(fp)) { @@ -796,6 +814,7 @@ } } open_mmap(); + set_rebuild_time(); sig_hup = FALSE; expire (FALSE); updateDaemon (TRUE);