summaryrefslogtreecommitdiff
path: root/src/plugins/relay/relay.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/relay/relay.c')
-rw-r--r--src/plugins/relay/relay.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c
index 5fa70ae7a..a60be6d04 100644
--- a/src/plugins/relay/relay.c
+++ b/src/plugins/relay/relay.c
@@ -84,7 +84,7 @@ relay_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
{
struct t_relay_server *ptr_server;
struct t_relay_client *ptr_client;
- int disconnected;
+ int quit, ssl_disconnected;
/* make C compiler happy */
(void) data;
@@ -101,38 +101,43 @@ relay_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
relay_server_close_socket (ptr_server);
}
- /*
- * FIXME: it's not possible to upgrade with SSL clients connected (GnuTLS
- * lib can't reload data after upgrade), so we close connection for
- * all SSL clients currently connected
- */
- disconnected = 0;
+ quit = (signal_data && (strcmp (signal_data, "quit") == 0));
+ ssl_disconnected = 0;
+
for (ptr_client = relay_clients; ptr_client;
ptr_client = ptr_client->next_client)
{
- if ((ptr_client->sock >= 0) && ptr_client->ssl)
+ /*
+ * FIXME: it's not possible to upgrade with SSL clients connected (GnuTLS
+ * lib can't reload data after upgrade), so we close connection for
+ * all SSL clients currently connected
+ */
+ if ((ptr_client->sock >= 0) && (ptr_client->ssl || quit))
{
- disconnected++;
- weechat_printf (NULL,
- _("%s%s: disconnecting from client %s%s%s because "
- "upgrade can't work for clients connected via SSL"),
- weechat_prefix ("error"),
- RELAY_PLUGIN_NAME,
- RELAY_COLOR_CHAT_CLIENT,
- ptr_client->desc,
- RELAY_COLOR_CHAT);
+ if (!quit)
+ {
+ ssl_disconnected++;
+ weechat_printf (NULL,
+ _("%s%s: disconnecting from client %s%s%s because "
+ "upgrade can't work for clients connected via SSL"),
+ weechat_prefix ("error"),
+ RELAY_PLUGIN_NAME,
+ RELAY_COLOR_CHAT_CLIENT,
+ ptr_client->desc,
+ RELAY_COLOR_CHAT);
+ }
relay_client_set_status (ptr_client, RELAY_STATUS_DISCONNECTED);
}
}
- if (disconnected > 0)
+ if (ssl_disconnected > 0)
{
weechat_printf (NULL,
/* TRANSLATORS: "%s" after "%d" is "client" or "clients" */
_("%s%s: disconnected from %d %s (SSL connection "
"not supported with upgrade)"),
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
- disconnected,
- NG_("client", "clients", disconnected));
+ ssl_disconnected,
+ NG_("client", "clients", ssl_disconnected));
}
return WEECHAT_RC_OK;