core, plugins file, XEP-0234, bridge: progression api enhancement:

- progressStarted have a new metadata parameter, useful to know the kind of progression, direction, etc. Check bridge doc
    - progressGetAllMetadata can be used to retrieve this data and discover on currently running progressions
    - progressFinished also have a new metadata parameter, used to e.g. indicate that hash is checked
    - core: fixed progressGetAll
    - file, XEP-0234: implemented the API modifications,  hash is returned on progressFinished
    - file: SatFile.checkSize allows to check size independently of close (be sure that all the data have been transfered though)
This commit is contained in:
Goffi 2015-11-19 18:13:26 +01:00
commit 55c75bc304

View file

@ -283,11 +283,21 @@ class XEP_0234(object):
if hash_ == hash_given:
log.info(u"Hash checked, file was successfully transfered: {}".format(hash_))
progress_metadata = {'hash': hash_,
'hash_algo': file_data['hash_algo'],
'hash_verified': C.BOOL_TRUE
}
error = None
else:
log.warning(u"Hash mismatch, the file was not transfered correctly")
progress_metadata=None
error = u"Hash mismatch: given={algo}:{given}, calculated={algo}:{our}".format(
algo = file_data['hash_algo'],
given = hash_given,
our = hash_)
self._j.delayedContentTerminate(session, content_name, profile=profile)
content_data['file_obj'].close()
content_data['file_obj'].close(progress_metadata, error)
# we may have the last_try timer still active, so we try to cancel it
try:
content_data['last_try_timer'].cancel()