#1735 don't stop completed transfer
This commit is contained in:
parent
b6038f7a0f
commit
1f85960c64
|
@ -54,6 +54,17 @@ class ConnectionBytestream:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.files_props = {}
|
self.files_props = {}
|
||||||
|
|
||||||
|
def is_transfer_stoped(self, file_props):
|
||||||
|
if file_props.has_key('error') and file_props['error'] != 0:
|
||||||
|
return True
|
||||||
|
if file_props.has_key('completed') and file_props['completed']:
|
||||||
|
return True
|
||||||
|
if file_props.has_key('connected') and file_props['connected'] == False:
|
||||||
|
return True
|
||||||
|
if not file_props.has_key('stopped') or not file_props['stopped']:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def send_success_connect_reply(self, streamhost):
|
def send_success_connect_reply(self, streamhost):
|
||||||
''' send reply to the initiator of FT that we
|
''' send reply to the initiator of FT that we
|
||||||
made a connection
|
made a connection
|
||||||
|
@ -72,6 +83,8 @@ class ConnectionBytestream:
|
||||||
def remove_transfers_for_contact(self, contact):
|
def remove_transfers_for_contact(self, contact):
|
||||||
''' stop all active transfer for contact '''
|
''' stop all active transfer for contact '''
|
||||||
for file_props in self.files_props.values():
|
for file_props in self.files_props.values():
|
||||||
|
if self.is_transfer_stoped(file_props):
|
||||||
|
continue
|
||||||
receiver_jid = unicode(file_props['receiver']).split('/')[0]
|
receiver_jid = unicode(file_props['receiver']).split('/')[0]
|
||||||
if contact.jid == receiver_jid:
|
if contact.jid == receiver_jid:
|
||||||
file_props['error'] = -5
|
file_props['error'] = -5
|
||||||
|
|
Loading…
Reference in New Issue