mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:03:14 +02:00
core: add option "-quit" for command /upgrade (save session and quit without restarting WeeChat, for delayed restoration)
This commit is contained in:
+25
-20
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user