Installed new method of bad tic handling

This commit is contained in:
Michiel Broek 2005-11-19 19:43:03 +00:00
parent ef3ea01f51
commit 660ac062e6
5 changed files with 64 additions and 24 deletions

View File

@ -4,6 +4,7 @@ v0.83.2 16-Nov-2005
mbfido: mbfido:
Fixed crash when receiving bad tics. Fixed crash when receiving bad tics.
Reinstalled tic orphans and bad crc handling using new method.
v0.83.1 12-Nov-2005 - 16-Nov-2005 v0.83.1 12-Nov-2005 - 16-Nov-2005

View File

@ -162,7 +162,7 @@ mbindex.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbindex.h
msgutil.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h msgutil.h msgutil.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h msgutil.h
postecho.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h ftn2rfc.h postecho.h storeecho.h addpkt.h rollover.h qualify.h postecho.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h ftn2rfc.h postecho.h storeecho.h addpkt.h rollover.h qualify.h
rollover.o: ../config.h ../lib/mbselib.h rollover.h rollover.o: ../config.h ../lib/mbselib.h rollover.h
tic.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h unpack.h fsort.h orphans.h ptic.h tic.h tic.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h unpack.h fsort.h orphans.h ptic.h mover.h tic.h
areamgr.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h ../lib/diesel.h sendmail.h mgrutil.h scan.h createm.h areamgr.h areamgr.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h ../lib/diesel.h sendmail.h mgrutil.h scan.h createm.h areamgr.h
filefind.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h fflist.h filefind.h msgutil.h filefind.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h fflist.h filefind.h msgutil.h
grlist.o: ../config.h ../lib/mbselib.h grlist.h grlist.o: ../config.h ../lib/mbselib.h grlist.h

View File

@ -46,14 +46,14 @@ void mover(char *fn)
snprintf(From, PATH_MAX, "%s/%s", TIC.Inbound, fn); snprintf(From, PATH_MAX, "%s/%s", TIC.Inbound, fn);
snprintf(To, PATH_MAX, "%s/%s", CFG.badtic, fn); snprintf(To, PATH_MAX, "%s/%s", CFG.badtic, fn);
Syslog('!', "Moving %s to %s", From, To); Syslog('+', "Moving %s to %s", From, To);
if (mkdirs(To, 0770)) { if (mkdirs(To, 0770)) {
if ((rc = file_mv(From, To))) { if ((rc = file_mv(From, To))) {
WriteError("$Failed to move %s to %s: %s", From, To, strerror(rc)); WriteError("Failed to move %s to %s: %s", From, To, strerror(rc));
} }
} else { } else {
WriteError("$Can't create directory for %s", To); WriteError("Can't create directory for %s", To);
} }
free(From); free(From);

View File

