diff options
author | lovetox <philipp@hoerist.com> | 2020-03-17 18:47:32 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2020-03-17 18:47:32 +0300 |
commit | 57a3f73f6c0d71d73f2efafb845a64de381dfa47 (patch) | |
tree | ea64eb29f6e8abbc5b74d0b0c1b556a2281436ea /nbxmpp | |
parent | 27c4844c72868ca83cb77498d462f11fc2e12e61 (diff) |
TCP: Set timeout when connecting
Timeout is set to 7 seconds and reset to 0 after connecting was
successful
Diffstat (limited to 'nbxmpp')
-rw-r--r-- | nbxmpp/tcp.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/nbxmpp/tcp.py b/nbxmpp/tcp.py index b33651f..8a66fd9 100644 --- a/nbxmpp/tcp.py +++ b/nbxmpp/tcp.py @@ -38,6 +38,7 @@ class TCPConnection(Connection): Connection.__init__(self, *args, **kwargs) self._client = Gio.SocketClient.new() + self._client.set_timeout(7) if self._address.proxy is not None: self._proxy_resolver = self._address.proxy.get_resolver() @@ -121,6 +122,8 @@ class TCPConnection(Connection): self._finalize('connection-failed') return + # We use the timeout only for connecting + self._con.get_socket().set_timeout(0) self._con.set_graceful_disconnect(True) self._con.get_socket().set_keepalive(True) |