diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-23 20:32:42 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-23 20:32:42 +0100 |
commit | fdfee08cf83f5547cdf07bda1f3745073056caa0 (patch) | |
tree | b4c9a3e3f9b640c576210ffa05c4f22c08ea8b63 | |
parent | 897bb0950cd1a2ecf6dd42394419efc40ac69460 (diff) | |
download | weechat-fdfee08cf83f5547cdf07bda1f3745073056caa0.zip |
relay: add option relay.network.clients_purge_delay
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | doc/de/autogen/user/relay_options.txt | 5 | ||||
-rw-r--r-- | doc/en/autogen/user/relay_options.txt | 5 | ||||
-rw-r--r-- | doc/fr/autogen/user/relay_options.txt | 5 | ||||
-rw-r--r-- | doc/it/autogen/user/relay_options.txt | 5 | ||||
-rw-r--r-- | doc/ja/autogen/user/relay_options.txt | 5 | ||||
-rw-r--r-- | doc/pl/autogen/user/relay_options.txt | 5 | ||||
-rw-r--r-- | po/cs.po | 7 | ||||
-rw-r--r-- | po/de.po | 7 | ||||
-rw-r--r-- | po/es.po | 7 | ||||
-rw-r--r-- | po/fr.po | 11 | ||||
-rw-r--r-- | po/hu.po | 7 | ||||
-rw-r--r-- | po/it.po | 7 | ||||
-rw-r--r-- | po/ja.po | 7 | ||||
-rw-r--r-- | po/pl.po | 7 | ||||
-rw-r--r-- | po/pt_BR.po | 7 | ||||
-rw-r--r-- | po/ru.po | 7 | ||||
-rw-r--r-- | po/tr.po | 7 | ||||
-rw-r--r-- | po/weechat.pot | 7 | ||||
-rw-r--r-- | src/plugins/relay/relay-client.c | 28 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.c | 8 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.h | 1 |
22 files changed, 138 insertions, 18 deletions
@@ -48,6 +48,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * lua: fix interpreter used after unload of a script * perl: fix context used after unload of a script * python: fix interpreter used after unload of a script +* relay: add option relay.network.clients_purge_delay * relay: fix freeze after /upgrade when many disconnected clients still exist * relay: fix NULL pointer when reading buffer lines for irc backlog * scripts: fix crash when a signal is received with type "int" and NULL pointer diff --git a/doc/de/autogen/user/relay_options.txt b/doc/de/autogen/user/relay_options.txt index 4def4a4ae..4190b2aef 100644 --- a/doc/de/autogen/user/relay_options.txt +++ b/doc/de/autogen/user/relay_options.txt @@ -88,6 +88,11 @@ ** Typ: Zeichenkette ** Werte: beliebige Zeichenkette (Standardwert: `""`) +* [[option_relay.network.clients_purge_delay]] *relay.network.clients_purge_delay* +** Beschreibung: `delay for purging disconnected clients (in minutes, 0 = purge clients immediately, -1 = never purge)` +** Typ: integer +** Werte: -1 .. 43200 (Standardwert: `0`) + * [[option_relay.network.compression_level]] *relay.network.compression_level* ** Beschreibung: `Kompressionsstärke der Pakete die durch das WeeChat Protokoll an den Client gesendet werden sollen (0 = Kompression deaktiviert, 1 = niedrige Kompression ... 9 = stärkste Kompression)` ** Typ: integer diff --git a/doc/en/autogen/user/relay_options.txt b/doc/en/autogen/user/relay_options.txt index 114d257bd..70bfe3d3f 100644 --- a/doc/en/autogen/user/relay_options.txt +++ b/doc/en/autogen/user/relay_options.txt @@ -88,6 +88,11 @@ ** type: string ** values: any string (default value: `""`) +* [[option_relay.network.clients_purge_delay]] *relay.network.clients_purge_delay* +** description: `delay for purging disconnected clients (in minutes, 0 = purge clients immediately, -1 = never purge)` +** type: integer +** values: -1 .. 43200 (default value: `0`) + * [[option_relay.network.compression_level]] *relay.network.compression_level* ** description: `compression level for packets sent to client with WeeChat protocol (0 = disable compression, 1 = low compression ... 9 = best compression)` ** type: integer diff --git a/doc/fr/autogen/user/relay_options.txt b/doc/fr/autogen/user/relay_options.txt index 6a4fbb434..9c234541b 100644 --- a/doc/fr/autogen/user/relay_options.txt +++ b/doc/fr/autogen/user/relay_options.txt @@ -88,6 +88,11 @@ ** type: chaîne ** valeurs: toute chaîne (valeur par défaut: `""`) +* [[option_relay.network.clients_purge_delay]] *relay.network.clients_purge_delay* +** description: `délai pour purger les clients déconnectés (en minutes, 0 = purger les clients immédiatement, -1 = ne jamais purger)` +** type: entier +** valeurs: -1 .. 43200 (valeur par défaut: `0`) + * [[option_relay.network.compression_level]] *relay.network.compression_level* ** description: `niveau de compression pour les paquets envoyés au client avec le protocole WeeChat (0 = désactiver la compression, 1 = peu de compression ... 9 = meilleure compression)` ** type: entier diff --git a/doc/it/autogen/user/relay_options.txt b/doc/it/autogen/user/relay_options.txt index 9254c72ff..22b29063d 100644 --- a/doc/it/autogen/user/relay_options.txt +++ b/doc/it/autogen/user/relay_options.txt @@ -88,6 +88,11 @@ ** tipo: stringa ** valori: qualsiasi stringa (valore predefinito: `""`) +* [[option_relay.network.clients_purge_delay]] *relay.network.clients_purge_delay* +** descrizione: `delay for purging disconnected clients (in minutes, 0 = purge clients immediately, -1 = never purge)` +** tipo: intero +** valori: -1 .. 43200 (valore predefinito: `0`) + * [[option_relay.network.compression_level]] *relay.network.compression_level* ** descrizione: `livello di compressione per i pacchetti inviati al client con il protocollo WeeChat (0 = disabilita compressione, 1 = compressione bassa ... 9 = compressione migliore)` ** tipo: intero diff --git a/doc/ja/autogen/user/relay_options.txt b/doc/ja/autogen/user/relay_options.txt index d4d5b8d63..c70cc639f 100644 --- a/doc/ja/autogen/user/relay_options.txt +++ b/doc/ja/autogen/user/relay_options.txt @@ -88,6 +88,11 @@ ** タイプ: 文字列 ** 値: 未制約文字列 (デフォルト値: `""`) +* [[option_relay.network.clients_purge_delay]] *relay.network.clients_purge_delay* +** 説明: `delay for purging disconnected clients (in minutes, 0 = purge clients immediately, -1 = never purge)` +** タイプ: 整数 +** 値: -1 .. 43200 (デフォルト値: `0`) + * [[option_relay.network.compression_level]] *relay.network.compression_level* ** 説明: `WeeChat プロトコルでクライアントに送信するパケットの圧縮レベル (0 = 圧縮しない、1 = 低圧縮 ... 9 = 高圧縮)` ** タイプ: 整数 diff --git a/doc/pl/autogen/user/relay_options.txt b/doc/pl/autogen/user/relay_options.txt index 5179bf009..205916525 100644 --- a/doc/pl/autogen/user/relay_options.txt +++ b/doc/pl/autogen/user/relay_options.txt @@ -88,6 +88,11 @@ ** typ: ciąg ** wartości: dowolny ciąg (domyślna wartość: `""`) +* [[option_relay.network.clients_purge_delay]] *relay.network.clients_purge_delay* +** opis: `delay for purging disconnected clients (in minutes, 0 = purge clients immediately, -1 = never purge)` +** typ: liczba +** wartości: -1 .. 43200 (domyślna wartość: `0`) + * [[option_relay.network.compression_level]] *relay.network.compression_level* ** opis: `stopień kompresji pakietów wysyłanych do klienta za pomocą protokołu WeeChat (0 = kompresja wyłączona, 1 = niska kompresja ... 9 = najwyższa kompresja)` ** typ: liczba @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-20 12:24+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8865,6 +8865,11 @@ msgstr "" "počítače)" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-20 12:24+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n" @@ -9863,6 +9863,11 @@ msgstr "" "Verbindung mit dem lokalen Rechner hergestellt werden)" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-20 12:25+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9150,6 +9150,11 @@ msgstr "" "solamente)" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" -"PO-Revision-Date: 2014-02-21 17:57+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" +"PO-Revision-Date: 2014-02-23 20:29+0100\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -9623,6 +9623,13 @@ msgstr "" "machine locale seulement)" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" +"délai pour purger les clients déconnectés (en minutes, 0 = purger les " +"clients immédiatement, -1 = ne jamais purger)" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-20 12:25+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8291,6 +8291,11 @@ msgid "" msgstr "" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-20 12:25+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9294,6 +9294,11 @@ msgstr "" "macchina locale)" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-20 12:25+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/WeeChat>\n" @@ -9275,6 +9275,11 @@ msgstr "" "る、\"127.0.0.1\" を使えばローカルマシンからの接続のみ許可)" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-20 12:25+0100\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9450,6 +9450,11 @@ msgstr "" "maszyny)" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index 6345e8f36..7cef52516 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-20 12:25+0100\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8510,6 +8510,11 @@ msgstr "" "interfaces, use \"127.0.0.1\" para permitir somente conexões locais)" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-20 12:25+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8318,6 +8318,11 @@ msgid "" msgstr "" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2014-02-16 11:21+0100\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7419,6 +7419,11 @@ msgid "" msgstr "" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index a6771a0a7..03f79ec9b 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-02-21 17:56+0100\n" +"POT-Creation-Date: 2014-02-23 20:28+0100\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7379,6 +7379,11 @@ msgid "" msgstr "" msgid "" +"delay for purging disconnected clients (in minutes, 0 = purge clients " +"immediately, -1 = never purge)" +msgstr "" + +msgid "" "compression level for packets sent to client with WeeChat protocol (0 = " "disable compression, 1 = low compression ... 9 = best compression)" msgstr "" diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c index dd5a58582..2584fd4d2 100644 --- a/src/plugins/relay/relay-client.c +++ b/src/plugins/relay/relay-client.c @@ -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; diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c index e0e46cbe1..0ca6c4fa0 100644 --- a/src/plugins/relay/relay-config.c +++ b/src/plugins/relay/relay-config.c @@ -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", diff --git a/src/plugins/relay/relay-config.h b/src/plugins/relay/relay-config.h index a26cd9023..7cda6a25b 100644 --- a/src/plugins/relay/relay-config.h +++ b/src/plugins/relay/relay-config.h @@ -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; |