From: robk-tahoe Date: Fri, 18 Jan 2008 00:36:28 +0000 (-0700) Subject: offloaded: close reader before removing its file X-Git-Tag: allmydata-tahoe-0.8.0~294 X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/class-simplejson.JSONEncoder-index.html?a=commitdiff_plain;h=46154beace3d53f85b10971c46fef0782af2521e;p=tahoe-lafs%2Ftahoe-lafs.git offloaded: close reader before removing its file unlinking a file before closing it is not portable. it works on unix, but fails since an open file holds a lock on windows. this closes the reader before trying to unlink the encoding file within the CHKUploadHelper. --- diff --git a/src/allmydata/offloaded.py b/src/allmydata/offloaded.py index 9f1966c1..66b7fbc7 100644 --- a/src/allmydata/offloaded.py +++ b/src/allmydata/offloaded.py @@ -92,6 +92,7 @@ class CHKUploadHelper(Referenceable, upload.CHKUploader): def _finished(self, res): (uri_extension_hash, needed_shares, total_shares, size) = res upload_results = {'uri_extension_hash': uri_extension_hash} + self._reader.close() os.unlink(self._encoding_file) self._finished_observers.fire(upload_results) self._helper.upload_finished(self._storage_index)