removed the fast extention
This commit is contained in:
parent
cfdbb80d5d
commit
5d3f81a9c3
|
@ -398,6 +398,7 @@ class Connection:
|
||||||
if not self.files_props.has_key(id):
|
if not self.files_props.has_key(id):
|
||||||
return
|
return
|
||||||
file_props = self.files_props[id]
|
file_props = self.files_props[id]
|
||||||
|
file_props['error'] = -4
|
||||||
self.dispatch('FILE_REQUEST_ERROR', (jid, file_props))
|
self.dispatch('FILE_REQUEST_ERROR', (jid, file_props))
|
||||||
raise common.xmpp.NodeProcessed
|
raise common.xmpp.NodeProcessed
|
||||||
|
|
||||||
|
@ -448,11 +449,6 @@ class Connection:
|
||||||
fast = query.getTag('fast')
|
fast = query.getTag('fast')
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
pass
|
pass
|
||||||
if fast is not None:
|
|
||||||
if fast.getNamespace() == common.xmpp.NS_STREAM:
|
|
||||||
self.send_socks5_info(file_props, fast = False,
|
|
||||||
receiver = file_props['sender'], sender = file_props['receiver'])
|
|
||||||
self.files_props[sid] = file_props
|
|
||||||
file_props['streamhosts'] = streamhosts
|
file_props['streamhosts'] = streamhosts
|
||||||
conn_err = False
|
conn_err = False
|
||||||
if file_props['type'] == 'r':
|
if file_props['type'] == 'r':
|
||||||
|
@ -475,7 +471,7 @@ class Connection:
|
||||||
stream_tag.setAttr('jid', streamhost['jid'])
|
stream_tag.setAttr('jid', streamhost['jid'])
|
||||||
self.to_be_sent.append(iq)
|
self.to_be_sent.append(iq)
|
||||||
|
|
||||||
def _connect_error(self, to, id, code = 404):
|
def _connect_error(self, to, _id, code = 404):
|
||||||
msg_dict = {
|
msg_dict = {
|
||||||
404: 'Could not connect to given hosts',
|
404: 'Could not connect to given hosts',
|
||||||
405: 'Cancel',
|
405: 'Cancel',
|
||||||
|
@ -485,11 +481,18 @@ class Connection:
|
||||||
iq = None
|
iq = None
|
||||||
iq = common.xmpp.Protocol(name = 'iq', to = to,
|
iq = common.xmpp.Protocol(name = 'iq', to = to,
|
||||||
typ = 'error')
|
typ = 'error')
|
||||||
iq.setAttr('id', id)
|
iq.setAttr('id', _id)
|
||||||
err = iq.setTag('error')
|
err = iq.setTag('error')
|
||||||
err.setAttr('code', str(code))
|
err.setAttr('code', str(code))
|
||||||
err.setData(msg)
|
err.setData(msg)
|
||||||
self.to_be_sent.append(iq)
|
self.to_be_sent.append(iq)
|
||||||
|
if code == 404:
|
||||||
|
sid = _id[3:]
|
||||||
|
file_props = gajim.socks5queue.get_file_props(self.name, sid)
|
||||||
|
self.disconnect_transfer(file_props)
|
||||||
|
file_props['error'] = -3
|
||||||
|
self.dispatch('FILE_REQUEST_ERROR', (to, file_props))
|
||||||
|
|
||||||
|
|
||||||
def _bytestreamResultCB(self, con, iq_obj):
|
def _bytestreamResultCB(self, con, iq_obj):
|
||||||
gajim.log.debug('_bytestreamResultCB')
|
gajim.log.debug('_bytestreamResultCB')
|
||||||
|
@ -713,15 +716,14 @@ class Connection:
|
||||||
if type(self.peerhost) != tuple:
|
if type(self.peerhost) != tuple:
|
||||||
return
|
return
|
||||||
port = gajim.config.get('file_transfers_port')
|
port = gajim.config.get('file_transfers_port')
|
||||||
proxy = gajim.config.get_per('accounts', self.name, 'file_transfers_proxy')
|
cfg_proxies = gajim.config.get_per('accounts', self.name, 'file_transfer_proxies')
|
||||||
|
|
||||||
if receiver is None:
|
if receiver is None:
|
||||||
receiver = file_props['receiver']
|
receiver = file_props['receiver']
|
||||||
if sender is None:
|
if sender is None:
|
||||||
sender = file_props['sender']
|
sender = file_props['sender']
|
||||||
proxyhosts = []
|
proxyhosts = []
|
||||||
if fast and proxy:
|
if fast and cfg_proxies:
|
||||||
proxies = map(lambda e:e.strip(), proxy.split(','))
|
proxies = map(lambda e:e.strip(), cfg_proxies.split(','))
|
||||||
for proxy in proxies:
|
for proxy in proxies:
|
||||||
(host, _port, jid) = self.get_cached_proxies(proxy)
|
(host, _port, jid) = self.get_cached_proxies(proxy)
|
||||||
if host is None:
|
if host is None:
|
||||||
|
@ -770,9 +772,6 @@ class Connection:
|
||||||
streamhost.setAttr('jid', proxyhost['jid'])
|
streamhost.setAttr('jid', proxyhost['jid'])
|
||||||
proxy = streamhost.setTag('proxy')
|
proxy = streamhost.setTag('proxy')
|
||||||
proxy.setNamespace(common.xmpp.NS_STREAM)
|
proxy.setNamespace(common.xmpp.NS_STREAM)
|
||||||
if fast:
|
|
||||||
fast_tag = query.setTag('fast')
|
|
||||||
fast_tag.setNamespace(common.xmpp.NS_STREAM)
|
|
||||||
self.to_be_sent.append(iq)
|
self.to_be_sent.append(iq)
|
||||||
|
|
||||||
def _siSetCB(self, con, iq_obj):
|
def _siSetCB(self, con, iq_obj):
|
||||||
|
|
|
@ -120,10 +120,12 @@ class SocksQueue:
|
||||||
sock5_receiver.account = account
|
sock5_receiver.account = account
|
||||||
self.idx += 1
|
self.idx += 1
|
||||||
result = sock5_receiver.connect()
|
result = sock5_receiver.connect()
|
||||||
|
self.connected += 1
|
||||||
if result != None:
|
if result != None:
|
||||||
self.connected += 1
|
self.connected += 1
|
||||||
result = sock5_receiver.main()
|
result = sock5_receiver.main()
|
||||||
self.process_result(result, sock5_receiver)
|
self.process_result(result, sock5_receiver)
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -443,8 +445,6 @@ class Socks5:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_file_contents(self, timeout):
|
def get_file_contents(self, timeout):
|
||||||
''' read file contents from socket and write them to file ''', \
|
''' read file contents from socket and write them to file ''', \
|
||||||
self.file_props['type'], self.file_props['sid']
|
self.file_props['type'], self.file_props['sid']
|
||||||
|
@ -485,12 +485,6 @@ class Socks5:
|
||||||
# Transfer stopped somehow:
|
# Transfer stopped somehow:
|
||||||
# reset, paused or network error
|
# reset, paused or network error
|
||||||
self.rem_fd(fd)
|
self.rem_fd(fd)
|
||||||
try:
|
|
||||||
# file is not complete, remove it
|
|
||||||
os.remove(self.file_props['file-name'])
|
|
||||||
except Exception, e:
|
|
||||||
# unable to remove the incomplete file
|
|
||||||
pass
|
|
||||||
self.disconnect(False)
|
self.disconnect(False)
|
||||||
self.file_props['error'] = -1
|
self.file_props['error'] = -1
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue