--- dreaderd/reader.c 1999/09/11 06:12:37 1.2 +++ dreaderd/reader.c 1999/11/08 03:04:23 1.4 @@ -43,6 +43,7 @@ time_t dtime = 0; time_t ltime = 0; time_t itime = 0; + time_t ftime = 0; int counter = 0; TFd = fd; @@ -93,7 +94,7 @@ /* * Get next scheduled timeout, no more then 2 seconds - * (x 10 counter counts = 20 seconds max for dtime/itime + * (x 10 counter counts = 20 seconds max for {d,i,f}time * check) */ @@ -125,6 +126,7 @@ if (ltime) { dtime += t - ltime; itime += t - ltime; + ftime += t - ltime; } /* @@ -133,6 +135,14 @@ if (dtime < -5 || dtime >= 60) { CheckServerConfig(t, ServersTerminated); dtime = 0; + } + + /* + * Flush overview every 30 seconds to allow dexpireover to work + */ + if (ftime < -5 || ftime >= 30) { + FlushOverCache(); + ftime = 0; } /* --- dreaderd/group.c 1999/11/08 01:51:29 1.1 +++ dreaderd/group.c 1999/11/08 02:53:57 1.3 @@ -21,6 +21,7 @@ #define HMAPSIZE (1024 * 1024) Prototype void NNFeedOverview(Connection *conn); +Prototype void FlushOverCache(void); Prototype OverInfo *GetOverInfo(const char *group); Prototype void PutOverInfo(OverInfo *ov); Prototype const char *GetOverRecord(OverInfo *ov, int artno, int *plen, int *alen); @@ -463,6 +464,30 @@ } if (xtmp) zfree(&conn->co_MemPool, xtmp, xtmpLen); +} + +void FlushOverCache(void) +{ + OverInfo **pov; + OverInfo *ov; + int i; + static int OI = 0; + + for (i = 0; i < OVHSIZE; ++i) { + int ai = OI; + OI = (ai + 1) & OVHMASK; + + pov = &OvHash[ai]; + while ((ov = *pov) != NULL) { + if (ov->ov_Refs == 0) { + *pov = ov->ov_Next; + FreeOverInfo(ov); + --NumOverInfo; + } else { + pov = &ov->ov_Next; + } + } + } } OverInfo *