Updated hydra compression
This commit is contained in:
parent
933b73246f
commit
7663668592
@ -25,6 +25,8 @@ v0.39.0 09-Oct-2003
|
|||||||
mailers that don't support this option. The compression will
|
mailers that don't support this option. The compression will
|
||||||
transfer some files about twice as fast as without compression.
|
transfer some files about twice as fast as without compression.
|
||||||
Changed signal handlers to better detect broken TCP links.
|
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:
|
lang:
|
||||||
Added language prompt 20.
|
Added language prompt 20.
|
||||||
|
20
configure
vendored
20
configure
vendored
@ -4262,9 +4262,9 @@ done
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$as_me:$LINENO: checking for compress in -lz" >&5
|
echo "$as_me:$LINENO: checking for compress2 in -lz" >&5
|
||||||
echo $ECHO_N "checking for compress in -lz... $ECHO_C" >&6
|
echo $ECHO_N "checking for compress2 in -lz... $ECHO_C" >&6
|
||||||
if test "${ac_cv_lib_z_compress+set}" = set; then
|
if test "${ac_cv_lib_z_compress2+set}" = set; then
|
||||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
else
|
else
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
@ -4283,11 +4283,11 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
/* We use char because int might match the return type of a gcc2
|
/* We use char because int might match the return type of a gcc2
|
||||||
builtin and then its argument prototype would still apply. */
|
builtin and then its argument prototype would still apply. */
|
||||||
char compress ();
|
char compress2 ();
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
compress ();
|
compress2 ();
|
||||||
;
|
;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4304,19 +4304,19 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
|||||||
ac_status=$?
|
ac_status=$?
|
||||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
(exit $ac_status); }; }; then
|
(exit $ac_status); }; }; then
|
||||||
ac_cv_lib_z_compress=yes
|
ac_cv_lib_z_compress2=yes
|
||||||
else
|
else
|
||||||
echo "$as_me: failed program was:" >&5
|
echo "$as_me: failed program was:" >&5
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
ac_cv_lib_z_compress=no
|
ac_cv_lib_z_compress2=no
|
||||||
fi
|
fi
|
||||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||||
LIBS=$ac_check_lib_save_LIBS
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
fi
|
fi
|
||||||
echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress" >&5
|
echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress2" >&5
|
||||||
echo "${ECHO_T}$ac_cv_lib_z_compress" >&6
|
echo "${ECHO_T}$ac_cv_lib_z_compress2" >&6
|
||||||
if test $ac_cv_lib_z_compress = yes; then
|
if test $ac_cv_lib_z_compress2 = yes; then
|
||||||
result=yes
|
result=yes
|
||||||
else
|
else
|
||||||
result=no
|
result=no
|
||||||
|
@ -123,7 +123,7 @@ if test "$result" = "yes"; then
|
|||||||
AC_CHECK_HEADERS(sys/types.h)
|
AC_CHECK_HEADERS(sys/types.h)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_LIB(z,compress,result=yes,result=no)
|
AC_CHECK_LIB(z,compress2,result=yes,result=no)
|
||||||
if test "$result" = "yes"; then
|
if test "$result" = "yes"; then
|
||||||
LIBS="$LIBS -lz"
|
LIBS="$LIBS -lz"
|
||||||
AC_CHECK_HEADERS(zlib.h)
|
AC_CHECK_HEADERS(zlib.h)
|
||||||
|
@ -560,11 +560,12 @@ int hydra_batch(int role, file_list *to_send)
|
|||||||
struct timeval rxstarttime, rxendtime;
|
struct timeval rxstarttime, rxendtime;
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
int sverr;
|
int sverr;
|
||||||
int rcz;
|
int rcz, txcompressed;
|
||||||
|
|
||||||
Syslog('h', "Hydra: resettimers");
|
Syslog('h', "Hydra: resettimers");
|
||||||
RESETTIMERS();
|
RESETTIMERS();
|
||||||
|
|
||||||
|
txcompressed = 0;
|
||||||
txpos = rxpos = 0;
|
txpos = rxpos = 0;
|
||||||
stxpos = srxpos = 0;
|
stxpos = srxpos = 0;
|
||||||
txretries = rxretries = 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: 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -900,6 +903,7 @@ int hydra_batch(int role, file_list *to_send)
|
|||||||
txlen = 1;
|
txlen = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txcompressed = 0;
|
||||||
hytxpkt(HPKT_FINFO, txbuf, txlen);
|
hytxpkt(HPKT_FINFO, txbuf, txlen);
|
||||||
|
|
||||||
if (txretries > 0) {
|
if (txretries > 0) {
|
||||||
@ -1013,11 +1017,12 @@ int hydra_batch(int role, file_list *to_send)
|
|||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
if ((txoptions & HOPT_CANPLZ) && (txretries == 0)) {
|
if ((txoptions & HOPT_CANPLZ) && (txretries == 0)) {
|
||||||
txzlen = H_ZIPBUFLEN - 4;
|
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) {
|
if (rcz == Z_OK) {
|
||||||
Syslog('h', "Compressed OK, srclen=%d, destlen=%d, will send compressed=%s", txlen, txzlen,
|
Syslog('h', "Compressed OK, srclen=%d, destlen=%d, will send compressed=%s", txlen, txzlen,
|
||||||
(txzlen < txlen) ?"yes":"no");
|
(txzlen < txlen) ?"yes":"no");
|
||||||
if (txzlen < txlen) {
|
if (txzlen < txlen) {
|
||||||
|
txcompressed += (txlen - txzlen);
|
||||||
put_long(txzbuf, txpos);
|
put_long(txzbuf, txpos);
|
||||||
txpos += txlen;
|
txpos += txlen;
|
||||||
sentbytes += txlen;
|
sentbytes += txlen;
|
||||||
|
Reference in New Issue
Block a user