|
From: <di...@us...> - 2010-11-29 05:52:41
|
Revision: 735
http://safekeep.svn.sourceforge.net/safekeep/?rev=735&view=rev
Author: dimi
Date: 2010-11-29 05:52:35 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
Use trickle in a more compatible way
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-29 04:56:15 UTC (rev 734)
+++ safekeep/trunk/safekeep 2010-11-29 05:52:35 UTC (rev 735)
@@ -921,33 +921,32 @@
args.extend([ionice_cmd, '-c2', '-n%s' % (ionice), '-t'])
else:
warn('ionice(1) not available, ignoring ionice.adjustment')
+
+ # handle bandwidth limiting via trickle
+ def get_bw(vals, d):
+ return vals.get(d) or vals.get('overall')
+ def get_bandwidth(cfg, d):
+ return get_bw(cfg['bw'], d) or get_bw(default_bandwidth, d)
+ trickle = []
+ limit_dl = get_bandwidth(cfg, 'download')
+ limit_ul = get_bandwidth(cfg, 'upload')
+ if limit_dl or limit_ul:
+ trickle.extend([trickle_cmd])
+ if verbosity_trickle: trickle.extend([verbosity_trickle])
+ if limit_dl:
+ trickle.extend(['-d', str(limit_dl)])
+ if limit_ul:
+ trickle.extend(['-u', str(limit_ul)])
+ if len(trickle):
+ if not try_to_run([trickle_cmd, '-V']):
+ warn('Trickle not available, bandwidth limiting disabled')
+ trickle = []
+ args.extend(trickle)
args.extend(['rdiff-backup'])
if cfg['host']:
- trickle = ''
-
- def get_bw(vals, dir):
- return vals.get(dir) or vals.get('overall')
-
- def get_bandwidth(cfg, dir):
- return get_bw(cfg['bw'], dir) or get_bw(default_bandwidth, dir)
-
- limit_dl = get_bandwidth(cfg, 'download')
- limit_ul = get_bandwidth(cfg, 'upload')
- if limit_dl or limit_ul:
- trickle = trickle_cmd + ' ' + verbosity_trickle
- if limit_dl:
- trickle += ' -d ' + str(limit_dl)
- if limit_ul:
- trickle += ' -u ' + str(limit_ul)
-
- if trickle:
- if not try_to_run(trickle_cmd + ' -V'):
- warn('Trickle not available, bandwidth limiting disabled')
- trickle = ''
-
- schema = '%s ssh %s -i %s %%s rdiff-backup --server' % (trickle, verbosity_ssh, cfg['key_data'])
+ schema = 'ssh %s -i %s %%s rdiff-backup --server' % (verbosity_ssh, cfg['key_data'])
args.extend(['--remote-schema', schema])
if force:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|