1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

relay: add option relay.network.clients_purge_delay

This commit is contained in:
Sebastien Helleu
2014-02-23 20:32:42 +01:00
parent 897bb0950c
commit fdfee08cf8
22 changed files with 138 additions and 18 deletions
+23 -5
View File
@@ -822,18 +822,34 @@ relay_client_send (struct t_relay_client *client, const char *data,
int
relay_client_timer_cb (void *data, int remaining_calls)
{
struct t_relay_client *ptr_client;
int num_sent, i;
struct t_relay_client *ptr_client, *ptr_next_client;
int num_sent, i, purge_delay;
char *buf;
time_t current_time;
/* make C compiler happy */
(void) data;
(void) remaining_calls;
for (ptr_client = relay_clients; ptr_client;
ptr_client = ptr_client->next_client)
purge_delay = weechat_config_integer (relay_config_network_clients_purge_delay);
current_time = time (NULL);
ptr_client = relay_clients;
while (ptr_client)
{
if (ptr_client->sock >= 0)
ptr_next_client = ptr_client->next_client;
if (RELAY_CLIENT_HAS_ENDED(ptr_client))
{
if ((purge_delay >= 0)
&& (current_time >= ptr_client->end_time + (purge_delay * 60)))
{
relay_client_free (ptr_client);
relay_buffer_refresh (NULL);
}
}
else if (ptr_client->sock >= 0)
{
while (ptr_client->outqueue)
{
@@ -960,6 +976,8 @@ relay_client_timer_cb (void *data, int remaining_calls)
}
}
}
ptr_client = ptr_next_client;
}
return WEECHAT_RC_OK;
+8
View File
@@ -52,6 +52,7 @@ struct t_config_option *relay_config_color_text_selected;
struct t_config_option *relay_config_network_allowed_ips;
struct t_config_option *relay_config_network_bind_address;
struct t_config_option *relay_config_network_clients_purge_delay;
struct t_config_option *relay_config_network_compression_level;
struct t_config_option *relay_config_network_ipv6;
struct t_config_option *relay_config_network_max_clients;
@@ -604,6 +605,13 @@ relay_config_init ()
"local machine only)"),
NULL, 0, 0, "", NULL, 0, NULL, NULL,
&relay_config_change_network_bind_address_cb, NULL, NULL, NULL);
relay_config_network_clients_purge_delay = weechat_config_new_option (
relay_config_file, ptr_section,
"clients_purge_delay", "integer",
N_("delay for purging disconnected clients (in minutes, 0 = purge "
"clients immediately, -1 = never purge)"),
NULL, -1, 60 * 24 * 30, "0", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_network_compression_level = weechat_config_new_option (
relay_config_file, ptr_section,
"compression_level", "integer",
+1
View File
@@ -38,6 +38,7 @@ extern struct t_config_option *relay_config_color_text_selected;
extern struct t_config_option *relay_config_network_allowed_ips;
extern struct t_config_option *relay_config_network_bind_address;
extern struct t_config_option *relay_config_network_clients_purge_delay;
extern struct t_config_option *relay_config_network_compression_level;
extern struct t_config_option *relay_config_network_ipv6;
extern struct t_config_option *relay_config_network_max_clients;