| 1 |
INN can destroy the history database when paused or throttled, because the |
| 2 |
history database is closed when INN is in such a mode. It does try to open |
| 3 |
the history database briefly, but that's too late. |
| 4 |
|
| 5 |
This patch fixes that: it refuses to do an addhist when the server is throttled, |
| 6 |
and it does it in the right way when the server is paused. |
| 7 |
|
| 8 |
Miquel van Smoorenburg <[email protected]>, 21-Aug-1997 |
| 9 |
|
| 10 |
--- /project/tmp/inn-1.5.1/innd/cc.c Sat Nov 30 00:32:18 1996 |
| 11 |
+++ inn-1.5.1/innd/cc.c Thu Aug 21 12:36:58 1997 |
| 12 |
@@ -232,8 +232,19 @@ |
| 13 |
/* Check the fields. */ |
| 14 |
if ((p = CCgetid(av[0], &Data.MessageID)) != NULL) |
| 15 |
return p; |
| 16 |
- if (HIShavearticle(Data.MessageID)) |
| 17 |
+ |
| 18 |
+ /* If throttled, don't try to use the history database. */ |
| 19 |
+ if (Mode == OMthrottled) |
| 20 |
+ return "1 Server throttled"; |
| 21 |
+ |
| 22 |
+ /* If paused, briefly open the history database. */ |
| 23 |
+ if (Mode != OMrunning) |
| 24 |
+ HISsetup(); |
| 25 |
+ |
| 26 |
+ if (HIShavearticle(Data.MessageID)) { |
| 27 |
+ if (Mode != OMrunning) HISclose(); |
| 28 |
return "1 Duplicate"; |
| 29 |
+ } |
| 30 |
if (strspn(av[1], DIGITS) != strlen(av[1])) |
| 31 |
return "1 Bad arrival date"; |
| 32 |
Data.Arrived = atol(av[1]); |
| 33 |
@@ -244,14 +255,10 @@ |
| 34 |
return "1 Bad posted date"; |
| 35 |
Data.Posted = atol(av[3]); |
| 36 |
|
| 37 |
- if (Mode == OMrunning) |
| 38 |
- ok = HISwrite(&Data, av[4]); |
| 39 |
- else { |
| 40 |
- /* Possible race condition, but documented in ctlinnd manpage. */ |
| 41 |
- HISsetup(); |
| 42 |
- ok = HISwrite(&Data, av[4]); |
| 43 |
+ ok = HISwrite(&Data, av[4]); |
| 44 |
+ if (Mode != OMrunning) |
| 45 |
HISclose(); |
| 46 |
- } |
| 47 |
+ |
| 48 |
return ok ? NULL : "1 Write failed"; |
| 49 |
} |
| 50 |
|