Don't hook the timer hook before we're connected.
This commit is contained in:
parent
a4d4e56919
commit
594706e0af
2 changed files with 18 additions and 8 deletions
9
main.py
9
main.py
|
@ -225,6 +225,15 @@ def connect_cb(data, status, gnutls_rc, sock, error, ip_address):
|
||||||
server.name
|
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.fd_hook = hook
|
||||||
server.connected = True
|
server.connected = True
|
||||||
server.connecting = False
|
server.connecting = False
|
||||||
|
|
|
@ -78,14 +78,15 @@ def connect(server):
|
||||||
if not server.server_buffer:
|
if not server.server_buffer:
|
||||||
create_server_buffer(server)
|
create_server_buffer(server)
|
||||||
|
|
||||||
if not server.timer_hook:
|
ssl_message = " (SSL)" if server.ssl_context.check_hostname else ""
|
||||||
server.timer_hook = W.hook_timer(
|
|
||||||
1 * 1000,
|
message = "{prefix}matrix: Connecting to {server}:{port}{ssl}...".format(
|
||||||
0,
|
prefix=W.prefix("network"),
|
||||||
0,
|
server=server.address,
|
||||||
"matrix_timer_cb",
|
port=server.port,
|
||||||
server.name
|
ssl=ssl_message)
|
||||||
)
|
|
||||||
|
W.prnt(server.server_buffer, message)
|
||||||
|
|
||||||
W.hook_connect("", server.address, server.port, 1, 0, "",
|
W.hook_connect("", server.address, server.port, 1, 0, "",
|
||||||
"connect_cb", server.name)
|
"connect_cb", server.name)
|
||||||
|
|
Loading…
Add table
Reference in a new issue