only compare file hashes when we actually have a hash

This commit is contained in:
Jefry Lagrange 2012-10-13 14:31:16 -04:00
parent 8da4e91134
commit d3048a0ac7
3 changed files with 4 additions and 3 deletions

View File

@ -184,7 +184,8 @@ class JingleFileTransfer(JingleContent):
self.file_props.streamhosts = self.transport.remote_candidates
# Calculate file hash in a new thread
# if we haven't sent the hash already.
if self.file_props.hash_ is None and self.file_props.algo:
if self.file_props.hash_ is None and self.file_props.algo and \
not self.werequest:
self.hashThread = threading.Thread(target=self.__send_hash)
self.hashThread.start()
for host in self.file_props.streamhosts:

View File

@ -660,7 +660,7 @@ class FileTransfersWindow:
if transfered_size == full_size:
# If we are receiver and this is a jingle session
if file_props.type_ == 'r' and \
file_props.session_type == 'jingle':
file_props.session_type == 'jingle' and file_props.hash_:
# Show that we are computing the hash
self.set_status(file_props, 'computing')
else:

View File

@ -985,7 +985,7 @@ class Interface:
if file_props.stalled or file_props.paused:
return
if file_props.type_ == 'r': # we receive a file
if file_props.type_ == 'r' and file_props.hash_: # we receive a file
# we compare hashes
if file_props.session_type == 'jingle':
# Compare hashes in a new thread