[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] Local newsgroups possible with leafnode-2.0b7 ?



Stefan Wiens wrote:

> krasel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx (Cornelius Krasel) writes:
> > Stefan Wiens wrote: 
> >> Couldn't getxover() first compare the timestamps of the
> >> overview file and the group directory?

[...]

> Unfortunately, the coarse timestamp resolution makes it impossible to
> reliably determine which of two files has been written later.

The following code which I put at the beginning of getxover() seems to
work quite neatly at the moment:

    if ( lastgroup && strcmp( groupname, lastgroup ) == 0 ) {
        /* repeated XOVER requests for the same group */
        time_t mtime_dir;

        /* if the last access time of the .overview file is newer than
         * that of the directory, the .overview file is up to date which
         * also means that the overview data in memory are up to date.
         */
        if ( !stat( ".", &st ) ) {
            mtime_dir = st.st_mtime;
            if ( !stat(".overview", &st) && (st.st_atime > mtime_dir) ) {
                return 1;
            }
        }
    }

Or did I overlook something?

--Cornelius.

-- 
/* Cornelius Krasel, U Wuerzburg, Dept. of Pharmacology, Versbacher Str. 9 */
/* D-97078 Wuerzburg, Germany   email: krasel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx */
/* "Science is the game we play with God to find out what His rules are."  */

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list