internal SITEreader

Jeffrey M. Vinocur jeff at litech.org
Sat Feb 1 15:42:30 UTC 2003


On Sat, 1 Feb 2003, Marco d'Itri wrote:

> I compiled INN with debug symbols so I can poke at it with gdb, where
> should I start looking the next time it happens?

Quick background:  the stuff in innd/chan.c is overlaid on select(), 
essentially.  We maintain a bunch of "channels" (file descriptors plus 
lots of extra state), and mark some of them for reading or writing with 
the FD_SET FD_CLR FD_ZERO macros described in the select() documentation.

The trouble is that by the time the SITEreader message starts getting 
spewed to the logs, it's probably way too late to figure out what caused 
that filedescriptor to be incorrectly marked has readable.

However, I just stared at the code for a while.  Not that I fully
understand it, but do we need to add the following line?

void
RCHANremove(CHANNEL *cp)
{
    if (FD_ISSET(cp->fd, &RCHANmask)) {
        FD_CLR(cp->fd, &RCHANmask);
        if (cp->fd == CHANlastfd) {
            /* This was the highest descriptor, get a new highest. */
            while (!FD_ISSET(CHANlastfd, &RCHANmask)
              && !FD_ISSET(CHANlastfd, &WCHANmask)
+              && !FD_ISSET(CHANlastfd, &SCHANmask)
              && CHANlastfd > 1)
                CHANlastfd--;
        }
    }
}



-- 
Jeffrey M. Vinocur
jeff at litech.org



More information about the inn-workers mailing list