removed useless check. Faster sender speed
This commit is contained in:
parent
14a49dcf25
commit
d9e95eceeb
|
@ -253,18 +253,19 @@ running instance of Gajim. \nFile Transfer will be canceled.\n==================
|
||||||
result = sender.get_file_contents(0)
|
result = sender.get_file_contents(0)
|
||||||
self.process_result(result, sender)
|
self.process_result(result, sender)
|
||||||
elif sender.state == 7:
|
elif sender.state == 7:
|
||||||
if sender.file_props['paused']:
|
while(True):
|
||||||
break
|
if sender.file_props['paused']:
|
||||||
if not sender.connected:
|
break
|
||||||
self.process_result(-1, sender)
|
if not sender.connected:
|
||||||
break
|
self.process_result(-1, sender)
|
||||||
if sender.state == 8:
|
break
|
||||||
self.remove_sender(idx)
|
if sender.state == 8:
|
||||||
break
|
self.remove_sender(idx)
|
||||||
result = sender.write_next()
|
break
|
||||||
self.process_result(result, sender)
|
result = sender.write_next()
|
||||||
if sender.file_props['stalled']:
|
self.process_result(result, sender)
|
||||||
break
|
if result <= 0:
|
||||||
|
break
|
||||||
elif sender.state == 8:
|
elif sender.state == 8:
|
||||||
self.remove_sender(idx)
|
self.remove_sender(idx)
|
||||||
else:
|
else:
|
||||||
|
@ -414,10 +415,7 @@ class Socks5:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
return len(raw_data)
|
return len(raw_data)
|
||||||
|
|
||||||
def write_next(self, initial = False):
|
def write_next(self):
|
||||||
if initial:
|
|
||||||
self.state = 7
|
|
||||||
return 1
|
|
||||||
if self.remaining_buff != '':
|
if self.remaining_buff != '':
|
||||||
buff = self.remaining_buff
|
buff = self.remaining_buff
|
||||||
self.remaining_buff = ''
|
self.remaining_buff = ''
|
||||||
|
@ -508,7 +506,13 @@ class Socks5:
|
||||||
self.file_props['last-time']
|
self.file_props['last-time']
|
||||||
self.file_props['last-time'] = current_time
|
self.file_props['last-time'] = current_time
|
||||||
self.file_props['received-len'] += len(buff)
|
self.file_props['received-len'] += len(buff)
|
||||||
fd.write(buff)
|
try:
|
||||||
|
fd.write(buff)
|
||||||
|
except IOError, e:
|
||||||
|
self.rem_fd(fd)
|
||||||
|
self.disconnect(False)
|
||||||
|
self.file_props['error'] = -6 # file system error
|
||||||
|
return 0
|
||||||
if len(buff) == 0 and first_byte is False:
|
if len(buff) == 0 and first_byte is False:
|
||||||
# Transfer stopped somehow:
|
# Transfer stopped somehow:
|
||||||
# reset, paused or network error
|
# reset, paused or network error
|
||||||
|
@ -669,7 +673,8 @@ class Socks5Sender(Socks5):
|
||||||
self.file_props['last-time'] = time.time()
|
self.file_props['last-time'] = time.time()
|
||||||
self.file_props['received-len'] = 0
|
self.file_props['received-len'] = 0
|
||||||
self.pauses = 0
|
self.pauses = 0
|
||||||
return self.write_next(initial = True) # initial for nl byte
|
self.state = 7
|
||||||
|
return self.write_next() # initial for nl byte
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
''' initial requests for verifying the connection '''
|
''' initial requests for verifying the connection '''
|
||||||
|
|
Loading…
Reference in New Issue