Thread View: news.software.nntp
4 messages
4 total messages
Started by Gary Mills
Mon, 26 Jan 1998 00:00
Enhanced Joe Greco control.cancel patch for inn 1.7.1
Author: Gary Mills
Date: Mon, 26 Jan 1998 00:00
Date: Mon, 26 Jan 1998 00:00
186 lines
6512 bytes
6512 bytes
This is Joe Greco's control.cancel hack, modified for inn 1.7.1.
I changed the snprintf's back to sprintf's to suit 1.7.1. It divides
up the control.cancel directory into 10,000 subdirectories in two
levels, creating 10,000 phantom newsgroups. It's not necessary to
add these to the active file. However, three other small patches
are required so expire does not complain about these newsgroups and
so it uses the expiry time for control.cancel for them, so expireover
does not complain about them, and so overchan does not create overview
records for them.
This patch gives a tremendous performance boost to inn. It is a
hack, though, and should be replaced by a better way of storing
news articles.
*** innd/art.Oc Fri Dec 5 16:42:12 1997
--- innd/art.c Sun Dec 28 22:24:13 1997
***************
*** 2,7 ****
--- 2,13 ----
**
** Article-processing.
*/
+
+ /*
+ * 930721JG Modify control newsgroup handling to not write such big
+ * directories.
+ */
+
#include <stdio.h>
#include <sys/types.h>
#include "configdata.h"
***************
*** 1724,1729 ****
--- 1730,1736 ----
{
static BUFFER Files;
static BUFFER Header;
+ static char ngpDir[SPOOLNAMEBUFF];
static char buff[SPOOLNAMEBUFF];
register char *p;
register int i;
***************
*** 2173,2183 ****
continue;
ngp->PostCount = 0;
if (Data.Name[0] == '\0') {
/* Write the article the first time. */
! (void)sprintf(Data.Name, "%s/%lu", ngp->Dir, ngp->Filenum);
if (ARTwrite(Data.Name, article, &Data) < 0
! && (!MakeSpoolDirectory(ngp->Dir)
|| ARTwrite(Data.Name, article, &Data) < 0)) {
i = errno;
syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name);
--- 2180,2199 ----
continue;
ngp->PostCount = 0;
+ if (! strcmp(ngp->Dir, "control/cancel")) {
+ /* Use modified directory format - breaks nnrpd, etc.,
+ but we don't give a rip */
+ sprintf(ngpDir, "%s/%02d/%02d", ngp->Dir, (ngp->Filenum / 10000) % 100, (ngp->Filenum / 100) % 100);
+ } else {
+ /* Use standard directory format */
+ sprintf(ngpDir, "%s", ngp->Dir);
+ }
+
if (Data.Name[0] == '\0') {
/* Write the article the first time. */
! (void)sprintf(Data.Name, "%s/%lu", ngpDir, ngp->Filenum);
if (ARTwrite(Data.Name, article, &Data) < 0
! && (!MakeSpoolDirectory(ngpDir)
|| ARTwrite(Data.Name, article, &Data) < 0)) {
i = errno;
syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name);
***************
*** 2199,2207 ****
}
else {
/* Link to the main article. */
! (void)sprintf(linkname, "%s/%lu", ngp->Dir, ngp->Filenum);
if (DoLinks && link(Data.Name, linkname) < 0
! && (!MakeSpoolDirectory(ngp->Dir)
|| link(Data.Name, linkname) < 0)) {
#if defined(DONT_HAVE_SYMLINK)
oerrno = errno;
--- 2215,2223 ----
}
else {
/* Link to the main article. */
! (void)sprintf(linkname, "%s/%lu", ngpDir, ngp->Filenum);
if (DoLinks && link(Data.Name, linkname) < 0
! && (!MakeSpoolDirectory(ngpDir)
|| link(Data.Name, linkname) < 0)) {
#if defined(DONT_HAVE_SYMLINK)
oerrno = errno;
***************
*** 2213,2219 ****
/* Try to make a symbolic link to the full pathname. */
FileGlue(buff, SPOOL, '/', Data.Name);
if (symlink(buff, linkname) < 0
! && (!MakeSpoolDirectory(ngp->Dir)
|| symlink(buff, linkname) < 0)) {
oerrno = errno;
syslog(L_ERROR, "%s cant symlink %s and %s %m",
--- 2229,2235 ----
/* Try to make a symbolic link to the full pathname. */
FileGlue(buff, SPOOL, '/', Data.Name);
if (symlink(buff, linkname) < 0
! && (!MakeSpoolDirectory(ngpDir)
|| symlink(buff, linkname) < 0)) {
oerrno = errno;
syslog(L_ERROR, "%s cant symlink %s and %s %m",
*** expire/expire.Oc Fri Dec 5 16:42:12 1997
--- expire/expire.c Wed Dec 31 11:26:19 1997
***************
*** 540,546 ****
}
*p = '\0';
if ((ngp = NGfind(Entry)) == NULL)
! ngp = EXPnotfound(Entry);
*p = '/';
/* Bad posting date? */
--- 540,549 ----
}
*p = '\0';
if ((ngp = NGfind(Entry)) == NULL)
! if (EQn(Entry, "control.cancel", STRLEN("control.cancel")))
! ngp = NGfind("control.cancel");
! if (ngp == NULL)
! ngp = EXPnotfound(Entry);
*p = '/';
/* Bad posting date? */
*** expire/expireover.Oc Fri Dec 5 16:42:12 1997
--- expire/expireover.c Thu Jan 1 18:57:47 1998
***************
*** 813,818 ****
--- 813,820 ----
if ((p = strrchr(line, '/')) == NULL)
continue;
*p++ = '\0';
+ if (EQn(line, "control/cancel", 14))
+ continue;
if (List.Used == 0) {
(void)strcpy(group, line);
List.Used = 0;
***************
*** 847,852 ****
--- 849,856 ----
if ((p = strrchr(line, '/')) == NULL)
continue;
*p++ = '\0';
+ if (EQn(line, "control/cancel", 14))
+ continue;
List.Articles[0] = atol(p);
RemoveLines(line, &List);
}
*** backends/overchan.Oc Fri Dec 5 16:42:12 1997
--- backends/overchan.c Thu Jan 1 15:20:19 1998
***************
*** 220,226 ****
*Art++ = '\0';
/* Write data. */
! if (!WriteData(Dir, Art, Rest, FALSE)
&& (!MakeOverDir(Dir) || !WriteData(Dir, Art, Rest, TRUE)))
(void)fprintf(stderr, "overchan cant update %s %s\n",
Dir, strerror(errno));
--- 220,227 ----
*Art++ = '\0';
/* Write data. */
! if (!EQ(Dir,"control/cancel") &&
! !WriteData(Dir, Art, Rest, FALSE)
&& (!MakeOverDir(Dir) || !WriteData(Dir, Art, Rest, TRUE)))
(void)fprintf(stderr, "overchan cant update %s %s\n",
Dir, strerror(errno));
--
-Gary Mills- -Unix Support- -U of M Academic Computing and Networking-
Re: Enhanced Joe Greco control.cancel patch for inn 1.7.1
Author: Trevor Fiatal
Date: Mon, 26 Jan 1998 00:00
Date: Mon, 26 Jan 1998 00:00
21 lines
1378 bytes
1378 bytes
On 26 Jan 1998 05:53:52 GMT, mills@cc.umanitoba.ca (Gary Mills) spake thusly: >This is Joe Greco's control.cancel hack, modified for inn 1.7.1. No offense, but... Why on earth release this for 1.7.1 when 1.7.2 is available, and generally considered the preferred version of 1.7? Or was this just a typo? -Trevor -- /--------------------------------=-------------------------------------\ |Trevor Fiatal - trevor@home.net | WANTED: Experienced Usenet and mail | |Internet Applications Architect | systems admin. Relocation available | |@Home Network, SF Bay Area, CA | for right candidate. Email for info.| \--------------------------------|-------------------------------------/
Re: Enhanced Joe Greco control.cancel patch for inn 1.7.1
Author: Joe Greco
Date: Tue, 03 Feb 1998 00:00
Date: Tue, 03 Feb 1998 00:00
19 lines
1352 bytes
1352 bytes
In news.software.nntp article <34cf4cd7.439793069@news.rdc1.sfba.home.com>, trevor@home.net (Trevor Fiatal) wrote: :On 26 Jan 1998 05:53:52 GMT, mills@cc.umanitoba.ca (Gary Mills) :spake thusly: : :>This is Joe Greco's control.cancel hack, modified for inn 1.7.1. : :No offense, but... : :Why on earth release this for 1.7.1 when 1.7.2 is available, and generally :considered the preferred version of 1.7? Or was this just a typo? Hey, it's an improvement. :-) I only had a 1.5.1 version available. Posted on http://www.nntp.sol.net/patches. ... JG
Re: Enhanced Joe Greco control.cancel patch for inn 1.7.1
Author: Michael Hall
Date: Wed, 04 Feb 1998 00:00
Date: Wed, 04 Feb 1998 00:00
177 lines
6776 bytes
6776 bytes
On 3 Feb 1998, Joe Greco wrote:
> :Why on earth release this for 1.7.1 when 1.7.2 is available, and generally
> :considered the preferred version of 1.7? Or was this just a typo?
>
> Hey, it's an improvement. :-) I only had a 1.5.1 version available.
Here it is for 1.7.2.insync-1.1d:
*** innd/art.c.ORIG Mon Jan 26 23:18:37 1998
--- innd/art.c Thu Jan 29 14:19:22 1998
***************
*** 1735,1740 ****
--- 1735,1741 ----
{
static BUFFER Files;
static BUFFER Header;
+ static char ngpDir[SPOOLNAMEBUFF];
static char buff[SPOOLNAMEBUFF];
static char path[MAXHEADERSIZE];
register char *p;
***************
*** 2197,2210 ****
continue;
ngp->PostCount = 0;
if (Data.Name[0] == '\0') {
#if defined(TIMER)
TMRstart(TMR_ARTWRITE);
#endif /* defined(TIMER) */
/* Write the article the first time. */
! (void)sprintf(Data.Name, "%s/%lu", ngp->Dir, ngp->Filenum);
if (ARTwrite(Data.Name, article, &Data) < 0
! && (!MakeSpoolDirectory(ngp->Dir)
|| ARTwrite(Data.Name, article, &Data) < 0)) {
i = errno;
syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name);
--- 2198,2220 ----
continue;
ngp->PostCount = 0;
+ if (! strcmp(ngp->Dir, "control/cancel")) {
+ /* Use modified directory format - breaks nnrpd, etc.,
+ but we don't give a rip */
+ sprintf(ngpDir, "%s/%02d/%02d", ngp->Dir, (ngp->Filenum / 10000) % 100, (ngp->Filenum / 100) % 100);
+ } else {
+ /* Use standard directory format */
+ sprintf(ngpDir, "%s", ngp->Dir);
+ }
+
if (Data.Name[0] == '\0') {
#if defined(TIMER)
TMRstart(TMR_ARTWRITE);
#endif /* defined(TIMER) */
/* Write the article the first time. */
! (void)sprintf(Data.Name, "%s/%lu", ngpDir, ngp->Filenum);
if (ARTwrite(Data.Name, article, &Data) < 0
! && (!MakeSpoolDirectory(ngpDir)
|| ARTwrite(Data.Name, article, &Data) < 0)) {
i = errno;
syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name);
***************
*** 2235,2243 ****
TMRstart(TMR_ARTLINK);
#endif /* defined(TIMER) */
/* Link to the main article. */
! (void)sprintf(linkname, "%s/%lu", ngp->Dir, ngp->Filenum);
if (DoLinks && link(Data.Name, linkname) < 0
! && (!MakeSpoolDirectory(ngp->Dir)
|| link(Data.Name, linkname) < 0)) {
#if defined(DONT_HAVE_SYMLINK)
oerrno = errno;
--- 2245,2253 ----
TMRstart(TMR_ARTLINK);
#endif /* defined(TIMER) */
/* Link to the main article. */
! (void)sprintf(linkname, "%s/%lu", ngpDir, ngp->Filenum);
if (DoLinks && link(Data.Name, linkname) < 0
! && (!MakeSpoolDirectory(ngpDir)
|| link(Data.Name, linkname) < 0)) {
#if defined(DONT_HAVE_SYMLINK)
oerrno = errno;
***************
*** 2249,2255 ****
/* Try to make a symbolic link to the full pathname. */
FileGlue(buff, SPOOL, '/', Data.Name);
if (symlink(buff, linkname) < 0
! && (!MakeSpoolDirectory(ngp->Dir)
|| symlink(buff, linkname) < 0)) {
oerrno = errno;
syslog(L_ERROR, "%s cant symlink %s and %s %m",
--- 2259,2265 ----
/* Try to make a symbolic link to the full pathname. */
FileGlue(buff, SPOOL, '/', Data.Name);
if (symlink(buff, linkname) < 0
! && (!MakeSpoolDirectory(ngpDir)
|| symlink(buff, linkname) < 0)) {
oerrno = errno;
syslog(L_ERROR, "%s cant symlink %s and %s %m",
*** expire/expire.c.ORIG Mon Jan 26 23:34:18 1998
--- expire/expire.c Mon Jan 26 23:38:27 1998
***************
*** 540,546 ****
}
*p = '\0';
if ((ngp = NGfind(Entry)) == NULL)
! ngp = EXPnotfound(Entry);
*p = '/';
/* Bad posting date? */
--- 540,549 ----
}
*p = '\0';
if ((ngp = NGfind(Entry)) == NULL)
! if (EQn(Entry, "control.cancel", STRLEN("control.cancel")))
! ngp = NGfind("control.cancel");
! if (ngp == NULL)
! ngp = EXPnotfound(Entry);
*p = '/';
/* Bad posting date? */
*** expire/expireover.c.ORIG Mon Jan 26 23:34:30 1998
--- expire/expireover.c Mon Jan 26 23:41:34 1998
***************
*** 813,818 ****
--- 813,820 ----
if ((p = strrchr(line, '/')) == NULL)
continue;
*p++ = '\0';
+ if (EQn(line, "control/cancel", 14))
+ continue;
if (List.Used == 0) {
(void)strcpy(group, line);
List.Used = 0;
***************
*** 847,852 ****
--- 849,856 ----
if ((p = strrchr(line, '/')) == NULL)
continue;
*p++ = '\0';
+ if (EQn(line, "control/cancel", 14))
+ continue;
List.Articles[0] = atol(p);
RemoveLines(line, &List);
}
*** backends/overchan.c.ORIG Mon Jan 26 23:42:22 1998
--- backends/overchan.c Mon Jan 26 23:45:24 1998
***************
*** 225,231 ****
*Art++ = '\0';
/* Write data. */
! if (!WriteData(Dir, Art, Rest, FALSE)
&& (!MakeOverDir(Dir) || !WriteData(Dir, Art, Rest, TRUE)))
(void)fprintf(stderr, "overchan cant update %s %s\n",
Dir, strerror(errno));
--- 225,232 ----
*Art++ = '\0';
/* Write data. */
! if (!EQ(Dir,"control/cancel") &&
! !WriteData(Dir, Art, Rest, FALSE)
&& (!MakeOverDir(Dir) || !WriteData(Dir, Art, Rest, TRUE)))
(void)fprintf(stderr, "overchan cant update %s %s\n",
Dir, strerror(errno));
--------------
--
Mike Hall <mhall@rockisland.com> *nix, Perl, CGI hacker...
P.O. Box 1065 Certified OS/2 Specialist
Friday Harbor, WA 98250 Sorry, no Win* :-)
***---***---***---***---***---***---***---***---***---***
To get my PGP key send email with Subject: Request PGP key
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads