Don't hook the timer hook before we're connected.

This commit is contained in:
poljar (Damir Jelić) 2018-01-30 12:58:50 +01:00
parent a4d4e56919
commit 594706e0af
2 changed files with 18 additions and 8 deletions

View file

@ -225,6 +225,15 @@ def connect_cb(data, status, gnutls_rc, sock, error, ip_address):
server.name
)
if not server.timer_hook:
server.timer_hook = W.hook_timer(
1 * 1000,
0,
0,
"matrix_timer_cb",
server.name
)
server.fd_hook = hook
server.connected = True
server.connecting = False

View file

@ -78,14 +78,15 @@ def connect(server):
if not server.server_buffer:
create_server_buffer(server)
if not server.timer_hook:
server.timer_hook = W.hook_timer(
1 * 1000,
0,
0,
"matrix_timer_cb",
server.name
)
ssl_message = " (SSL)" if server.ssl_context.check_hostname else ""
message = "{prefix}matrix: Connecting to {server}:{port}{ssl}...".format(
prefix=W.prefix("network"),
server=server.address,
port=server.port,
ssl=ssl_message)
W.prnt(server.server_buffer, message)
W.hook_connect("", server.address, server.port, 1, 0, "",
"connect_cb", server.name)