added debug messages

This commit is contained in:
Dimitur Kirov 2005-08-04 08:59:03 +00:00
parent b2242b9b01
commit d56ba58149
2 changed files with 12 additions and 2 deletions

View File

@ -462,20 +462,24 @@ class Connection:
gajim.log.debug('_siResultCB') gajim.log.debug('_siResultCB')
id = iq_obj.getAttr('id') id = iq_obj.getAttr('id')
if not self.files_props.has_key(id): if not self.files_props.has_key(id):
gajim.log.debug('files_props - no key' + str(id))
return return
file_props = self.files_props[id] file_props = self.files_props[id]
if file_props is None: if file_props is None:
gajim.log.debug('files_props none')
return return
file_props['receiver'] = str(iq_obj.getFrom()) file_props['receiver'] = str(iq_obj.getFrom())
jid = iq_obj.getFrom().getStripped().encode('utf8') jid = iq_obj.getFrom().getStripped().encode('utf8')
si = iq_obj.getTag('si') si = iq_obj.getTag('si')
feature = si.setTag('feature') feature = si.setTag('feature')
if feature.getNamespace() != common.xmpp.NS_FEATURE: if feature.getNamespace() != common.xmpp.NS_FEATURE:
gajim.log.debug('wrong ns' + str(feature.getNamespace()))
return return
form_tag = feature.getTag('x') form_tag = feature.getTag('x')
form = common.xmpp.DataForm(node=form_tag) form = common.xmpp.DataForm(node=form_tag)
field = form.getField('stream-method') field = form.getField('stream-method')
if field.getValue() != common.xmpp.NS_BYTESTREAM: if field.getValue() != common.xmpp.NS_BYTESTREAM:
gajim.log.debug('wrong field stream' + str(field.getValue()))
return return
self.send_socks5_info(file_props) self.send_socks5_info(file_props)
raise common.xmpp.NodeProcessed raise common.xmpp.NodeProcessed
@ -492,6 +496,7 @@ class Connection:
return return
def send_socks5_info(self, file_props): def send_socks5_info(self, file_props):
gajim.log.debug('send_socks5_info' + str(file_props))
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')
@ -501,6 +506,7 @@ class Connection:
listener = gajim.socks5queue.start_listener(self.peerhost[0], port, listener = gajim.socks5queue.start_listener(self.peerhost[0], port,
sha_str, self.result_socks5_sid, file_props['sid']) sha_str, self.result_socks5_sid, file_props['sid'])
if listener == None: if listener == None:
gajim.log.debug(_('UNABLE TO SET LISTENER ON %s %s') % (self.peerhost[0], port))
# FIXME - raise error dialog that address is in use # FIXME - raise error dialog that address is in use
return return
iq = common.xmpp.Protocol(name = 'iq', to = str(file_props['receiver']), iq = common.xmpp.Protocol(name = 'iq', to = str(file_props['receiver']),

View File

@ -51,8 +51,10 @@ class SocksQueue:
self.listener = Socks5Listener(host, port) self.listener = Socks5Listener(host, port)
self.listener.bind() self.listener.bind()
if self.listener.started is False: if self.listener.started is False:
print 'LISTENER IS NOT STARTED'
return None return None
self.connected += 1 self.connected += 1
print 'LISTENER STARTED'
return self.listener return self.listener
def result_sha(self, sha_str, idx): def result_sha(self, sha_str, idx):
@ -463,14 +465,16 @@ class Socks5Listener:
self._serv.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) self._serv.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
self._serv.bind(('0.0.0.0', self.port)) self._serv.bind(('0.0.0.0', self.port))
self._serv.listen(socket.SOMAXCONN) self._serv.listen(socket.SOMAXCONN)
self._serv.setblocking(False)
except Exception, (errno, errstr): except Exception, (errno, errstr):
print 'EXCEPTION BINDING', (errno, errstr)
return None return None
self._serv.setblocking(False)
self.started = True self.started = True
def accept_conn(self): def accept_conn(self):
self._serv.accept.__doc__ print 'ACCEPTED CONNECTION',
_sock = self._serv.accept() _sock = self._serv.accept()
print _sock
_sock[0].setblocking(False) _sock[0].setblocking(False)
return _sock return _sock