diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-10-19 12:36:38 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-10-19 12:36:38 +0200 |
commit | edb95a8fd22021c6bcbde001d0e0f800bf335f57 (patch) | |
tree | 297d819e05d102d61ae8bfe2b665274252c0bd28 /src/plugins/irc | |
parent | cb56b7bc8ec1c0b960ef0fb52e1766af1693d409 (diff) | |
download | weechat-edb95a8fd22021c6bcbde001d0e0f800bf335f57.zip |
Fix lock when disconnecting SSL server that is not yet successfully connected
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-server.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 85f5e9aca..795fa2f11 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -1842,30 +1842,34 @@ irc_server_timer_check_away (void *empty) void irc_server_close_connection (struct t_irc_server *server) { - if (server->hook_connect) - { - weechat_unhook (server->hook_connect); - server->hook_connect = NULL; - } if (server->hook_fd) { weechat_unhook (server->hook_fd); server->hook_fd = NULL; } - /* close network socket */ - if (server->sock != -1) + if (server->hook_connect) + { + weechat_unhook (server->hook_connect); + server->hook_connect = NULL; + } + else { #ifdef HAVE_GNUTLS - if (server->ssl_connected) - gnutls_bye (server->gnutls_sess, GNUTLS_SHUT_WR); + /* close SSL connection */ + if ((server->sock != -1) && (server->ssl_connected)) + { + if (server->ssl_connected) + gnutls_bye (server->gnutls_sess, GNUTLS_SHUT_WR); + if (server->ssl_connected) + gnutls_deinit (server->gnutls_sess); + } #endif + } + if (server->sock != -1) + { close (server->sock); server->sock = -1; -#ifdef HAVE_GNUTLS - if (server->ssl_connected) - gnutls_deinit (server->gnutls_sess); -#endif } /* free any pending message */ |