From: Fredrik Tolf Date: Mon, 28 Jan 2008 18:38:37 +0000 (+0100) Subject: Added a dc.hidedeflate config option to disable transfer compression. X-Git-Tag: 1.1~23 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=4b5443306b321ea1e4736c8dcac53486fb23c8b2;p=doldaconnect.git Added a dc.hidedeflate config option to disable transfer compression. Note that transfer compression is still supported -- it will simply be hidden from the $Supports announcements. Buggy clients may thus still request it. --- diff --git a/daemon/fnet-dc.c b/daemon/fnet-dc.c index 3618b12..01592c6 100644 --- a/daemon/fnet-dc.c +++ b/daemon/fnet-dc.c @@ -667,10 +667,14 @@ static void sendpeerlock(struct dcpeer *peer) static void sendsupports(struct dcpeer *peer) { - if(peer->dcppemu) + if(peer->dcppemu) { qstr(peer->sk, "$Supports MiniSlots XmlBZList ADCGet TTHL TTHF GetZBlock ZLIG |"); - else - qstr(peer->sk, "$Supports MiniSlots XmlBZList ADCGet TTHL TTHF GetZBlock ZLIG|"); + } else { + qstr(peer->sk, "$Supports MiniSlots XmlBZList ADCGet TTHL TTHF"); + if(!confgetint("dc", "hidedeflate")) + qstr(peer->sk, " GetZBlock ZLIG"); + qstr(peer->sk, "|"); + } } static void requestfile(struct dcpeer *peer) @@ -832,10 +836,14 @@ static void cmd_lock(struct socket *sk, struct fnetnode *fn, char *cmd, char *ar *(p++) = 0; if(hub->extended) { - if(hub->dcppemu) + if(hub->dcppemu) { qstrf(sk, "$Supports UserCommand NoGetINFO NoHello UserIP2 TTHSearch GetZBlock |"); - else - qstrf(sk, "$Supports UserCommand NoGetINFO NoHello UserIP2 TTHSearch GetZBlock|"); + } else { + qstrf(sk, "$Supports UserCommand NoGetINFO NoHello UserIP2 TTHSearch"); + if(!confgetint("dc", "hidedeflate")) + qstr(sk, " GetZBlock"); + qstr(sk, "|"); + } } key = dcmakekey(args); qstrf(sk, "$Key %s|", key); @@ -3880,6 +3888,11 @@ static struct configvar myvars[] = * unknown commands it receives, and their arguments, to * /tmp/dc-unimpl. */ {CONF_VAR_BOOL, "logunimpl", {.num = 0}}, + /** If set to true, doldacond will hide its support for deflate + * compression of transfers from other clients, so that they will + * not request compressed uploads. Compressed transfers may + * consume a non-trivial amount of CPU time on slower machines. */ + {CONF_VAR_BOOL, "hidedeflate", {.num = 0}}, {CONF_VAR_END} };