add connect timeout and reconnect to
some other streamhosts when already established connection has failed
This commit is contained in:
parent
19ee5917bf
commit
29ab60eaa7
|
@ -39,6 +39,13 @@ from errno import EINTR
|
||||||
from xmpp.idlequeue import IdleObject
|
from xmpp.idlequeue import IdleObject
|
||||||
MAX_BUFF_LEN = 65536
|
MAX_BUFF_LEN = 65536
|
||||||
|
|
||||||
|
# after foo seconds without activity label transfer as 'stalled'
|
||||||
|
STALLED_TIMEOUT = 10
|
||||||
|
|
||||||
|
# after foo seconds of waiting to connect, disconnect from
|
||||||
|
# streamhost and try next one
|
||||||
|
CONNECT_TIMEOUT = 10
|
||||||
|
|
||||||
class SocksQueue:
|
class SocksQueue:
|
||||||
''' queue for all file requests objects '''
|
''' queue for all file requests objects '''
|
||||||
def __init__(self, idlequeue, complete_transfer_cb = None, progress_transfer_cb = None):
|
def __init__(self, idlequeue, complete_transfer_cb = None, progress_transfer_cb = None):
|
||||||
|
@ -58,6 +65,9 @@ class SocksQueue:
|
||||||
self.on_failure = None
|
self.on_failure = None
|
||||||
|
|
||||||
def start_listener(self, host, port, sha_str, sha_handler, sid):
|
def start_listener(self, host, port, sha_str, sha_handler, sid):
|
||||||
|
''' start waiting for incomming connections on (host, port)
|
||||||
|
and do a socks5 authentication using sid for generated sha
|
||||||
|
'''
|
||||||
self.sha_handlers[sha_str] = (sha_handler, sid)
|
self.sha_handlers[sha_str] = (sha_handler, sid)
|
||||||
if self.listener == None:
|
if self.listener == None:
|
||||||
self.listener = Socks5Listener(self.idlequeue, host, port)
|
self.listener = Socks5Listener(self.idlequeue, host, port)
|
||||||
|
@ -97,12 +107,7 @@ class SocksQueue:
|
||||||
on_failure = None):
|
on_failure = None):
|
||||||
self.on_success = on_success
|
self.on_success = on_success
|
||||||
self.on_failure = on_failure
|
self.on_failure = on_failure
|
||||||
if not self.files_props.has_key(account):
|
file_props = self.files_props[account][sid]
|
||||||
pass
|
|
||||||
# FIXME ---- show error dialog
|
|
||||||
else:
|
|
||||||
file_props = self.files_props[account][sid]
|
|
||||||
file_props['success_cb'] = on_success
|
|
||||||
file_props['failure_cb'] = on_failure
|
file_props['failure_cb'] = on_failure
|
||||||
|
|
||||||
# add streamhosts to the queue
|
# add streamhosts to the queue
|
||||||
|
@ -112,27 +117,71 @@ class SocksQueue:
|
||||||
streamhost['idx'] = receiver.queue_idx
|
streamhost['idx'] = receiver.queue_idx
|
||||||
|
|
||||||
def _socket_connected(self, streamhost, file_props):
|
def _socket_connected(self, streamhost, file_props):
|
||||||
|
''' called when there is a host connected to one of the
|
||||||
|
senders's streamhosts. Stop othere attempts for connections '''
|
||||||
for host in file_props['streamhosts']:
|
for host in file_props['streamhosts']:
|
||||||
if host != streamhost and host.has_key('idx'):
|
if host != streamhost and host.has_key('idx'):
|
||||||
if host['state'] == 1:
|
if host['state'] == 1:
|
||||||
|
# remove current
|
||||||
self.remove_receiver(streamhost['idx'])
|
self.remove_receiver(streamhost['idx'])
|
||||||
return
|
return
|
||||||
else:
|
# set state -2, meaning that this streamhost is stopped,
|
||||||
host['state'] = -1
|
# but it may be connectected later
|
||||||
self.remove_receiver(host['idx'])
|
if host['state'] >=0:
|
||||||
|
self.remove_receiver(host['idx'])
|
||||||
|
host['idx'] = -1
|
||||||
|
host['state'] = -2
|
||||||
|
|
||||||
|
def reconnect_receiver(self, receiver, streamhost):
|
||||||
|
''' Check the state of all streamhosts and if all has failed, then
|
||||||
|
emit connection failure cb. If there are some which are still
|
||||||
|
not connected try to establish connection to one of them.
|
||||||
|
'''
|
||||||
|
self.idlequeue.remove_timeout(receiver.fd)
|
||||||
|
self.idlequeue.unplug_idle(receiver.fd)
|
||||||
|
file_props = receiver.file_props
|
||||||
|
streamhost['state'] = -1
|
||||||
|
# boolean, indicates that there are hosts, which are not tested yet
|
||||||
|
unused_hosts = False
|
||||||
|
for host in file_props['streamhosts']:
|
||||||
|
if host.has_key('idx'):
|
||||||
|
if host['state'] >= 0:
|
||||||
|
return
|
||||||
|
elif host['state'] == -2:
|
||||||
|
unused_hosts = True
|
||||||
|
if unused_hosts:
|
||||||
|
for host in file_props['streamhosts']:
|
||||||
|
if host['state'] == -2:
|
||||||
|
host['state'] = 0
|
||||||
|
receiver = Socks5Receiver(self.idlequeue, host, host['sid'], file_props)
|
||||||
|
self.add_receiver(receiver.account, receiver)
|
||||||
|
host['idx'] = receiver.queue_idx
|
||||||
|
# we still have chances to connect
|
||||||
|
return
|
||||||
|
if not file_props.has_key('received-len') or file_props['received-len'] == 0:
|
||||||
|
# there are no other streamhosts and transfer hasn't started
|
||||||
|
self._connection_refused(streamhost, file_props, receiver.queue_idx)
|
||||||
|
else:
|
||||||
|
# transfer stopped, it is most likely stopped from sender
|
||||||
|
receiver.disconnect()
|
||||||
|
file_props['error'] = -1
|
||||||
|
self.process_result(-1, receiver)
|
||||||
|
|
||||||
def _connection_refused(self, streamhost, file_props, idx):
|
def _connection_refused(self, streamhost, file_props, idx):
|
||||||
|
''' cb, called when we loose connection during transfer'''
|
||||||
if file_props is None:
|
if file_props is None:
|
||||||
return
|
return
|
||||||
streamhost['state'] = -1
|
streamhost['state'] = -1
|
||||||
self.remove_receiver(idx)
|
self.remove_receiver(idx, False)
|
||||||
if file_props.has_key('streamhosts'):
|
if file_props.has_key('streamhosts'):
|
||||||
for host in file_props['streamhosts']:
|
for host in file_props['streamhosts']:
|
||||||
if host['state'] != -1:
|
if host['state'] != -1:
|
||||||
return
|
return
|
||||||
|
# failure_cb exists - this means that it has never been called
|
||||||
if file_props.has_key('failure_cb') and file_props['failure_cb']:
|
if file_props.has_key('failure_cb') and file_props['failure_cb']:
|
||||||
file_props['failure_cb'](streamhost['initiator'], streamhost['id'],
|
file_props['failure_cb'](streamhost['initiator'], streamhost['id'],
|
||||||
file_props['sid'], code = 404)
|
file_props['sid'], code = 404)
|
||||||
|
del(file_props['failure_cb'])
|
||||||
|
|
||||||
def add_receiver(self, account, sock5_receiver):
|
def add_receiver(self, account, sock5_receiver):
|
||||||
''' add new file request '''
|
''' add new file request '''
|
||||||
|
@ -165,6 +214,7 @@ class SocksQueue:
|
||||||
if self.sha_handlers.has_key(sha_str):
|
if self.sha_handlers.has_key(sha_str):
|
||||||
props = self.sha_handlers[sha_str]
|
props = self.sha_handlers[sha_str]
|
||||||
props[0](props[1], idx)
|
props[0](props[1], idx)
|
||||||
|
|
||||||
def activate_proxy(self, idx):
|
def activate_proxy(self, idx):
|
||||||
if not self.readers.has_key(idx):
|
if not self.readers.has_key(idx):
|
||||||
return
|
return
|
||||||
|
@ -187,6 +237,7 @@ class SocksQueue:
|
||||||
reader.pauses = 0
|
reader.pauses = 0
|
||||||
# start sending file to proxy
|
# start sending file to proxy
|
||||||
# TODO: add timeout for stalled state
|
# TODO: add timeout for stalled state
|
||||||
|
self.idlequeue.set_read_timeout(reader.fd, STALLED_TIMEOUT)
|
||||||
self.idlequeue.plug_idle(reader, True, False)
|
self.idlequeue.plug_idle(reader, True, False)
|
||||||
result = reader.write_next()
|
result = reader.write_next()
|
||||||
self.process_result(result, reader)
|
self.process_result(result, reader)
|
||||||
|
@ -243,7 +294,6 @@ class SocksQueue:
|
||||||
sock_hash, self, sock[0], sock[1][0], sock[1][1])
|
sock_hash, self, sock[0], sock[1][0], sock[1][1])
|
||||||
self.connected += 1
|
self.connected += 1
|
||||||
|
|
||||||
|
|
||||||
def process_result(self, result, actor):
|
def process_result(self, result, actor):
|
||||||
''' Take appropriate actions upon the result:
|
''' Take appropriate actions upon the result:
|
||||||
[ 0, - 1 ] complete/end transfer
|
[ 0, - 1 ] complete/end transfer
|
||||||
|
@ -263,11 +313,14 @@ class SocksQueue:
|
||||||
the number of active connections with 1'''
|
the number of active connections with 1'''
|
||||||
if idx != -1:
|
if idx != -1:
|
||||||
if self.readers.has_key(idx):
|
if self.readers.has_key(idx):
|
||||||
|
reader = self.readers[idx]
|
||||||
|
self.idlequeue.unplug_idle(reader.fd)
|
||||||
|
self.idlequeue.remove_timeout(reader.fd)
|
||||||
if do_disconnect:
|
if do_disconnect:
|
||||||
self.readers[idx].disconnect()
|
reader.disconnect()
|
||||||
else:
|
else:
|
||||||
if self.readers[idx].streamhost is not None:
|
if reader.streamhost is not None:
|
||||||
self.readers[idx].streamhost['state'] = -1
|
reader.streamhost['state'] = -1
|
||||||
del(self.readers[idx])
|
del(self.readers[idx])
|
||||||
|
|
||||||
def remove_sender(self, idx, do_disconnect = True):
|
def remove_sender(self, idx, do_disconnect = True):
|
||||||
|
@ -414,17 +467,10 @@ class Socks5:
|
||||||
self.remaining_buff = buff[lenn:]
|
self.remaining_buff = buff[lenn:]
|
||||||
else:
|
else:
|
||||||
self.remaining_buff = ''
|
self.remaining_buff = ''
|
||||||
if lenn == 0:
|
|
||||||
self.pauses +=1
|
|
||||||
else:
|
|
||||||
self.pauses = 0
|
|
||||||
if self.pauses > 24:
|
|
||||||
self.file_props['stalled'] = True
|
|
||||||
else:
|
|
||||||
self.file_props['stalled'] = False
|
|
||||||
self.state = 7 # continue to write in the socket
|
self.state = 7 # continue to write in the socket
|
||||||
if lenn == 0 and self.file_props['stalled'] is False:
|
if lenn == 0:
|
||||||
return None
|
return None
|
||||||
|
self.file_props['stalled'] = False
|
||||||
return lenn
|
return lenn
|
||||||
else:
|
else:
|
||||||
self.state = 8 # end connection
|
self.state = 8 # end connection
|
||||||
|
@ -495,13 +541,7 @@ class Socks5:
|
||||||
self.file_props['completed'] = True
|
self.file_props['completed'] = True
|
||||||
return 0
|
return 0
|
||||||
# return number of read bytes. It can be used in progressbar
|
# return number of read bytes. It can be used in progressbar
|
||||||
if fd == None:
|
if fd != None:
|
||||||
self.pauses +=1
|
|
||||||
else:
|
|
||||||
self.pauses = 0
|
|
||||||
if self.pauses > 24:
|
|
||||||
self.file_props['stalled'] = True
|
|
||||||
else:
|
|
||||||
self.file_props['stalled'] = False
|
self.file_props['stalled'] = False
|
||||||
if fd == None and self.file_props['stalled'] is False:
|
if fd == None and self.file_props['stalled'] is False:
|
||||||
return None
|
return None
|
||||||
|
@ -520,8 +560,10 @@ class Socks5:
|
||||||
# socket is already closed
|
# socket is already closed
|
||||||
pass
|
pass
|
||||||
self.connected = False
|
self.connected = False
|
||||||
|
self.idlequeue.remove_timeout(self.fd)
|
||||||
self.idlequeue.unplug_idle(self.fd)
|
self.idlequeue.unplug_idle(self.fd)
|
||||||
self.fd = -1
|
self.fd = -1
|
||||||
|
self.state = -1
|
||||||
|
|
||||||
def _get_auth_buff(self):
|
def _get_auth_buff(self):
|
||||||
''' Message, that we support 1 one auth mechanism:
|
''' Message, that we support 1 one auth mechanism:
|
||||||
|
@ -619,10 +661,16 @@ class Socks5Sender(Socks5, IdleObject):
|
||||||
# start waiting for data
|
# start waiting for data
|
||||||
self.idlequeue.plug_idle(self, False, True)
|
self.idlequeue.plug_idle(self, False, True)
|
||||||
|
|
||||||
|
def read_timeout(self):
|
||||||
|
self.idlequeue.remove_timeout(self.fd)
|
||||||
|
self.file_props['stalled'] = True
|
||||||
|
self.queue.process_result(None, self)
|
||||||
|
|
||||||
def pollout(self):
|
def pollout(self):
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
self.queue.remove_sender(self.queue_idx)
|
self.disconnect()
|
||||||
return
|
return
|
||||||
|
self.idlequeue.remove_timeout(self.fd)
|
||||||
if self.state == 2: # send reply with desired auth type
|
if self.state == 2: # send reply with desired auth type
|
||||||
self.send_raw(self._get_auth_response())
|
self.send_raw(self._get_auth_response())
|
||||||
elif self.state == 4: # send positive response to the 'connect'
|
elif self.state == 4: # send positive response to the 'connect'
|
||||||
|
@ -634,9 +682,9 @@ class Socks5Sender(Socks5, IdleObject):
|
||||||
result = self.write_next()
|
result = self.write_next()
|
||||||
self.queue.process_result(result, self)
|
self.queue.process_result(result, self)
|
||||||
if result is None or result <= 0:
|
if result is None or result <= 0:
|
||||||
self.queue.remove_sender(self.queue_idx)
|
self.disconnect()
|
||||||
elif self.state == 8:
|
elif self.state == 8:
|
||||||
self.queue.remove_sender(self.queue_idx)
|
self.disconnect()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
|
@ -647,10 +695,7 @@ class Socks5Sender(Socks5, IdleObject):
|
||||||
|
|
||||||
def pollend(self):
|
def pollend(self):
|
||||||
self.state = 8 # end connection
|
self.state = 8 # end connection
|
||||||
self.close_file()
|
self.disconnect()
|
||||||
self.file_props['error'] = -1
|
|
||||||
self.queue.process_result(-1, self)
|
|
||||||
self.queue.remove_sender(self.queue_idx)
|
|
||||||
|
|
||||||
def pollin(self):
|
def pollin(self):
|
||||||
if self.connected:
|
if self.connected:
|
||||||
|
@ -667,7 +712,7 @@ class Socks5Sender(Socks5, IdleObject):
|
||||||
result = self.get_file_contents(0)
|
result = self.get_file_contents(0)
|
||||||
self.queue.process_result(result, self)
|
self.queue.process_result(result, self)
|
||||||
else:
|
else:
|
||||||
self.queue.remove_sender(self.queue_idx)
|
self.disconnect()
|
||||||
|
|
||||||
def send_file(self):
|
def send_file(self):
|
||||||
''' start sending the file over verified connection '''
|
''' start sending the file over verified connection '''
|
||||||
|
@ -718,6 +763,10 @@ class Socks5Sender(Socks5, IdleObject):
|
||||||
|
|
||||||
class Socks5Listener(IdleObject):
|
class Socks5Listener(IdleObject):
|
||||||
def __init__(self, idlequeue, host, port):
|
def __init__(self, idlequeue, host, port):
|
||||||
|
''' handle all incomming connections on (host, port)
|
||||||
|
This class implements IdleObject, but we will expect
|
||||||
|
only pollin events though
|
||||||
|
'''
|
||||||
self.host, self.port = host, port
|
self.host, self.port = host, port
|
||||||
self.queue_idx = -1
|
self.queue_idx = -1
|
||||||
self.idlequeue = idlequeue
|
self.idlequeue = idlequeue
|
||||||
|
@ -743,19 +792,29 @@ class Socks5Listener(IdleObject):
|
||||||
self.idlequeue.plug_idle(self, False, True)
|
self.idlequeue.plug_idle(self, False, True)
|
||||||
self.started = True
|
self.started = True
|
||||||
|
|
||||||
|
def pollend(self):
|
||||||
|
''' called when we stop listening on (host, port) '''
|
||||||
|
self.disconnect()
|
||||||
|
|
||||||
def pollin(self):
|
def pollin(self):
|
||||||
|
''' accept a new incomming connection and notify queue'''
|
||||||
sock = self.accept_conn()
|
sock = self.accept_conn()
|
||||||
self.queue.on_connection_accepted(sock)
|
self.queue.on_connection_accepted(sock)
|
||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self):
|
||||||
|
''' free all resources, we are not listening anymore '''
|
||||||
|
self.idlequeue.remove_timeout(self.fd)
|
||||||
self.idlequeue.unplug_idle(self.fd)
|
self.idlequeue.unplug_idle(self.fd)
|
||||||
self.fd = -1
|
self.fd = -1
|
||||||
|
self.state = -1
|
||||||
|
self.started = False
|
||||||
try:
|
try:
|
||||||
self._serv.close()
|
self._serv.close()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def accept_conn(self):
|
def accept_conn(self):
|
||||||
|
''' accepts a new incomming connection '''
|
||||||
_sock = self._serv.accept()
|
_sock = self._serv.accept()
|
||||||
_sock[0].setblocking(False)
|
_sock[0].setblocking(False)
|
||||||
return _sock
|
return _sock
|
||||||
|
@ -780,6 +839,16 @@ class Socks5Receiver(Socks5, IdleObject):
|
||||||
Socks5.__init__(self, idlequeue, streamhost['host'], int(streamhost['port']),
|
Socks5.__init__(self, idlequeue, streamhost['host'], int(streamhost['port']),
|
||||||
streamhost['initiator'], streamhost['target'], sid)
|
streamhost['initiator'], streamhost['target'], sid)
|
||||||
|
|
||||||
|
def read_timeout(self):
|
||||||
|
self.idlequeue.remove_timeout(self.fd)
|
||||||
|
if self.state > 5:
|
||||||
|
# no activity for foo seconds
|
||||||
|
self.file_props['stalled'] = True
|
||||||
|
self.queue.process_result(-1, self)
|
||||||
|
else:
|
||||||
|
self.queue.reconnect_receiver(self, self.streamhost )
|
||||||
|
self.idlequeue.unplug_idle(self.fd)
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
''' create the socket and plug it to the idlequeue '''
|
''' create the socket and plug it to the idlequeue '''
|
||||||
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
@ -789,10 +858,16 @@ class Socks5Receiver(Socks5, IdleObject):
|
||||||
self.state = 0 # about to be connected
|
self.state = 0 # about to be connected
|
||||||
self.idlequeue.plug_idle(self, True, False)
|
self.idlequeue.plug_idle(self, True, False)
|
||||||
self.do_connect()
|
self.do_connect()
|
||||||
# TODO: add timeout for establishing connection
|
self.idlequeue.set_read_timeout(self.fd, CONNECT_TIMEOUT)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _is_connected(self):
|
||||||
|
if self.state < 5:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def pollout(self):
|
def pollout(self):
|
||||||
|
self.idlequeue.remove_timeout(self.fd)
|
||||||
if self.state == 0:
|
if self.state == 0:
|
||||||
self.do_connect()
|
self.do_connect()
|
||||||
return
|
return
|
||||||
|
@ -812,11 +887,13 @@ class Socks5Receiver(Socks5, IdleObject):
|
||||||
self.idlequeue.plug_idle(self, False, True)
|
self.idlequeue.plug_idle(self, False, True)
|
||||||
|
|
||||||
def pollend(self):
|
def pollend(self):
|
||||||
self.file_props['error'] = -1
|
if self.state >= 5:
|
||||||
self.queue.process_result(-1, self)
|
self.disconnect()
|
||||||
self.queue.remove_receiver(self.queue_idx)
|
else:
|
||||||
|
self.queue.reconnect_receiver(self, self.streamhost)
|
||||||
|
|
||||||
def pollin(self):
|
def pollin(self):
|
||||||
|
self.idlequeue.remove_timeout(self.fd)
|
||||||
if self.connected:
|
if self.connected:
|
||||||
if self.file_props['paused']:
|
if self.file_props['paused']:
|
||||||
return
|
return
|
||||||
|
@ -829,10 +906,7 @@ class Socks5Receiver(Socks5, IdleObject):
|
||||||
result = self.get_file_contents(0)
|
result = self.get_file_contents(0)
|
||||||
self.queue.process_result(result, self)
|
self.queue.process_result(result, self)
|
||||||
else:
|
else:
|
||||||
self.queue.remove_receiver(self.queue_idx)
|
self.disconnect()
|
||||||
|
|
||||||
def read_timeout(self, fd):
|
|
||||||
self.disconnect()
|
|
||||||
|
|
||||||
def do_connect(self):
|
def do_connect(self):
|
||||||
try:
|
try:
|
||||||
|
@ -859,6 +933,8 @@ class Socks5Receiver(Socks5, IdleObject):
|
||||||
self.file_props['connected'] = True
|
self.file_props['connected'] = True
|
||||||
self.file_props['disconnect_cb'] = self.disconnect
|
self.file_props['disconnect_cb'] = self.disconnect
|
||||||
self.state = 1 # connected
|
self.state = 1 # connected
|
||||||
|
|
||||||
|
# stop all others connections to sender's streamhosts
|
||||||
self.queue._socket_connected(self.streamhost, self.file_props)
|
self.queue._socket_connected(self.streamhost, self.file_props)
|
||||||
self.idlequeue.plug_idle(self, True, False)
|
self.idlequeue.plug_idle(self, True, False)
|
||||||
return 1 # we are connected
|
return 1 # we are connected
|
||||||
|
@ -866,15 +942,19 @@ class Socks5Receiver(Socks5, IdleObject):
|
||||||
def main(self, timeout = 0):
|
def main(self, timeout = 0):
|
||||||
''' begin negotiation. on success 'address' != 0 '''
|
''' begin negotiation. on success 'address' != 0 '''
|
||||||
result = 1
|
result = 1
|
||||||
|
buff = self.receive()
|
||||||
|
if buff == '':
|
||||||
|
# end connection
|
||||||
|
self.pollend()
|
||||||
|
return
|
||||||
|
|
||||||
if self.state == 2: # read auth response
|
if self.state == 2: # read auth response
|
||||||
buff = self.receive()
|
|
||||||
if buff is None or len(buff) != 2:
|
if buff is None or len(buff) != 2:
|
||||||
return None
|
return None
|
||||||
version, method = struct.unpack('!BB', buff[:2])
|
version, method = struct.unpack('!BB', buff[:2])
|
||||||
if version != 0x05 or method == 0xff:
|
if version != 0x05 or method == 0xff:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
elif self.state == 4: # get approve of our request
|
elif self.state == 4: # get approve of our request
|
||||||
buff = self.receive()
|
|
||||||
if buff == None:
|
if buff == None:
|
||||||
return None
|
return None
|
||||||
sub_buff = buff[:4]
|
sub_buff = buff[:4]
|
||||||
|
@ -915,6 +995,7 @@ class Socks5Receiver(Socks5, IdleObject):
|
||||||
self.file_props['received-len'] = 0
|
self.file_props['received-len'] = 0
|
||||||
self.pauses = 0
|
self.pauses = 0
|
||||||
# start sending file contents to socket
|
# start sending file contents to socket
|
||||||
|
self.idlequeue.set_read_timeout(self.fd, STALLED_TIMEOUT)
|
||||||
self.idlequeue.plug_idle(self, True, False)
|
self.idlequeue.plug_idle(self, True, False)
|
||||||
else:
|
else:
|
||||||
# receiving file contents from socket
|
# receiving file contents from socket
|
||||||
|
|
Loading…
Reference in New Issue