From: Brian Warner Date: Tue, 28 Apr 2015 18:03:12 +0000 (-0700) Subject: control.py: minor improvements X-Git-Tag: allmydata-tahoe-1.10.1a1~27 X-Git-Url: https://git.rkrishnan.org/simplejson/components/flags//%22%3C?a=commitdiff_plain;h=341e263e0371b7d2157353aebd02af5cd1a54b0f;p=tahoe-lafs%2Ftahoe-lafs.git control.py: minor improvements refs ticket:1737 --- diff --git a/src/allmydata/control.py b/src/allmydata/control.py index a78daf62..7bd8eeda 100644 --- a/src/allmydata/control.py +++ b/src/allmydata/control.py @@ -61,7 +61,8 @@ class ControlServer(Referenceable, service.Service): return self.parent.debug_wait_for_client_connections(num_clients) def remote_upload_random_data_from_file(self, size, convergence): - filename = tempfile.NamedTemporaryFile(delete=False).name + tempdir = tempfile.mkdtemp() + filename = os.path.join(tempdir, "data") f = open(filename, "wb") block = "a" * 8192 while size > 0: @@ -75,6 +76,7 @@ class ControlServer(Referenceable, service.Service): d.addCallback(lambda results: results.get_uri()) def _done(uri): os.remove(filename) + os.rmdir(tempdir) return uri d.addCallback(_done) return d