fix position of stream terminator blob
This commit is contained in:
parent
3e6b00ad00
commit
d7bfeae6b8
1 changed files with 10 additions and 10 deletions
|
@ -86,10 +86,9 @@ class CryptStreamCreator(object):
|
||||||
self.stopped = True
|
self.stopped = True
|
||||||
if self.current_blob is not None:
|
if self.current_blob is not None:
|
||||||
self._close_current_blob()
|
self._close_current_blob()
|
||||||
self._finalize()
|
d = self._finalize()
|
||||||
dl = defer.DeferredList(self.finished_deferreds)
|
d.addCallback(lambda _: self._finished())
|
||||||
dl.addCallback(lambda _: self._finished())
|
return d
|
||||||
return dl
|
|
||||||
|
|
||||||
# TODO: move the stream creation process to its own thread and
|
# TODO: move the stream creation process to its own thread and
|
||||||
# remove the reactor from this process.
|
# remove the reactor from this process.
|
||||||
|
@ -112,6 +111,7 @@ class CryptStreamCreator(object):
|
||||||
|
|
||||||
return defer.succeed(True)
|
return defer.succeed(True)
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
def _finalize(self):
|
def _finalize(self):
|
||||||
"""
|
"""
|
||||||
Finalize a stream by adding an empty
|
Finalize a stream by adding an empty
|
||||||
|
@ -119,14 +119,14 @@ class CryptStreamCreator(object):
|
||||||
the stream has ended. This empty blob is not
|
the stream has ended. This empty blob is not
|
||||||
saved to the blob manager
|
saved to the blob manager
|
||||||
"""
|
"""
|
||||||
log.debug("_finalize has been called")
|
|
||||||
|
yield defer.DeferredList(self.finished_deferreds)
|
||||||
self.blob_count += 1
|
self.blob_count += 1
|
||||||
iv = self.iv_generator.next()
|
iv = self.iv_generator.next()
|
||||||
final_blob_creator = self.blob_manager.get_blob_creator()
|
final_blob = self._get_blob_maker(iv, self.blob_manager.get_blob_creator())
|
||||||
final_blob = self._get_blob_maker(iv, final_blob_creator)
|
stream_terminator = yield final_blob.close()
|
||||||
d = final_blob.close()
|
terminator_info = yield self._blob_finished(stream_terminator)
|
||||||
d.addCallback(self._blob_finished)
|
defer.returnValue(terminator_info)
|
||||||
self.finished_deferreds.append(d)
|
|
||||||
|
|
||||||
def _write(self, data):
|
def _write(self, data):
|
||||||
while len(data) > 0:
|
while len(data) > 0:
|
||||||
|
|
Loading…
Reference in a new issue