Fixes for binkp for deleted files

This commit is contained in:
Michiel Broek 2004-07-16 14:51:07 +00:00
parent 3e959e206c
commit c9b127a5d8
2 changed files with 45 additions and 21 deletions

View File

@ -1,5 +1,6 @@
$Id$ $Id$
DE CRONTAB STAAT UIT !!!!
v0.61.2 11-Jul-2004 v0.61.2 11-Jul-2004
@ -22,6 +23,15 @@ v0.61.2 11-Jul-2004
with other mailers. Russell?? with other mailers. Russell??
If you only use mbcico there will be no problems. If you only use mbcico there will be no problems.
mbcico:
In the binkp driver, when files were found to transmit and
didn't exist anymore, they are not added to the list of files
to sent but are marked as already transmitted so they will
be removed from the .flo file. Also, after a successfull
session .flo files with all files marked as transmitted are
removed. With nodes that were marked crash, this will prevent
continuous calling.
mbout: mbout:
Changed to use direct instead of immediate mail. Changed to use direct instead of immediate mail.

View File

@ -192,7 +192,7 @@ char *binkp2unix(char *); /* Unix -> Binkp escape */
void fill_binkp_list(binkp_list **, file_list *, off_t); /* Build pending files */ void fill_binkp_list(binkp_list **, file_list *, off_t); /* Build pending files */
void debug_binkp_list(binkp_list **); /* Debug pending files list */ void debug_binkp_list(binkp_list **); /* Debug pending files list */
int binkp_pendingfiles(void); /* Count pending files */ int binkp_pendingfiles(void); /* Count pending files */
void binkp_clear_filelist(void); /* Clear current filelist */ void binkp_clear_filelist(int); /* Clear current filelist */
static int orgbinkp(void); /* Originate session state */ static int orgbinkp(void); /* Originate session state */
static int ansbinkp(void); /* Answer session state */ static int ansbinkp(void); /* Answer session state */
@ -959,7 +959,7 @@ int file_transfer(void)
case DeinitTransfer:/* case DeinitTransfer:/*
* In case of a transfer error the filelist is not yet cleared * In case of a transfer error the filelist is not yet cleared
*/ */
binkp_clear_filelist(); binkp_clear_filelist(bp.rc);
if (bp.rc) if (bp.rc)
return MBERR_FTRANSFER; return MBERR_FTRANSFER;
else else
@ -1033,7 +1033,7 @@ TrType binkp_receiver(void)
bp.TxState = TxGNF; bp.TxState = TxGNF;
bp.RxState = RxWaitF; bp.RxState = RxWaitF;
Syslog('+', "Binkp: receiver starts batch %d", bp.batchnr + 1); Syslog('+', "Binkp: receiver starts batch %d", bp.batchnr + 1);
binkp_clear_filelist(); binkp_clear_filelist(0);
return Ok; return Ok;
} }
} else { } else {
@ -1494,7 +1494,7 @@ TrType binkp_transmitter(void)
bp.RxState = RxDone; bp.RxState = RxDone;
} }
binkp_clear_filelist(); binkp_clear_filelist(rc);
return Ok; return Ok;
} }
@ -1531,12 +1531,12 @@ TrType binkp_transmitter(void)
bp.TxState = TxGNF; bp.TxState = TxGNF;
bp.RxState = RxWaitF; bp.RxState = RxWaitF;
Syslog('+', "Binkp: transmitter starts batch %d", bp.batchnr + 1); Syslog('+', "Binkp: transmitter starts batch %d", bp.batchnr + 1);
binkp_clear_filelist(); binkp_clear_filelist(rc);
return Ok; /* Continue is not good here, troubles with binkd on slow links. */ return Ok; /* Continue is not good here, troubles with binkd on slow links. */
} }
} }
binkp_clear_filelist(); binkp_clear_filelist(rc);
return Ok; return Ok;
} }
} }
@ -2254,8 +2254,8 @@ int binkp_resync(off_t off)
/* /*
* * Translate string to binkp escaped string, unsafe characters are escaped. * Translate string to binkp escaped string, unsafe characters are escaped.
* */ */
char *unix2binkp(char *fn) char *unix2binkp(char *fn)
{ {
static char buf[PATH_MAX]; static char buf[PATH_MAX];
@ -2288,8 +2288,8 @@ char *unix2binkp(char *fn)
/* /*
* * Translate escaped binkp string to normal string. * Translate escaped binkp string to normal string.
* */ */
char *binkp2unix(char *fn) char *binkp2unix(char *fn)
{ {
static char buf[PATH_MAX]; static char buf[PATH_MAX];
@ -2345,22 +2345,28 @@ char *binkp2unix(char *fn)
void fill_binkp_list(binkp_list **bkll, file_list *fal, off_t offs) void fill_binkp_list(binkp_list **bkll, file_list *fal, off_t offs)
{ {
binkp_list **tmpl; binkp_list **tmpl;
FILE *fp;
struct stat tstat; struct stat tstat;
if (stat(fal->local, &tstat) != 0) {
Syslog('+', "$Binkp: can't add %s to sendlist", fal->local);
return;
}
if (strstr(fal->remote, (char *)".pkt"))
bp.nethold += tstat.st_size;
else
bp.mailhold += tstat.st_size;
for (tmpl = bkll; *tmpl; tmpl = &((*tmpl)->next)); for (tmpl = bkll; *tmpl; tmpl = &((*tmpl)->next));
*tmpl = (binkp_list *)malloc(sizeof(binkp_list)); *tmpl = (binkp_list *)malloc(sizeof(binkp_list));
(*tmpl)->next = NULL; (*tmpl)->next = NULL;
(*tmpl)->state = NoState; (*tmpl)->state = NoState;
if ((fp = fopen(fal->local, "r")) == NULL) {
if ((errno == ENOENT) || (errno == EINVAL)) {
Syslog('+', "Binkp: file %s doesn't exist, removing", MBSE_SS(fal->local));
(*tmpl)->state = Got;
execute_disposition(fal);
}
} else {
fclose(fp);
stat(fal->local, &tstat);
if (strstr(fal->remote, (char *)".pkt"))
bp.nethold += tstat.st_size;
else
bp.mailhold += tstat.st_size;
}
(*tmpl)->get = FALSE; (*tmpl)->get = FALSE;
(*tmpl)->local = xstrcpy(fal->local); (*tmpl)->local = xstrcpy(fal->local);
(*tmpl)->remote = xstrcpy(unix2binkp(fal->remote)); (*tmpl)->remote = xstrcpy(unix2binkp(fal->remote));
@ -2371,7 +2377,6 @@ void fill_binkp_list(binkp_list **bkll, file_list *fal, off_t offs)
void debug_binkp_list(binkp_list **bkll) void debug_binkp_list(binkp_list **bkll)
{ {
#ifdef USE_NEWBINKP #ifdef USE_NEWBINKP
@ -2389,9 +2394,10 @@ void debug_binkp_list(binkp_list **bkll)
/* /*
* Clear current filelist * Clear current filelist
*/ */
void binkp_clear_filelist(void) void binkp_clear_filelist(int rc)
{ {
binkp_list *tmp; binkp_list *tmp;
file_list *fal;
if (tosend != NULL) { if (tosend != NULL) {
Syslog('b', "Binkp: clear current filelist"); Syslog('b', "Binkp: clear current filelist");
@ -2405,6 +2411,14 @@ void binkp_clear_filelist(void)
free(bll); free(bll);
} }
/* WARNING: Added 16-07-2004 to see if this is safe to clean /flo files.
*
* Remove sent fake files like .spl and .flo
*/
for (fal = tosend; fal; fal = fal->next) {
if ((fal->remote == NULL) && (rc == 0))
execute_disposition(fal);
}
tidy_filelist(tosend, TRUE); tidy_filelist(tosend, TRUE);
tosend = NULL; tosend = NULL;
respond = NULL; respond = NULL;