Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gajim
python-nbxmpp
Commits
51689ec9
Commit
51689ec9
authored
Jun 19, 2012
by
Yann Leboulanger
Browse files
handle <stream:error see-other-host> when connecting.
parent
7d06a025
Changes
2
Hide whitespace changes
Inline
Side-by-side
nbxmpp/client_nb.py
View file @
51689ec9
...
...
@@ -67,6 +67,7 @@ class NonBlockingClient:
self
.
on_connect_failure
=
None
self
.
proxy
=
None
self
.
got_features
=
False
self
.
got_see_other_host
=
None
self
.
stream_started
=
False
self
.
disconnecting
=
False
self
.
protocol_type
=
'XMPP'
...
...
@@ -138,8 +139,8 @@ class NonBlockingClient:
self
.
disconnecting
=
False
def
connect
(
self
,
on_connect
,
on_connect_failure
,
hostname
=
None
,
port
=
5222
,
on_proxy_failure
=
None
,
proxy
=
None
,
secure_tuple
=
(
'plain'
,
None
,
None
)):
on_proxy_failure
=
None
,
on_stream_error_cb
=
None
,
proxy
=
None
,
secure_tuple
=
(
'plain'
,
None
,
None
)):
"""
Open XMPP connection (open XML streams in both directions)
...
...
@@ -161,6 +162,7 @@ class NonBlockingClient:
self
.
on_connect
=
on_connect
self
.
on_connect_failure
=
on_connect_failure
self
.
on_proxy_failure
=
on_proxy_failure
self
.
on_stream_error_cb
=
on_stream_error_cb
self
.
desired_security
,
self
.
cacerts
,
self
.
mycerts
=
secure_tuple
self
.
Connection
=
None
self
.
Port
=
port
...
...
@@ -350,10 +352,12 @@ class NonBlockingClient:
# sometimes <features> are received together with document
# attributes and sometimes on next receive...
self
.
Dispatcher
.
ProcessNonBlocking
(
data
)
if
not
self
.
got_features
:
self
.
_xmpp_connect_machine
(
mode
=
'FAILURE'
,
data
=
'Missing <features> in 1.0 stream'
)
if
self
.
got_see_other_host
:
log
.
info
(
'got see-other-host'
)
self
.
on_stream_error_cb
(
self
,
self
.
got_see_other_host
)
elif
not
self
.
got_features
:
self
.
_xmpp_connect_machine
(
mode
=
'FAILURE'
,
data
=
'Missing <features> in 1.0 stream'
)
else
:
log
.
info
(
'got STREAM FEATURES in second recv'
)
self
.
_xmpp_connect_machine
(
mode
=
'STREAM_STARTED'
)
...
...
nbxmpp/dispatcher_nb.py
View file @
51689ec9
...
...
@@ -415,6 +415,9 @@ class XMPPDispatcher(PlugIn):
if
name
==
'features'
:
self
.
_owner
.
got_features
=
True
session
.
Stream
.
features
=
stanza
elif
name
==
'error'
:
if
stanza
.
getTag
(
'see-other-host'
):
self
.
_owner
.
got_see_other_host
=
stanza
xmlns
=
stanza
.
getNamespace
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment