changeset 88bfbec239ea in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=88bfbec239ea
description: handle see-other-host stream error. Fixes #7134
diffstat:
src/common/connection.py | 18 ++++++++++++++----
src/common/connection_handlers.py | 11 +++++++++++
2 files changed, 25 insertions(+), 4 deletions(-)
diffs (79 lines):
diff -r d212cafdd739 -r 88bfbec239ea src/common/connection.py
--- a/src/common/connection.py Thu Apr 12 07:17:50 2012 +0200
+++ b/src/common/connection.py Sun Apr 15 23:42:53 2012 +0200
@@ -694,6 +694,7 @@
self.try_connecting_for_foo_secs = 45
# holds the actual hostname to which we are connected
self.connected_hostname = None
+ self.redirected = None
self.last_time_to_reconnect = None
self.new_account_info = None
self.new_account_form = None
@@ -1044,10 +1045,17 @@
self.name, 'try_connecting_for_foo_secs')
proxy = helpers.get_proxy_info(self.name)
use_srv = gajim.config.get_per('accounts', self.name, 'use_srv')
- use_custom = gajim.config.get_per('accounts', self.name,
+ if self.redirected:
+ use_custom = True
+ custom_h = self.redirected['host']
+ custom_p = self.redirected['port']
+ else:
+ use_custom = gajim.config.get_per('accounts', self.name,
'use_custom_host')
- custom_h = gajim.config.get_per('accounts', self.name,
'custom_host')
- custom_p = gajim.config.get_per('accounts', self.name,
'custom_port')
+ custom_h = gajim.config.get_per('accounts', self.name,
+ 'custom_host')
+ custom_p = gajim.config.get_per('accounts', self.name,
+ 'custom_port')
# create connection if it doesn't already exist
self.connected = 1
@@ -1059,8 +1067,10 @@
h = custom_h
p = custom_p
ssl_p = custom_p
- use_srv = False
+ if not self.redirected:
+ use_srv = False
+ self.redirected = None
# SRV resolver
self._proxy = proxy
self._hosts = [ {'host': h, 'port': p, 'ssl_port': ssl_p, 'prio': 10,
diff -r d212cafdd739 -r 88bfbec239ea src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Thu Apr 12 07:17:50 2012 +0200
+++ b/src/common/connection_handlers.py Sun Apr 15 23:42:53 2012 +0200
@@ -1296,6 +1296,8 @@
ged.POSTGUI, self._nec_unsubscribed_presence_received_end)
gajim.ged.register_event_handler('agent-removed', ged.CORE,
self._nec_agent_removed)
+ gajim.ged.register_event_handler('stream-other-host-received',
ged.CORE,
+ self._nec_stream_other_host_received)
def cleanup(self):
ConnectionHandlersBase.cleanup(self)
@@ -1338,6 +1340,8 @@
ged.POSTGUI, self._nec_unsubscribed_presence_received_end)
gajim.ged.remove_event_handler('agent-removed', ged.CORE,
self._nec_agent_removed)
+ gajim.ged.remove_event_handler('stream-other-host-received', ged.CORE,
+ self._nec_stream_other_host_received)
def build_http_auth_answer(self, iq_obj, answer):
if not self.connection or self.connected < 2:
@@ -1980,6 +1984,13 @@
gajim.nec.push_incoming_event(SearchFormReceivedEvent(None,
conn=self, stanza=iq_obj))
+ def _nec_stream_other_host_received(self, obj):
+ if obj.conn.name != self.name:
+ return
+ self.redirected = obj.redirected
+ self.disconnect(on_purpose=True)
+ self.connect()
+
def _StreamCB(self, con, iq_obj):
log.debug('StreamCB')
gajim.nec.push_incoming_event(StreamReceivedEvent(None,
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits