Merge branch 'fix-close-writer'

* fix-close-writer:
  fix BlobFile._close_file
This commit is contained in:
Alex Grintsvayg 2017-08-15 12:34:09 -04:00
commit 693eb379fd
2 changed files with 8 additions and 1 deletions

View file

@ -14,6 +14,12 @@ at anytime.
### Fixed ### Fixed
* *
* Fixed reflector server blocking the `received_blob` reply on the server announcing the blob to the dht
* Fixed non-blocking call in `BlobFile._close_writer`
* Fixed incorrect formatting of "amount" fields
* Fixed handling of SIGINT, SIGTERM.
* Fixed shutdown sequence
* Fix error when resolving an integer
* *
### Deprecated ### Deprecated

View file

@ -273,12 +273,13 @@ class BlobFile(HashBlob):
file_handle.close() file_handle.close()
self.readers -= 1 self.readers -= 1
@defer.inlineCallbacks
def _close_writer(self, writer): def _close_writer(self, writer):
if writer.write_handle is not None: if writer.write_handle is not None:
log.debug("Closing %s", str(self)) log.debug("Closing %s", str(self))
name = writer.write_handle.name name = writer.write_handle.name
writer.write_handle.close() writer.write_handle.close()
threads.deferToThread(os.remove, name) yield threads.deferToThread(os.remove, name)
writer.write_handle = None writer.write_handle = None
def _save_verified_blob(self, writer): def _save_verified_blob(self, writer):