Finished Hydra PLZ option

This commit is contained in:
Michiel Broek 2003-11-03 13:52:25 +00:00
parent 8cd6e1d297
commit 2cfdaeea33
4 changed files with 15 additions and 3 deletions

View File

@ -25,6 +25,7 @@ v0.39.1 22-Oct-2003
mbcico: mbcico:
Added hydra rpos id -1 indicator for compression stop that Added hydra rpos id -1 indicator for compression stop that
Alex and I agreed to use. Alex and I agreed to use.
Compression log fixed and added percentage compression.
mbsetup: mbsetup:
In node editor, fixed error message when there was no more In node editor, fixed error message when there was no more

View File

@ -563,3 +563,13 @@ char *transfertime(struct timeval start, struct timeval end, long bytes, int sen
} }
char *compress_stat(long original, long saved)
{
static char resp[81];
sprintf(resp, "compressed %ld bytes, compression %0.1f%%", saved, ((saved * 100.0) / original));
return resp;
}

View File

@ -10,6 +10,7 @@ file_list *create_freqlist(fa_list *);
void tidy_filelist(file_list *, int); void tidy_filelist(file_list *, int);
void execute_disposition(file_list *); void execute_disposition(file_list *);
char *transfertime(struct timeval, struct timeval, long, int); char *transfertime(struct timeval, struct timeval, long, int);
char *compress_stat(long, long);
#endif #endif

View File

@ -864,8 +864,6 @@ int hydra_batch(int role, file_list *to_send)
Syslog('+', "Hydra: send \"%s\" as \"%s\"", MBSE_SS(to_send->local), MBSE_SS(to_send->remote)); Syslog('+', "Hydra: send \"%s\" as \"%s\"", MBSE_SS(to_send->local), MBSE_SS(to_send->remote));
Syslog('+', "Hydra: size %lu bytes, dated %s",(unsigned long)txstat.st_size, date(txstat.st_mtime)); Syslog('+', "Hydra: size %lu bytes, dated %s",(unsigned long)txstat.st_size, date(txstat.st_mtime));
if (txcompressed)
Syslog('+', "Hydra: saved by compression %d bytes", txcompressed);
gettimeofday(&txstarttime, &tz); gettimeofday(&txstarttime, &tz);
} }
@ -1195,6 +1193,8 @@ int hydra_batch(int role, file_list *to_send)
if (txpos >= 0) { if (txpos >= 0) {
stxpos = txpos - stxpos; stxpos = txpos - stxpos;
if (txcompressed && (compstate != HCMP_NONE))
Syslog('+', "Hydra: %s", compress_stat(stxpos, txcompressed));
Syslog('+', "Hydra: OK %s", transfertime(txstarttime, txendtime, stxpos, TRUE)); Syslog('+', "Hydra: OK %s", transfertime(txstarttime, txendtime, stxpos, TRUE));
execute_disposition(to_send); execute_disposition(to_send);
} else { } else {
@ -1642,7 +1642,7 @@ int hydra_batch(int role, file_list *to_send)
* mode we should send ID -1 to instruct the remote to * mode we should send ID -1 to instruct the remote to
* stop compression mode. * stop compression mode.
*/ */
if ((compstate != HCMP_NONE) && (rxctries > 4)) { if ((compstate != HCMP_NONE) && (rxctries > 2)) {
Syslog('+', "Hydra: too much compress errors, instructing remote to stop compression"); Syslog('+', "Hydra: too much compress errors, instructing remote to stop compression");
put_long(txbuf + 8, (long)-1L); put_long(txbuf + 8, (long)-1L);
} else { } else {