Updated hydra compression

This commit is contained in:
Michiel Broek 2003-10-17 18:51:28 +00:00
parent 933b73246f
commit 7663668592
4 changed files with 20 additions and 13 deletions

View File

@ -25,6 +25,8 @@ v0.39.0 09-Oct-2003
mailers that don't support this option. The compression will
transfer some files about twice as fast as without compression.
Changed signal handlers to better detect broken TCP links.
Added logging to show compressed bytes and switched to compress
level 9 compression instead of 6.
lang:
Added language prompt 20.

20
configure vendored
View File

@ -4262,9 +4262,9 @@ done
fi
echo "$as_me:$LINENO: checking for compress in -lz" >&5
echo $ECHO_N "checking for compress in -lz... $ECHO_C" >&6
if test "${ac_cv_lib_z_compress+set}" = set; then
echo "$as_me:$LINENO: checking for compress2 in -lz" >&5
echo $ECHO_N "checking for compress2 in -lz... $ECHO_C" >&6
if test "${ac_cv_lib_z_compress2+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
@ -4283,11 +4283,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char compress ();
char compress2 ();
int
main ()
{
compress ();
compress2 ();
;
return 0;
}
@ -4304,19 +4304,19 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_z_compress=yes
ac_cv_lib_z_compress2=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_z_compress=no
ac_cv_lib_z_compress2=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress" >&5
echo "${ECHO_T}$ac_cv_lib_z_compress" >&6
if test $ac_cv_lib_z_compress = yes; then
echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress2" >&5
echo "${ECHO_T}$ac_cv_lib_z_compress2" >&6
if test $ac_cv_lib_z_compress2 = yes; then
result=yes
else
result=no

View File

@ -123,7 +123,7 @@ if test "$result" = "yes"; then
AC_CHECK_HEADERS(sys/types.h)
fi
AC_CHECK_LIB(z,compress,result=yes,result=no)
AC_CHECK_LIB(z,compress2,result=yes,result=no)
if test "$result" = "yes"; then
LIBS="$LIBS -lz"
AC_CHECK_HEADERS(zlib.h)

View File

@ -560,11 +560,12 @@ int hydra_batch(int role, file_list *to_send)
struct timeval rxstarttime, rxendtime;
struct timezone tz;
int sverr;
int rcz;
int rcz, txcompressed;
Syslog('h', "Hydra: resettimers");
RESETTIMERS();
txcompressed = 0;
txpos = rxpos = 0;
stxpos = srxpos = 0;
txretries = rxretries = 0;
@ -852,6 +853,8 @@ 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: 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);
}
@ -900,6 +903,7 @@ int hydra_batch(int role, file_list *to_send)
txlen = 1;
}
txcompressed = 0;
hytxpkt(HPKT_FINFO, txbuf, txlen);
if (txretries > 0) {
@ -1013,11 +1017,12 @@ int hydra_batch(int role, file_list *to_send)
#ifdef HAVE_ZLIB_H
if ((txoptions & HOPT_CANPLZ) && (txretries == 0)) {
txzlen = H_ZIPBUFLEN - 4;
rcz = compress(txzbuf + 4, &txzlen, txbuf + 4, txlen);
rcz = compress2(txzbuf + 4, &txzlen, txbuf + 4, txlen, 9);
if (rcz == Z_OK) {
Syslog('h', "Compressed OK, srclen=%d, destlen=%d, will send compressed=%s", txlen, txzlen,
(txzlen < txlen) ?"yes":"no");
if (txzlen < txlen) {
txcompressed += (txlen - txzlen);
put_long(txzbuf, txpos);
txpos += txlen;
sentbytes += txlen;