Remove streamhost redirect
After asking around this is a dead feature. Because servers cannot be sure if clients support redirection, a server using this feature would essentially risk that his users are not able to connect at all.
This commit is contained in:
parent
af7ac9211d
commit
e918ac85fe
|
@ -593,7 +593,6 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
self.connected_hostname = None
|
||||
# Holds the full jid we received on the bind event
|
||||
self.registered_name = None
|
||||
self.redirected = None
|
||||
self.last_time_to_reconnect = None
|
||||
self.new_account_info = None
|
||||
self.new_account_form = None
|
||||
|
@ -793,11 +792,6 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
else:
|
||||
# show error dialog
|
||||
self._connection_lost()
|
||||
else:
|
||||
if self.redirected:
|
||||
self.disconnect(on_purpose=True)
|
||||
self.connect()
|
||||
return
|
||||
else:
|
||||
self.disconnect()
|
||||
self.on_purpose = False
|
||||
|
@ -988,11 +982,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
self.name, 'try_connecting_for_foo_secs')
|
||||
proxy = helpers.get_proxy_info(self.name)
|
||||
use_srv = app.config.get_per('accounts', self.name, 'use_srv')
|
||||
if self.redirected:
|
||||
use_custom = True
|
||||
custom_h = self.redirected['host']
|
||||
custom_p = self.redirected['port']
|
||||
else:
|
||||
|
||||
use_custom = app.config.get_per('accounts', self.name,
|
||||
'use_custom_host')
|
||||
if use_custom:
|
||||
|
@ -1018,10 +1008,8 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
h = custom_h
|
||||
p = custom_p
|
||||
ssl_p = custom_p
|
||||
if not self.redirected:
|
||||
use_srv = False
|
||||
|
||||
self.redirected = None
|
||||
# SRV resolver
|
||||
self._proxy = proxy
|
||||
self._hosts = [
|
||||
|
@ -1148,11 +1136,6 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
|
||||
self._current_host = host
|
||||
|
||||
if self.redirected:
|
||||
self.disconnect(on_purpose=True)
|
||||
self.connect()
|
||||
return
|
||||
|
||||
self._current_type = self._current_host['type']
|
||||
|
||||
port = self._current_host['port']
|
||||
|
|
|
@ -774,7 +774,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
|||
self.privacy_default_list = None
|
||||
|
||||
app.nec.register_incoming_event(StreamConflictReceivedEvent)
|
||||
app.nec.register_incoming_event(StreamOtherHostReceivedEvent)
|
||||
app.nec.register_incoming_event(MessageReceivedEvent)
|
||||
app.nec.register_incoming_event(ArchivingErrorReceivedEvent)
|
||||
app.nec.register_incoming_event(
|
||||
|
@ -799,8 +798,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
|||
ged.POSTGUI, self._nec_unsubscribed_presence_received_end)
|
||||
app.ged.register_event_handler('agent-removed', ged.CORE,
|
||||
self._nec_agent_removed)
|
||||
app.ged.register_event_handler('stream-other-host-received', ged.CORE,
|
||||
self._nec_stream_other_host_received)
|
||||
app.ged.register_event_handler('blocking', ged.CORE,
|
||||
self._nec_blocking)
|
||||
|
||||
|
@ -826,8 +823,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
|||
ged.POSTGUI, self._nec_unsubscribed_presence_received_end)
|
||||
app.ged.remove_event_handler('agent-removed', ged.CORE,
|
||||
self._nec_agent_removed)
|
||||
app.ged.remove_event_handler('stream-other-host-received', ged.CORE,
|
||||
self._nec_stream_other_host_received)
|
||||
app.ged.remove_event_handler('blocking', ged.CORE, self._nec_blocking)
|
||||
|
||||
def add_sha(self, p, send_caps=True):
|
||||
|
@ -1383,11 +1378,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
|||
probe = nbxmpp.Presence(jid, 'probe', frm=self.get_own_jid())
|
||||
self.connection.send(probe)
|
||||
|
||||
def _nec_stream_other_host_received(self, obj):
|
||||
if obj.conn.name != self.name:
|
||||
return
|
||||
self.redirected = obj.redirected
|
||||
|
||||
def _StreamCB(self, con, obj):
|
||||
log.debug('StreamCB')
|
||||
app.nec.push_incoming_event(StreamReceivedEvent(None,
|
||||
|
|
|
@ -331,28 +331,6 @@ class StreamConflictReceivedEvent(nec.NetworkIncomingEvent):
|
|||
self.conn = self.base_event.conn
|
||||
return True
|
||||
|
||||
class StreamOtherHostReceivedEvent(nec.NetworkIncomingEvent):
|
||||
name = 'stream-other-host-received'
|
||||
base_network_events = ['stream-received']
|
||||
|
||||
def generate(self):
|
||||
self.conn = self.base_event.conn
|
||||
self.stanza = self.base_event.stanza
|
||||
other_host = self.stanza.getTag('see-other-host')
|
||||
if other_host and self.conn._current_type in ('ssl', 'tls'):
|
||||
host = other_host.getData()
|
||||
if ':' in host:
|
||||
host_l = host.split(':', 1)
|
||||
h = host_l[0]
|
||||
p = host_l[1]
|
||||
else:
|
||||
h = host
|
||||
p = 5222
|
||||
if h.startswith('[') and h.endswith(']'):
|
||||
h = h[1:-1]
|
||||
self.redirected = {'host': h, 'port': p}
|
||||
return True
|
||||
|
||||
class PresenceHelperEvent:
|
||||
def _generate_show(self):
|
||||
self.show = self.stanza.getShow()
|
||||
|
|
Loading…
Reference in New Issue