mirror of
https://github.com/weechat/weechat.git
synced 2026-07-02 15:53:12 +02:00
core: unhook TLS handshake fd before calling connect callback
When there are multiple addresses for a server and a TLS handshake failure occurs, the next server in the list will connect and then timeout without performing any TLS handshake. This is because irc_server_close_connection closes server->sock so the next pipe to be created reuses that fd, but the hook for the handshake fd still exists when the next connection attempt is started. The hook for network_connect_child_read_cb is never added because a hook for the reused fd number still exists. Resolve this by removing the handshake hook before calling the connect callback.
This commit is contained in:
@@ -1305,6 +1305,7 @@ network_connect_gnutls_handshake_fd_cb (const void *pointer, void *data,
|
||||
}
|
||||
else if (rc != GNUTLS_E_SUCCESS)
|
||||
{
|
||||
unhook (HOOK_CONNECT(hook_connect, handshake_hook_fd));
|
||||
(void) (HOOK_CONNECT(hook_connect, callback))
|
||||
(hook_connect->callback_pointer,
|
||||
hook_connect->callback_data,
|
||||
@@ -1326,6 +1327,7 @@ network_connect_gnutls_handshake_fd_cb (const void *pointer, void *data,
|
||||
*/
|
||||
if (hook_connect_gnutls_verify_certificates (*HOOK_CONNECT(hook_connect, gnutls_sess)) != 0)
|
||||
{
|
||||
unhook (HOOK_CONNECT(hook_connect, handshake_hook_fd));
|
||||
(void) (HOOK_CONNECT(hook_connect, callback))
|
||||
(hook_connect->callback_pointer,
|
||||
hook_connect->callback_data,
|
||||
@@ -1371,6 +1373,7 @@ network_connect_gnutls_handshake_timer_cb (const void *pointer,
|
||||
|
||||
HOOK_CONNECT(hook_connect, handshake_hook_timer) = NULL;
|
||||
|
||||
unhook (HOOK_CONNECT(hook_connect, handshake_hook_fd));
|
||||
(void) (HOOK_CONNECT(hook_connect, callback))
|
||||
(hook_connect->callback_pointer,
|
||||
hook_connect->callback_data,
|
||||
|
||||
Reference in New Issue
Block a user