diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2016-02-08 21:14:48 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2016-02-08 21:14:48 +0100 |
commit | 45a1174000c23d0bfce5479835a831845ea951f3 (patch) | |
tree | d892b21359b6e4e5b88ecff36316b4eae7b6fef5 | |
parent | c9a8f23cc78546412bc645d68b344d867ee85bc6 (diff) | |
download | weechat-45a1174000c23d0bfce5479835a831845ea951f3.zip |
relay: fix the max number of clients connected on a port, allow value 0 for "no limit" (closes #669)
-rw-r--r-- | ChangeLog.asciidoc | 2 | ||||
-rw-r--r-- | doc/de/autogen/user/relay_options.asciidoc | 4 | ||||
-rw-r--r-- | doc/en/autogen/user/relay_options.asciidoc | 4 | ||||
-rw-r--r-- | doc/fr/autogen/user/relay_options.asciidoc | 4 | ||||
-rw-r--r-- | doc/it/autogen/user/relay_options.asciidoc | 4 | ||||
-rw-r--r-- | doc/ja/autogen/user/relay_options.asciidoc | 4 | ||||
-rw-r--r-- | doc/pl/autogen/user/relay_options.asciidoc | 4 | ||||
-rw-r--r-- | po/cs.po | 25 | ||||
-rw-r--r-- | po/de.po | 22 | ||||
-rw-r--r-- | po/es.po | 22 | ||||
-rw-r--r-- | po/fr.po | 26 | ||||
-rw-r--r-- | po/hu.po | 21 | ||||
-rw-r--r-- | po/it.po | 22 | ||||
-rw-r--r-- | po/ja.po | 21 | ||||
-rw-r--r-- | po/pl.po | 24 | ||||
-rw-r--r-- | po/pt_BR.po | 20 | ||||
-rw-r--r-- | po/ru.po | 24 | ||||
-rw-r--r-- | po/tr.po | 17 | ||||
-rw-r--r-- | po/weechat.pot | 19 | ||||
-rw-r--r-- | src/plugins/relay/relay-client.c | 30 | ||||
-rw-r--r-- | src/plugins/relay/relay-client.h | 2 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.c | 4 | ||||
-rw-r--r-- | src/plugins/relay/relay-server.c | 64 |
23 files changed, 318 insertions, 71 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index b9c51fb3e..a06d90272 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -35,6 +35,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] keep_eol is 2 and the string ends with separators * irc: add missing completion "*" for target in command /msg * irc: fix /msg command with multiple targets including "*" +* relay: fix the max number of clients connected on a port, allow value 0 for + "no limit" (issue #669) * relay: fix decoding of multiple frames in a single websocket message, send PONG on PING received in a websocket frame (issue #675) * relay: fix command "input" received from clients with only spaces in diff --git a/doc/de/autogen/user/relay_options.asciidoc b/doc/de/autogen/user/relay_options.asciidoc index 27e754cfa..7c3c9ceff 100644 --- a/doc/de/autogen/user/relay_options.asciidoc +++ b/doc/de/autogen/user/relay_options.asciidoc @@ -113,9 +113,9 @@ ** Werte: on, off (Standardwert: `on`) * [[option_relay.network.max_clients]] *relay.network.max_clients* -** Beschreibung: `maximale Anzahl an Clients die mit einem Port verbunden sein dürfen` +** Beschreibung: `maximum number of clients connecting to a port (0 = no limit)` ** Typ: integer -** Werte: 1 .. 1024 (Standardwert: `5`) +** Werte: 0 .. 2147483647 (Standardwert: `5`) * [[option_relay.network.password]] *relay.network.password* ** Beschreibung: `Passwort wird von Clients benötigt um Zugriff auf dieses Relay zu erhalten (kein Eintrag bedeutet, dass kein Passwort benötigt wird) (Hinweis: Inhalt wird evaluiert, siehe /help eval)` diff --git a/doc/en/autogen/user/relay_options.asciidoc b/doc/en/autogen/user/relay_options.asciidoc index 85fdf8c31..67069015f 100644 --- a/doc/en/autogen/user/relay_options.asciidoc +++ b/doc/en/autogen/user/relay_options.asciidoc @@ -113,9 +113,9 @@ ** values: on, off (default value: `on`) * [[option_relay.network.max_clients]] *relay.network.max_clients* -** description: `maximum number of clients connecting to a port` +** description: `maximum number of clients connecting to a port (0 = no limit)` ** type: integer -** values: 1 .. 1024 (default value: `5`) +** values: 0 .. 2147483647 (default value: `5`) * [[option_relay.network.password]] *relay.network.password* ** description: `password required by clients to access this relay (empty value means no password required) (note: content is evaluated, see /help eval)` diff --git a/doc/fr/autogen/user/relay_options.asciidoc b/doc/fr/autogen/user/relay_options.asciidoc index d957d097b..d3421dd70 100644 --- a/doc/fr/autogen/user/relay_options.asciidoc +++ b/doc/fr/autogen/user/relay_options.asciidoc @@ -113,9 +113,9 @@ ** valeurs: on, off (valeur par défaut: `on`) * [[option_relay.network.max_clients]] *relay.network.max_clients* -** description: `nombre maximum de clients qui se connectent sur un port` +** description: `nombre maximum de clients qui se connectent sur un port (0 = pas de limite)` ** type: entier -** valeurs: 1 .. 1024 (valeur par défaut: `5`) +** valeurs: 0 .. 2147483647 (valeur par défaut: `5`) * [[option_relay.network.password]] *relay.network.password* ** description: `mot de passe requis par les clients pour accéder à ce relai (une valeur vide indique que le mot de passe n'est pas nécessaire) (note : le contenu est évalué, voir /help eval)` diff --git a/doc/it/autogen/user/relay_options.asciidoc b/doc/it/autogen/user/relay_options.asciidoc index d7e27c9a2..7f4e0a6c7 100644 --- a/doc/it/autogen/user/relay_options.asciidoc +++ b/doc/it/autogen/user/relay_options.asciidoc @@ -113,9 +113,9 @@ ** valori: on, off (valore predefinito: `on`) * [[option_relay.network.max_clients]] *relay.network.max_clients* -** descrizione: `numero massimo di client connessi ad una porta` +** descrizione: `maximum number of clients connecting to a port (0 = no limit)` ** tipo: intero -** valori: 1 .. 1024 (valore predefinito: `5`) +** valori: 0 .. 2147483647 (valore predefinito: `5`) * [[option_relay.network.password]] *relay.network.password* ** descrizione: `password richiesta dai client per accedere a questo relay (un valore nullo corrisponde a nessuna password richiesta) (nota: il contenuto viene valutato, consultare /help eval)` diff --git a/doc/ja/autogen/user/relay_options.asciidoc b/doc/ja/autogen/user/relay_options.asciidoc index 39ff692b7..7f6ca0f34 100644 --- a/doc/ja/autogen/user/relay_options.asciidoc +++ b/doc/ja/autogen/user/relay_options.asciidoc @@ -113,9 +113,9 @@ ** 値: on, off (デフォルト値: `on`) * [[option_relay.network.max_clients]] *relay.network.max_clients* -** 説明: `ポートに接続するクライアントの最大数` +** 説明: `maximum number of clients connecting to a port (0 = no limit)` ** タイプ: 整数 -** 値: 1 .. 1024 (デフォルト値: `5`) +** 値: 0 .. 2147483647 (デフォルト値: `5`) * [[option_relay.network.password]] *relay.network.password* ** 説明: `このリレーを利用するためにクライアントが必要なパスワード (空の場合パスワードなし) (注意: 値は評価されます、/help eval を参照してください)` diff --git a/doc/pl/autogen/user/relay_options.asciidoc b/doc/pl/autogen/user/relay_options.asciidoc index b3bf9cff9..0ceaf354b 100644 --- a/doc/pl/autogen/user/relay_options.asciidoc +++ b/doc/pl/autogen/user/relay_options.asciidoc @@ -113,9 +113,9 @@ ** wartości: on, off (domyślna wartość: `on`) * [[option_relay.network.max_clients]] *relay.network.max_clients* -** opis: `maksymalna ilość klientów łączących się na port` +** opis: `maximum number of clients connecting to a port (0 = no limit)` ** typ: liczba -** wartości: 1 .. 1024 (domyślna wartość: `5`) +** wartości: 0 .. 2147483647 (domyślna wartość: `5`) * [[option_relay.network.password]] *relay.network.password* ** opis: `hasło wymagane od klientów do połączenia z tym pośrednikiem (pusta wartość oznacza brak wymaganego hasła) (zawartość jest przetwarzana, zobacz /help eval)` @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-17 08:52+0100\n" "Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9680,7 +9680,8 @@ msgid "" "protocol name (see /help relay)" msgstr "" -msgid "maximum number of clients connecting to a port" +#, fuzzy +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "maximální počet klientů připojených k portu" #, fuzzy @@ -9768,6 +9769,14 @@ msgstr "%s: soket uzavřen pro %s (port %d)" msgid "%s%s: cannot accept client on port %d (%s): error %d %s" msgstr "%s%s: nemohu \"naslouchat\" na portu %d (%s): chyba %d %s" +#, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + #, fuzzy, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s%s: IP adresa proxy nenalezena" @@ -9798,7 +9807,17 @@ msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "%s%s: nemohu \"naslouchat\" na portu %d (%s): chyba %d %s" #, fuzzy, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "" +"%s: poslouchám na portu %d (přesměrování %s.%s, maximálně %d klientů)" +msgstr[1] "" +"%s: poslouchám na portu %d (přesměrování %s.%s, maximálně %d klientů)" +msgstr[2] "" +"%s: poslouchám na portu %d (přesměrování %s.%s, maximálně %d klientů)" + +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "%s: poslouchám na portu %d (přesměrování %s.%s, maximálně %d klientů)" #, c-format @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-17 09:27+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <>\n" @@ -11018,7 +11018,8 @@ msgstr "" "und IPv6 Protokoll, einzeln oder gemeinsam, erzwungen werden (siehe /help " "relay)" -msgid "maximum number of clients connecting to a port" +#, fuzzy +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "maximale Anzahl an Clients die mit einem Port verbunden sein dürfen" msgid "" @@ -11126,6 +11127,13 @@ msgid "%s%s: cannot accept client on port %d (%s): error %d %s" msgstr "%s%s: Der Client wird am Port %d (%s) nicht akzeptiert: Fehler %d %s" #, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" +msgstr[1] "" + +#, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s%s: IP Adresse \"%s\" für Relay nicht gültig" @@ -11156,8 +11164,14 @@ msgstr "%s%s: \"bind\" am Port %d (%s) nicht möglich: Fehler %d %s" msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "%s%s: \"listen\" an Port %d (%s) nicht möglich: Fehler %d %s" -#, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "%s: Lausche am Port %d (Relay: %s,%s, Max.: %d Clients)" +msgstr[1] "%s: Lausche am Port %d (Relay: %s,%s, Max.: %d Clients)" + +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "%s: Lausche am Port %d (Relay: %s,%s, Max.: %d Clients)" #, c-format @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-17 08:52+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -10017,7 +10017,8 @@ msgid "" "protocol name (see /help relay)" msgstr "" -msgid "maximum number of clients connecting to a port" +#, fuzzy +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "número máximo de clientes conectados a un puerto" #, fuzzy @@ -10105,6 +10106,13 @@ msgid "%s%s: cannot accept client on port %d (%s): error %d %s" msgstr "%s%s: no se puede aceptar el cliente en el puerto %d (%s)" #, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" +msgstr[1] "" + +#, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s%s: dirección IP \"%s\" no permitida por el repetidor" @@ -10133,8 +10141,14 @@ msgstr "%s%s: error con \"bind\" en el puerto %d (%s)" msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "%s%s: no se puede aceptar el cliente en el puerto %d (%s)" -#, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "%s: escuchando en el puerto %d (repetidor: %s, %s, max %d clientes)" +msgstr[1] "%s: escuchando en el puerto %d (repetidor: %s, %s, max %d clientes)" + +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "%s: escuchando en el puerto %d (repetidor: %s, %s, max %d clientes)" #, c-format @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" -"PO-Revision-Date: 2016-01-17 09:41+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" +"PO-Revision-Date: 2016-02-08 19:57+0100\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -10770,8 +10770,9 @@ msgstr "" "défaut) ; les protocoles IPv4 et IPv6 peuvent être forcés (individuellement " "ou ensemble) dans le nom du protocole (voir /help relay)" -msgid "maximum number of clients connecting to a port" -msgstr "nombre maximum de clients qui se connectent sur un port" +msgid "maximum number of clients connecting to a port (0 = no limit)" +msgstr "" +"nombre maximum de clients qui se connectent sur un port (0 = pas de limite)" msgid "" "password required by clients to access this relay (empty value means no " @@ -10875,6 +10876,13 @@ msgstr "" "%s%s : impossible d'accepter le client sur le port %d (%s) : erreur %d %s" #, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "%s%s : client non autorisé (%d client est autorisé à la fois)" +msgstr[1] "%s%s : client non autorisé (%d clients sont autorisés à la fois)" + +#, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s%s : adresse IP \"%s\" non autorisée pour le relai" @@ -10904,8 +10912,14 @@ msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "%s%s : \"listen\" impossible sur le port %d (%s) : erreur %d %s" #, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" -msgstr "%s : écoute sur le port %d (relai : %s, %s, max %d clients)" +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "%s : écoute sur le port %d (relai : %s, %s, max %d client)" +msgstr[1] "%s : écoute sur le port %d (relai : %s, %s, max %d clients)" + +#, c-format +msgid "%s: listening on port %d (relay: %s, %s)" +msgstr "%s : écoute sur le port %d (relai : %s, %s)" #, c-format msgid "%s%s: not enough memory for listening on new port" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-17 08:52+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9051,8 +9051,10 @@ msgid "" "protocol name (see /help relay)" msgstr "" -msgid "maximum number of clients connecting to a port" +#, fuzzy +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "" +"felhasználói parancsok maximális száma az előzményekben (0 = korlátlan)" msgid "" "password required by clients to access this relay (empty value means no " @@ -9138,6 +9140,13 @@ msgstr "FIFO cső bezárva\n" msgid "%s%s: cannot accept client on port %d (%s): error %d %s" msgstr "%s nem sikerült a csatornát létrehozni\n" +#, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" +msgstr[1] "" + #, fuzzy, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s cím \"%s\" nem található\n" @@ -9168,7 +9177,13 @@ msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "%s nem sikerült a csatornát létrehozni\n" #, fuzzy, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "%s nem sikerült a csatornát létrehozni\n" +msgstr[1] "%s nem sikerült a csatornát létrehozni\n" + +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "%s nem sikerült a csatornát létrehozni\n" #, fuzzy, c-format @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-17 08:52+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -10192,7 +10192,8 @@ msgid "" "protocol name (see /help relay)" msgstr "" -msgid "maximum number of clients connecting to a port" +#, fuzzy +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "numero massimo di client connessi ad una porta" msgid "" @@ -10284,6 +10285,13 @@ msgstr "" "%s%s: impossibile accettare il client sulla porta %d (%s): errore %d %s" #, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" +msgstr[1] "" + +#, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s%s: indirizzo IP \"%s\" non consentito per il relay" @@ -10313,8 +10321,14 @@ msgstr "%s%s: \"bind\" impossibile sulla porta %d (%s): errore %d %s" msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "%s%s: \"listen\" impossibile sulla porta %d (%s): errore %d %s" -#, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "%s: in ascolto sulla porta %d (relay: %s, %s, massimo %d client)" +msgstr[1] "%s: in ascolto sulla porta %d (relay: %s, %s, massimo %d client)" + +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "%s: in ascolto sulla porta %d (relay: %s, %s, massimo %d client)" #, c-format @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-27 09:00+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n" @@ -10371,7 +10371,8 @@ msgstr "" "トコルでプロトコルに IPv4 と IPv6 (個別または両方) を強制 (/help relay を参" "照)" -msgid "maximum number of clients connecting to a port" +#, fuzzy +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "ポートに接続するクライアントの最大数" msgid "" @@ -10468,6 +10469,12 @@ msgstr "" "%s" #, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" + +#, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s%s: IP アドレス \"%s\" はリレーの許可がありません" @@ -10498,8 +10505,14 @@ msgstr "" "%s%s: ポート %d (%s) ではクライアントを受け付けることができません: エラー %d " "%s" -#, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "" +"%s: ポート %d をリッスンしています (リレー: %s、%s、最大 %d クライアント)" + +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "" "%s: ポート %d をリッスンしています (リレー: %s、%s、最大 %d クライアント)" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-17 08:52+0100\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -10555,7 +10555,8 @@ msgstr "" "protokoły IPv4 i IPv6 mogą być wymuszane (pojedynczo lub razem) w nazwie " "protokołu (zobacz /help relay)" -msgid "maximum number of clients connecting to a port" +#, fuzzy +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "maksymalna ilość klientów łączących się na port" msgid "" @@ -10659,6 +10660,14 @@ msgid "%s%s: cannot accept client on port %d (%s): error %d %s" msgstr "%s%s: nie można zaakceptować klienta na porcie %d (%s): błąd %d %s" #, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +#, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s%s: adres IP \"%s\" nie posiada zezwolenia na połączenie" @@ -10687,8 +10696,15 @@ msgstr "%s%s: nie można wykonać \"bind\" na porcie %d (%s): błąd %d %s" msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "%s%s: nie można wykonać \"listen\" na porcie %d (%s): błąd %d %s" -#, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "%s: nasłuchuję na porcie %d (relay: %s, %s, max %d klientów)" +msgstr[1] "%s: nasłuchuję na porcie %d (relay: %s, %s, max %d klientów)" +msgstr[2] "%s: nasłuchuję na porcie %d (relay: %s, %s, max %d klientów)" + +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "%s: nasłuchuję na porcie %d (relay: %s, %s, max %d klientów)" #, c-format diff --git a/po/pt_BR.po b/po/pt_BR.po index e78f23981..b0e1cbba6 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: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-17 08:52+0100\n" "Last-Translator: Eduardo Elias <camponez@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9483,7 +9483,8 @@ msgid "" "protocol name (see /help relay)" msgstr "" -msgid "maximum number of clients connecting to a port" +#, fuzzy +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "número máximo de clientes conectando-se a uma porta" #, fuzzy @@ -9572,6 +9573,13 @@ msgid "%s%s: cannot accept client on port %d (%s): error %d %s" msgstr "%s%s: não foi possível aceitar o cliente na porta %d (%s): erro %d %s" #, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" +msgstr[1] "" + +#, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s%s: endereço IP \"%s\" não permitido para relay" @@ -9601,7 +9609,13 @@ msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "%s%s: não foi possível aceitar o cliente na porta %d (%s.%s)" #, fuzzy, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "%s: escutando na porta %d (relay: %s.%s, máximo de %d clientes)" +msgstr[1] "%s: escutando na porta %d (relay: %s.%s, máximo de %d clientes)" + +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "%s: escutando na porta %d (relay: %s.%s, máximo de %d clientes)" #, c-format @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-17 08:52+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9084,8 +9084,9 @@ msgid "" "protocol name (see /help relay)" msgstr "" -msgid "maximum number of clients connecting to a port" -msgstr "" +#, fuzzy +msgid "maximum number of clients connecting to a port (0 = no limit)" +msgstr "максимальное количество команд в истории (0 = не ограничено)" msgid "" "password required by clients to access this relay (empty value means no " @@ -9169,6 +9170,14 @@ msgstr "FIFO pipe закрыт\n" msgid "%s%s: cannot accept client on port %d (%s): error %d %s" msgstr "%s невозможно создать сокет\n" +#, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + #, fuzzy, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "%s адрес \"%s\" не найден\n" @@ -9199,7 +9208,14 @@ msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "%s невозможно создать сокет\n" #, fuzzy, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "%s невозможно создать сокет\n" +msgstr[1] "%s невозможно создать сокет\n" +msgstr[2] "%s невозможно создать сокет\n" + +#, fuzzy, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "%s невозможно создать сокет\n" #, fuzzy, c-format @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2016-01-05 07:51+0100\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8191,7 +8191,7 @@ msgid "" "protocol name (see /help relay)" msgstr "" -msgid "maximum number of clients connecting to a port" +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "" msgid "" @@ -8271,6 +8271,12 @@ msgid "%s%s: cannot accept client on port %d (%s): error %d %s" msgstr "" #, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" + +#, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "" @@ -8300,7 +8306,12 @@ msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "" #, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "" + +#, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "" #, c-format diff --git a/po/weechat.pot b/po/weechat.pot index b4b6a9b1b..f337e2182 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-01-17 08:51+0100\n" +"POT-Creation-Date: 2016-02-08 19:54+0100\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8116,7 +8116,7 @@ msgid "" "protocol name (see /help relay)" msgstr "" -msgid "maximum number of clients connecting to a port" +msgid "maximum number of clients connecting to a port (0 = no limit)" msgstr "" msgid "" @@ -8196,6 +8196,13 @@ msgid "%s%s: cannot accept client on port %d (%s): error %d %s" msgstr "" #, c-format +msgid "%s%s: client not allowed (max %d client is allowed at same time)" +msgid_plural "" +"%s%s: client not allowed (max %d clients are allowed at same time)" +msgstr[0] "" +msgstr[1] "" + +#, c-format msgid "%s%s: IP address \"%s\" not allowed for relay" msgstr "" @@ -8225,7 +8232,13 @@ msgid "%s%s: cannot \"listen\" on port %d (%s): error %d %s" msgstr "" #, c-format -msgid "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgid "%s: listening on port %d (relay: %s, %s, max %d client)" +msgid_plural "%s: listening on port %d (relay: %s, %s, max %d clients)" +msgstr[0] "" +msgstr[1] "" + +#, c-format +msgid "%s: listening on port %d (relay: %s, %s)" msgstr "" #, c-format diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c index 28aea18d5..76d66d263 100644 --- a/src/plugins/relay/relay-client.c +++ b/src/plugins/relay/relay-client.c @@ -162,6 +162,31 @@ relay_client_status_search (const char *name) } /* + * Returns the number of active clients (connecting or connected) on a given + * server port. + */ + +int +relay_client_count_active_by_port (int server_port) +{ + struct t_relay_client *ptr_client; + int count; + + count = 0; + for (ptr_client = relay_clients; ptr_client; + ptr_client = ptr_client->next_client) + { + if ((ptr_client->server_port == server_port) + && !RELAY_CLIENT_HAS_ENDED(ptr_client)) + { + count++; + } + } + + return count; +} + +/* * Sends a signal with the status of client ("relay_client_xxx"). */ @@ -1163,6 +1188,7 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server) new_client->id = (relay_clients) ? relay_clients->id + 1 : 1; new_client->desc = NULL; new_client->sock = sock; + new_client->server_port = server->port; new_client->ssl = server->ssl; #ifdef HAVE_GNUTLS new_client->hook_timer_handshake = NULL; @@ -1330,6 +1356,7 @@ relay_client_new_with_infolist (struct t_infolist *infolist) new_client->id = weechat_infolist_integer (infolist, "id"); new_client->desc = NULL; new_client->sock = weechat_infolist_integer (infolist, "sock"); + new_client->server_port = weechat_infolist_integer (infolist, "server_port"); new_client->ssl = weechat_infolist_integer (infolist, "ssl"); #ifdef HAVE_GNUTLS new_client->gnutls_sess = NULL; @@ -1636,6 +1663,8 @@ relay_client_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_integer (ptr_item, "sock", client->sock)) return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "server_port", client->server_port)) + return 0; if (!weechat_infolist_new_var_integer (ptr_item, "ssl", client->ssl)) return 0; #ifdef HAVE_GNUTLS @@ -1715,6 +1744,7 @@ relay_client_print_log () weechat_log_printf (" id. . . . . . . . . . : %d", ptr_client->id); weechat_log_printf (" desc. . . . . . . . . : '%s'", ptr_client->desc); weechat_log_printf (" sock. . . . . . . . . : %d", ptr_client->sock); + weechat_log_printf (" server_port . . . . . : %d", ptr_client->server_port); weechat_log_printf (" ssl . . . . . . . . . : %d", ptr_client->ssl); #ifdef HAVE_GNUTLS weechat_log_printf (" gnutls_sess . . . . . : 0x%lx", ptr_client->gnutls_sess); diff --git a/src/plugins/relay/relay-client.h b/src/plugins/relay/relay-client.h index 670c001d0..89f3166cd 100644 --- a/src/plugins/relay/relay-client.h +++ b/src/plugins/relay/relay-client.h @@ -87,6 +87,7 @@ struct t_relay_client int id; /* unique id (diff. for each client) */ char *desc; /* description, used for display */ int sock; /* socket for connection */ + int server_port; /* port used for connection */ int ssl; /* 1 if SSL is enabled */ #ifdef HAVE_GNUTLS gnutls_session_t gnutls_sess; /* gnutls session (only if SSL used) */ @@ -128,6 +129,7 @@ extern int relay_client_valid (struct t_relay_client *client); extern struct t_relay_client *relay_client_search_by_number (int number); extern struct t_relay_client *relay_client_search_by_id (int id); extern int relay_client_status_search (const char *name); +extern int relay_client_count_active_by_port (int server_port); extern void relay_client_set_desc (struct t_relay_client *client); extern int relay_client_recv_cb (void *arg_client, int fd); extern int relay_client_send (struct t_relay_client *client, diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c index ec1ec0474..6d12a24d4 100644 --- a/src/plugins/relay/relay-config.c +++ b/src/plugins/relay/relay-config.c @@ -748,8 +748,8 @@ relay_config_init () relay_config_network_max_clients = weechat_config_new_option ( relay_config_file, ptr_section, "max_clients", "integer", - N_("maximum number of clients connecting to a port"), - NULL, 1, 1024, "5", NULL, 0, + N_("maximum number of clients connecting to a port (0 = no limit)"), + NULL, 0, INT_MAX, "5", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); relay_config_network_password = weechat_config_new_option ( relay_config_file, ptr_section, diff --git a/src/plugins/relay/relay-server.c b/src/plugins/relay/relay-server.c index 56fd8da12..c454a6250 100644 --- a/src/plugins/relay/relay-server.c +++ b/src/plugins/relay/relay-server.c @@ -226,7 +226,7 @@ relay_server_sock_cb (void *data, int fd) struct sockaddr_in6 client_addr6; socklen_t client_addr_size; void *ptr_addr; - int client_fd, flags, set; + int client_fd, flags, set, max_clients, num_clients_on_port; char ipv4_address[INET_ADDRSTRLEN + 1], ipv6_address[INET6_ADDRSTRLEN + 1]; char *ptr_ip_address; @@ -260,6 +260,28 @@ relay_server_sock_cb (void *data, int fd) return WEECHAT_RC_OK; } + /* check if we have reached the max number of clients on this port */ + max_clients = weechat_config_integer (relay_config_network_max_clients); + if (max_clients > 0) + { + num_clients_on_port = relay_client_count_active_by_port (server->port); + if (num_clients_on_port >= max_clients) + { + weechat_printf ( + NULL, + NG_("%s%s: client not allowed (max %d client is " + "allowed at same time)", + "%s%s: client not allowed (max %d clients are " + "allowed at same time)", + max_clients), + weechat_prefix ("error"), RELAY_PLUGIN_NAME, + max_clients); + close (client_fd); + return WEECHAT_RC_OK; + } + } + + /* get the IP address */ ptr_ip_address = NULL; if (server->ipv6) { @@ -474,9 +496,11 @@ relay_server_create_socket (struct t_relay_server *server) return 0; } - max_clients = weechat_config_integer (relay_config_network_max_clients); - - if (listen (server->sock, max_clients) != 0) +#ifdef SOMAXCONN + if (listen (server->sock, SOMAXCONN) != 0) +#else + if (listen (server->sock, 1) != 0) +#endif { weechat_printf (NULL, _("%s%s: cannot \"listen\" on port %d (%s): error %d %s"), @@ -488,14 +512,30 @@ relay_server_create_socket (struct t_relay_server *server) return 0; } - weechat_printf (NULL, - _("%s: listening on port %d (relay: %s, %s, max %d clients)"), - RELAY_PLUGIN_NAME, - server->port, - server->protocol_string, - ((server->ipv4 && server->ipv6) ? "IPv4+6" : ((server->ipv6) ? "IPv6" : "IPv4")), - max_clients); - + max_clients = weechat_config_integer (relay_config_network_max_clients); + if (max_clients > 0) + { + weechat_printf ( + NULL, + NG_("%s: listening on port %d (relay: %s, %s, max %d client)", + "%s: listening on port %d (relay: %s, %s, max %d clients)", + max_clients), + RELAY_PLUGIN_NAME, + server->port, + server->protocol_string, + ((server->ipv4 && server->ipv6) ? "IPv4+6" : ((server->ipv6) ? "IPv6" : "IPv4")), + max_clients); + } + else + { + weechat_printf ( + NULL, + _("%s: listening on port %d (relay: %s, %s)"), + RELAY_PLUGIN_NAME, + server->port, + server->protocol_string, + ((server->ipv4 && server->ipv6) ? "IPv4+6" : ((server->ipv6) ? "IPv6" : "IPv4"))); + } server->hook_fd = weechat_hook_fd (server->sock, 1, 0, 0, &relay_server_sock_cb, |