Subject: INN: patch for overchan backlogs

From: [email-masked] (Jerry Aguirre)
Date: 8 Apr 1997 02:41:11 GMT

A common problem with INN on many systems is that the channel
feed to overchan gets farther and farther behind until innd
burps the excess to a file in the out.going spool.  This file
is useless as there is no existing mechanism to process it.

The problem turns out to not be with overchan but with innd not
being able to write the data fast enough to keep up with overchan.
The size of the OS buffer used for pipes limits the amount that can be
written on each loop of innd's channel scheduler.

The following patch has been running here for a little over a month.
Manual runs of "expireover -a" show only the "-" entries for cancelled
articles.  Never a "+" for dropped or not up to date overchan entries.

				Jerry Aguirre

*** innd/site.c.orig	Tue Dec 17 06:40:40 1996
--- innd/site.c	Thu Feb 20 10:35:49 1997
***************
*** 260,267 ****
      if (i < sp->StopWriting)
  	WCHANremove(cp);
      if ((sp->StartWriting == 0 || i > sp->StartWriting)
!      && !CHANsleeping(cp))
! 	WCHANadd(cp);
  
      cp->LastActive = Now.time;
  
--- 260,284 ----
      if (i < sp->StopWriting)
  	WCHANremove(cp);
      if ((sp->StartWriting == 0 || i > sp->StartWriting)
!      && !CHANsleeping(cp)) {
! 	if (sp->Type == FTchannel) {	/* channel feed, try the write */
! 	    int j;
! 	    if (bp->Left == 0)
! 		return;
! 	    j = write(cp->fd, (POINTER)&bp->Data[bp->Used], (SIZE_T)bp->Left);
! 	    if (j > 0) {
! 		bp->Left -= j;
! 		bp->Used += j;
! 		i = cp->Out.Left;
! 	    }
! 	    if (bp->Left <= 0)
! 		WCHANremove(cp);
! 	    else
! 		WCHANadd(cp);
! 	}
! 	else
! 	    WCHANadd(cp);
!     }
  
      cp->LastActive = Now.time;