GROUP command and NFS readers

Julien ÉLIE julien at trigofacile.com
Sat Aug 23 14:33:31 UTC 2008


Hi,

I think the GROUP command is broken for NFS readers:
 * we do not have the right count in the reply;
 * the condition "ARTlow + innconf->nfsreaderdelay > ARThigh"
   seems very weird...  Adding an article number to a time in seconds!
   I have checked SVN logs and this code have been the same since
   the beginning.  Well, I believe it works if, and only if, the
   group did not receive more than 1 art/second during the last
   nfsreaderdelay seconds.

As for the count, maybe we should not break just after "ARThigh = prev"
but finish the loop with "count--" at each iteration.
Unless there is a better method with a magical function in the API?


Furthermore, there is something I do not understand with nfsreaderdelay.
Only GROUP and NEWNEWS implement it (if I ask news from 10h00 with NEWNEWS,
it is converted to 09h59 with a delay of 1 minute).

Is it useless to add support for nfsreaderdelay elsewhere?
Because it generates discrepancies with the result of LISTGROUP for instance.
Moreover, LAST or NEXT (amongst other commands) will work and properly display
such normally hidden messages.


    if (strcasecmp(av[0], "group") == 0) {
        if (count == 0)
            Reply("%d 0 0 0 %s\r\n", NNTP_OK_GROUP, group);
        else {
            /* if we're an NFS reader, check the last nfsreaderdelay
             * articles in the group to see if they arrived in the
             * last nfsreaderdelay (default 60) seconds. If they did,
             * don't report them as we don't want them to appear too
             * soon */
            if (innconf->nfsreader) {
                ARTNUM low, prev;
                time_t now, arrived;

                time(&now);
                if (ARTlow + innconf->nfsreaderdelay > ARThigh)
                    low = ARTlow;
                else
                    low = ARThigh - innconf->nfsreaderdelay;
                handle = OVopensearch(group, low, ARThigh);
                if (!handle) {
                    Reply("%d group disappeared\r\n", NNTP_ERR_UNAVAILABLE);
                    free(group);
                    return;
                }
                prev = low;
                while (OVsearch(handle, &i, NULL, NULL, NULL, &arrived)) {
                    if (arrived + innconf->nfsreaderdelay > now) {
                        ARThigh = prev;
                        break;
                    }
                    prev = i;
                }
                OVclosesearch(handle);
            }
            Reply("%d %d %lu %lu %s\r\n", NNTP_OK_GROUP, count, ARTlow,
                  ARThigh, group);
        }


-- 
Julien ÉLIE

« -- Ordre est donné d'enquêter dans tout le secteur, afin d'identifier
  et de confondre les légions à la solde de Pompée !
  -- S'ils n'ont pas de signes distinctifs, ça ne sera pas facile mon général ! » (Astérix) 



More information about the inn-workers mailing list