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
norstbox
gajim
Commits
71314f2b
Commit
71314f2b
authored
Apr 08, 2006
by
dkirov
Browse files
don't try to reconnect if socket was never
connected
parent
077e3e10
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/common/connection.py
View file @
71314f2b
...
...
@@ -300,7 +300,7 @@ class Connection(ConnectionHandlers):
self
.
_hosts
=
[
i
for
i
in
result_array
]
self
.
connect_to_next_host
()
def
connect_to_next_host
(
self
):
def
connect_to_next_host
(
self
,
retry
=
False
):
if
len
(
self
.
_hosts
):
if
self
.
last_connection
:
self
.
last_connection
.
socket
.
disconnect
()
...
...
@@ -325,7 +325,7 @@ class Connection(ConnectionHandlers):
secure
=
self
.
_secure
)
return
else
:
if
self
.
retrycount
>
10
:
if
not
retry
or
self
.
retrycount
>
10
:
self
.
retrycount
=
0
self
.
time_to_reconnect
=
None
self
.
on_connect_failure
()
...
...
src/common/xmpp/client_nb.py
View file @
71314f2b
...
...
@@ -118,11 +118,11 @@ class NBCommonClient(CommonClient):
self
.
on_stream_start
=
on_stream_start
self
.
onreceive
(
self
.
_on_receive_document_attrs
)
def
_on_connected_failure
(
self
):
def
_on_connected_failure
(
self
,
retry
=
None
):
if
self
.
socket
:
self
.
socket
.
disconnect
()
if
self
.
on_connect_failure
:
self
.
on_connect_failure
()
self
.
on_connect_failure
(
retry
)
def
_on_connected
(
self
):
self
.
connected
=
'tcp'
...
...
src/common/xmpp/transports_nb.py
View file @
71314f2b
...
...
@@ -224,9 +224,10 @@ class NonBlockingTcp(PlugIn, IdleObject):
if
errnum
!=
socket
.
SSL_ERROR_EOF
:
# 8 EOF occurred in violation of protocol
self
.
DEBUG
(
'Socket error while receiving data'
,
'error'
)
# TODO: change with on_connect_failure, needs some
# changes in connection.py in order to work properly
self
.
pollend
()
self
.
disconnect
()
if
self
.
on_connect_failure
:
self
.
on_connect_failure
(
True
)
self
.
on_connect_failure
=
None
if
self
.
state
>=
0
:
self
.
disconnect
()
return
...
...
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