@ -101,19 +101,6 @@ int ProcessTic(fa_list **sbl, orphans **opl)
if (TIC.Orphaned) { if (TIC.Orphaned) {
fill_orphans(opl, TIC.TicName, TIC.TicIn.Area, TIC.TicIn.File, TRUE, FALSE); fill_orphans(opl, TIC.TicName, TIC.TicIn.Area, TIC.TicIn.File, TRUE, FALSE);
Syslog('+', "File not in inbound: %s", TIC.TicIn.File); Syslog('+', "File not in inbound: %s", TIC.TicIn.File);
/*
* Now check the age of the .tic file.
*/
// snprintf(Temp, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicName);
// Fdate = file_time(Temp);
// Age = (Now - Fdate) / 84400;
// Syslog('+', "Orphaned tic age %d days", Age);
// if (Age > 21) {
// tic_bad++;
// mover(TIC.TicName);
// }
free(Temp); free(Temp);
return 2; return 2;
} }
@ -138,7 +125,6 @@ int ProcessTic(fa_list **sbl, orphans **opl)
Syslog('!', "CRC: expected %08lX, the file is %08lX", TIC.Crc_Int, crc); Syslog('!', "CRC: expected %08lX, the file is %08lX", TIC.Crc_Int, crc);
fill_orphans(opl, TIC.TicName, TIC.TicIn.Area, TIC.TicIn.File, FALSE, TRUE); fill_orphans(opl, TIC.TicName, TIC.TicIn.Area, TIC.TicIn.File, FALSE, TRUE);
if (check_crc) { if (check_crc) {
// Bad((char *)"CRC: error, %s may be damaged", TIC.TicIn.File);
Syslog('+', "Bad CRC, will check this ticfile later"); Syslog('+', "Bad CRC, will check this ticfile later");
free(Temp); free(Temp);
return 1; return 1;
@ -584,9 +570,18 @@ int ProcessTic(fa_list **sbl, orphans **opl)
/* /*
* Now check if other (older) ticfiles point to this file * Now check if other (older) ticfiles point to this file
*/ */
First = TRUE;
for (topl = *opl; topl; topl = topl->next) { for (topl = *opl; topl; topl = topl->next) {
if (First) {
Syslog('f', "TIC file TIC area Filename ORP CRC DEL");
Syslog('f', "------------ -------------------- ------------ --- --- ---");
First = FALSE;
}
Syslog('f', "%-12s %-20s %-12s %s %s %s", topl->TicName, topl->Area, topl->FileName,
topl->Orphaned ? "Yes" : "No ", topl->BadCRC ? "Yes" : "No ", topl->Purged ? "Yes":"No ");
if ((strcmp(topl->Area, TIC.TicIn.Area) == 0) && (strcmp(topl->FileName, TIC.TicIn.File) == 0)) { if ((strcmp(topl->Area, TIC.TicIn.Area) == 0) && (strcmp(topl->FileName, TIC.TicIn.File) == 0)) {
Syslog('f', "Found matching tic file %s, should purge this one", topl->TicName); Syslog('f', "Found matching tic file %s, mark to purge this one", topl->TicName);
topl->Purged = TRUE;
} }
} }

View File

@ -36,6 +36,7 @@
#include "fsort.h" #include "fsort.h"
#include "orphans.h" #include "orphans.h"
#include "ptic.h" #include "ptic.h"
#include "mover.h"
#include "tic.h" #include "tic.h"
#define UNPACK_FACTOR 300 #define UNPACK_FACTOR 300
@ -64,9 +65,10 @@ int Tic()
DIR *dp; DIR *dp;
struct dirent *de; struct dirent *de;
struct stat sbuf; struct stat sbuf;
int i, rc = 0, first = TRUE; int i, rc = 0, first = TRUE, Age;
fd_list *fdl = NULL; fd_list *fdl = NULL;
orphans *opl = NULL, *tmp; orphans *opl = NULL, *tmp;
time_t Now, Fdate;
IsDoing("Process .tic files"); IsDoing("Process .tic files");
CompileNL = FALSE; CompileNL = FALSE;
@ -152,15 +154,57 @@ int Tic()
if (CompileNL) if (CompileNL)
CreateSema((char *)"mbindex"); CreateSema((char *)"mbindex");
/*
* Handle the array with orphaned and bad crc ticfiles.
*/
Syslog('f', "start tidy_orphans()"); Syslog('f', "start tidy_orphans()");
Now = time(NULL);
for (tmp = opl; tmp; tmp = tmp->next) { for (tmp = opl; tmp; tmp = tmp->next) {
if (first) { if (first) {
Syslog('f', "TIC file TIC area Filename ORP CRC"); Syslog('f', "TIC file TIC area Filename ORP CRC DEL");
Syslog('f', "------------ -------------------- ------------ --- ---"); Syslog('f', "------------ -------------------- ------------ --- --- ---");
first = FALSE; first = FALSE;
} }
Syslog('f', "%-12s %-20s %-12s %s %s", tmp->TicName, tmp->Area, tmp->FileName, Syslog('f', "%-12s %-20s %-12s %s %s %s", tmp->TicName, tmp->Area, tmp->FileName,
tmp->Orphaned ? "Yes" : "No ", tmp->BadCRC ? "Yes" : "No "); tmp->Orphaned ? "Yes" : "No ", tmp->BadCRC ? "Yes" : "No ", tmp->Purged ? "Yes":"No ");
/*
* Bad CRC and not marked purged are real crc errors.
*/
if (tmp->BadCRC && (! tmp->Purged)) {
Syslog('+', "Moving %s and %s to badtic directory", tmp->TicName, tmp->FileName);
mover(tmp->TicName);
mover(tmp->FileName);
tic_bad++;
}
/*
* Orphans that are not marked purged are real orphans, check age.
*/
if (tmp->Orphaned && (! tmp->Purged)) {
fname = calloc(PATH_MAX, sizeof(char));
snprintf(fname, PATH_MAX, "%s/%s", inbound, tmp->TicName);
Fdate = file_time(fname);
Age = (Now - Fdate) / 84400;
if (Age > 21) {
Syslog('+', "Moving %s of %d days old to badtic", tmp->TicName, Age);
tic_bad++;
mover(tmp->TicName);
} else {
Syslog('+', "Keeping %s of %d days old for %d days", tmp->TicName, Age, 21 - Age);
}
free(fname);
}
/*
* If marked to purge, remove the ticfile
*/
if (tmp->Purged) {
fname = calloc(PATH_MAX, sizeof(char));
snprintf(fname, PATH_MAX, "%s/%s", inbound, tmp->TicName);
Syslog('+', "Removing obsolete %s", tmp->TicName);
free(fname);
}
} }
tidy_orphans(&opl); tidy_orphans(&opl);