Return-Path: linkers-owner@math.ohio-state.edu
Received: from mathserv.mps.ohio-state.edu (mathserv.mps.ohio-state.edu [128.146.110.31]) by leibniz.math.psu.edu (8.6.12/8.6.9) with ESMTP id NAA02842 for <barr@math.psu.edu>; Fri, 23 Jun 1995 13:29:03 -0400
Received: (from daemon@localhost) by mathserv.mps.ohio-state.edu (8.6.12/8.6.12) id MAA21029 for linkers-outgoing; Fri, 23 Jun 1995 12:02:51 -0400
Received: from stealth.sprintlink.net (rmartin@stealth.sprintlink.net [199.0.55.70]) by mathserv.mps.ohio-state.edu (8.6.12/8.6.12) with ESMTP id MAA21018 for <linkers@math.ohio-state.edu>; Fri, 23 Jun 1995 12:02:41 -0400
Received: (from rmartin@localhost) by stealth.sprintlink.net (8.6.10/8.6.9) id MAA29223; Fri, 23 Jun 1995 12:02:39 -0400
Date: Fri, 23 Jun 1995 12:02:38 -0400 (EDT)
From: Richard Martin <rmartin@sprint.net>
Subject: INND Patch for stdin feeds to nntplink
To: linkers@math.ohio-state.edu
Message-ID: <Pine.3.89.9506231150.J25275-0100000@stealth.sprintlink.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-linkers@math.ohio-state.edu
Precedence: bulk


Here is our patch to innd to fix the problem with innd growing really 
large when using inn with nntplink in stdin mode.  Please note:

1) The function of the "S" flag has been changed.  When a sites buffer 
gets to the value specified by the "S" flag, inn will dump the buffer to 
disk and then continue on.

2) We made no changes to man pages to reflect this, we just hacked the code.

3) Rich Salz mentioned that this should be a different flag instead of 
hacking the S flag.  He is probably right, but I'm not sure as I think
this is what the S flag should have done all along.  Thoughts?

We have tested this pretty well and feel its pretty solid, but please let 
me know if we did something stupid (it would be the first time! ) :-)


Anyway, here it is (its also on 
ftp.sprintlink.net://networking/news/inn/innd.spool.patch).  This diff 
was made against David Barr's <barr@math.psu.edu> unoff1 release of inn so
its slightly different than stock inn1.4.


Rich Martin
Sprintlink Systems

*** site.c.orig	Fri Jun 23 09:42:48 1995
--- site.c	Thu Jun 22 16:15:15 1995
***************
*** 150,156 ****
--- 150,200 ----
      SITEcount--;
  }
  
+ /*
+  * *  Bilge Site's Channel out buffer.
+  */
+ STATIC          BOOL
+ SITECHANbilge(sp)
+     register SITE  *sp;
+ {
+     int             fd, i;
+     char            buff[SPOOLNAMEBUFF];
+     char           *name;
  
+     name = sp->SpoolName;
+     fd = open(name, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE);
+     if (fd < 0 && errno == EISDIR) {
+         FileGlue(buff, sp->SpoolName, '/', "togo");
+         name = buff;
+         fd = open(buff, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE);
+     }
+     if (fd < 0) {
+         IOError("site batch file");
+         syslog(L_ERROR, "%s cant open %s %m", sp->Name, name);
+         sp->Channel = NULL;
+         return FALSE;
+     }
+     while(sp->Channel->Out.Left > 0) {
+         i = write(fd, (POINTER) &sp->Channel->Out.Data[sp->Channel->Out.Used],
+             (SIZE_T) sp->Channel->Out.Left);
+         if(i <= 0) {
+             syslog(L_ERROR,"%s cant spool count %d",CHANname(sp->Channel),
+                 sp->Channel->Out.Left);
+             close(fd);
+             return FALSE;
+         }
+         sp->Channel->Out.Left -= i;
+         sp->Channel->Out.Used += i;
+     }
+     close(fd);
+     DISPOSE(sp->Channel->Out.Data);
+     sp->Channel->Out.Data = NEW(char, SMBUF);
+     sp->Channel->Out.Size = SMBUF;
+     sp->Channel->Out.Left = 0;
+     sp->Channel->Out.Used = 0;
+     return TRUE;
+ }
+ 
  /*
  **  Check if we need to write out the site's buffer.  If we're buffered
  **  or the feed is backed up, this gets a bit complicated.
***************
*** 193,207 ****
      if (sp->Type == FTfile || sp->StartSpooling == 0 || i < sp->StartSpooling)
  	return;
  
!     if (!SITEspool(sp, (CHANNEL *)NULL)) {
  	syslog(L_ERROR, "%s overflow %d bytes", sp->Name, i);
  	return;
      }
-     syslog(L_ERROR, "%s spooling %d bytes", sp->Name, i);
-     WCHANsetfrombuffer(sp->Channel, &cp->Out);
-     WCHANadd(sp->Channel);
-     CHANclose(cp, CHANname(cp));
  }
  
  
  /*
--- 237,249 ----
      if (sp->Type == FTfile || sp->StartSpooling == 0 || i < sp->StartSpooling)
  	return;
  
!     syslog(L_ERROR, "%s spooling %d bytes", sp->Name, i);
!     if(!SITECHANbilge(sp)) {
  	syslog(L_ERROR, "%s overflow %d bytes", sp->Name, i);
  	return;
      }
  }
+ 
  
  
  /*


Richard Martin
Sprintlink Systems & Services

