]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
control.py: minor improvements
authorBrian Warner <warner@lothar.com>
Tue, 28 Apr 2015 18:03:12 +0000 (11:03 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 28 Apr 2015 18:03:12 +0000 (11:03 -0700)
refs ticket:1737

src/allmydata/control.py

index a78daf62fe3f391f7c31d4ba2e00b73ebd8376a0..7bd8eedab13f68dbe27312ae251fefe76106ab5d 100644 (file)
@@ -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