diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61f75ae..dbba730 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@ FEATURES:
IMPROVEMENTS:
BUG FIXES:
+## v3.23
+
+IMPROVEMENTS:
+
+ * added parametr `allow` to section `statistics` in .ini file
+ * added ini file documentation in to file ./docs/comet.ini.md
+
## v3.22
BUG FIXES:
diff --git a/comet.ini b/comet.ini
index a05d64e..ec8762d 100644
--- a/comet.ini
+++ b/comet.ini
@@ -1,3 +1,9 @@
+; CppComet https://github.com/CppComet/comet-server
+;
+; docs for this file ./docs/comet.ini.md
+; docs for CppComet https://comet-server.com/wiki/doku.php
+;
+
[main]
; Password for accessing comet server api
@@ -8,7 +14,7 @@ host = localhost
user = root
password = root
name = comet_db
-port = 3305
+port = 3306
[ws]
ip = 0.0.0.0
@@ -27,6 +33,13 @@ port = 3300
uptimeTestInterval = 600
maxUptime = 0
+[statistics]
+allow = true ; https://comet-server.com/wiki/doku.php/en:comet:ini-file#section_statistics
+
+
+[content-type]
+js = application/javascript
+
[log]
level = 200; Logging level (600 output all, 200 errors only)
diff --git a/db.sql b/db.sql
index fc48124..f9c7a22 100644
--- a/db.sql
+++ b/db.sql
@@ -1,12 +1,12 @@
--
--- База данных: `comet_db`
+-- Database: `comet_db`
--
-- --------------------------------------------------------
--
--- Структура таблицы `log_event`
+-- Table structure `log_event`
--
CREATE TABLE IF NOT EXISTS `log_event` (
@@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS `log_event` (
-- --------------------------------------------------------
--
--- Структура таблицы `log_query`
+-- Table structure `log_query`
--
CREATE TABLE IF NOT EXISTS `log_query` (
@@ -30,7 +30,7 @@ CREATE TABLE IF NOT EXISTS `log_query` (
-- --------------------------------------------------------
--
--- Структура таблицы `pipes_settings`
+-- Table structure `pipes_settings`
--
CREATE TABLE IF NOT EXISTS `pipes_settings` (
@@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS `pipes_settings` (
-- --------------------------------------------------------
--
--- Структура таблицы `pipe_messages`
+-- Table structure `pipe_messages`
--
CREATE TABLE IF NOT EXISTS `pipe_messages` (
@@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS `pipe_messages` (
-- --------------------------------------------------------
--
--- Структура таблицы `users_auth`
+-- Table structure `users_auth`
--
CREATE TABLE IF NOT EXISTS `users_auth` (
@@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `users_auth` (
-- --------------------------------------------------------
--
--- Структура таблицы `users_messages`
+-- Table structure `users_messages`
--
CREATE TABLE IF NOT EXISTS `users_messages` (
@@ -88,7 +88,7 @@ CREATE TABLE IF NOT EXISTS `users_messages` (
-- --------------------------------------------------------
--
--- Структура таблицы `users_time`
+-- Table structure `users_time`
--
CREATE TABLE IF NOT EXISTS `users_time` (
@@ -96,3 +96,17 @@ CREATE TABLE IF NOT EXISTS `users_time` (
`time` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure `options`
+--
+
+CREATE TABLE IF NOT EXISTS `options` (
+ `section` varbinary(250) NOT NULL,
+ `name` varbinary(250) NOT NULL,
+ `value` varbinary(250) NOT NULL,
+ PRIMARY KEY (`section`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/docs/comet.ini.md b/docs/comet.ini.md
new file mode 100644
index 0000000..1d38ff9
--- /dev/null
+++ b/docs/comet.ini.md
@@ -0,0 +1,139 @@
+# Configuring the comet.ini file
+
+ * Parameters can be specified in any order.
+ * Register is important
+ * The comment begins with the `;`
+
+# Section [main]
+
+Password for access from cometQL
+```password = 0000000000000000000000000000000000000000000000000000000000000000```
+
+The maximum size of the buffer in bytes for working with messages
+```buf_size = 10384```
+
+Buffer size in bytes for storing fragmented messages
+```fragment_buf_size = 600```
+
+The maximum size of the fragmented messages storage buffer
+```fragment_buf_max_size = 10384```
+
+To output in a log queries coming through cometQL
+```useQueryLoger = false```
+
+The maximum size of the buffer to respond to a request
+```answer_buf_size = 1000000```
+
+The comet server can give out static files. By default, this feature is disabled. But if you set the parameter base_dir, then it starts to give files by name from this directory as a primitive http server. Supports only get requests. In the [content-type] section, you can set the extension to the content-type header
+```base_dir = /var/www/html```
+# Section [statistics]
+
+In the comet server, there is a mechanism to collect usage statistics and send them to the developer server (For what and what data is sent, see http://statistics.comet-server.ru/api/statistics )
+To disable sending statistics, set the value to false
+```allow = true```
+
+# Section [db]
+Connecting to mysql
+```host = localhost
+user = root
+password = root
+name = comet_db
+port = 3305```
+
+# Section [ws]
+ip address for receiving connections from websockets
+```ip = 0.0.0.0```
+
+The number of streams into which connections from Web sites are processed, each thread increases the total memory consumption by approximately 10 - 15 mb so that for a low-loaded configuration one can call 1 stream
+```thread_num = 4```
+
+The comet server takes into account the number of online connections and the number of network events, it is the interval in seconds between the measurements that the value 0 does not measure
+```statistics = 10```
+
+Port for listening to connections on websockets
+```port = 8087```
+
+The interval in seconds to check uptime for connections, 0 do not run the check
+```uptimeTestInterval = 600```
+
+The maximum uptime connection after which the connection is terminated forcibly
+```maxUptime = 0```
+
+A comma-separated list of hosts from which it is allowed to connect from javascript api (checked based on the http header), there is no limit by default
+```host = *```
+
+# Section [cometql]
+```ip = 0.0.0.0
+thread_num = 3 ; number of threads for receive message from cometql
+statistics = 10
+port = 3300
+uptimeTestInterval = 600
+maxUptime = 0 ```
+
+# Section [content-type]
+
+Allows you to set the content-type and file type.
+For example:
+```js = text/javascript
+css = text/css```
+
+# Section [log]
+Setting the Logging Level The higher the number the more logs are added.
+ * 0 - do not output
+ * 100 - Critical Errors
+ * 200 errors
+ * 300 - Warnings
+ * 400 - log
+ * 500 - debugging mode
+
+The parameter sets the maximum level of logging common for all subsystems
+```level = 200; ```
+
+Logging levels for individual subsystems, in order to be able to watch the log separately for different events, is used for debugging convenience
+```Any = 500```
+
+Events from class logger
+```TagLoger = 500```
+
+Class storage events
+```appConf = 500```
+
+Events from the interaction class via pipe (in the operating system)
+```pipeCommands = 500```
+
+Statistics module
+```statistics = 500```
+
+Disabling overtime connections
+```removeOldConnections = 500```
+
+Working with mysql
+```MySqlServer = 500```
+
+Class of work with user data (authorization, the last time online)
+```UserIndex = 500```
+
+User class (authorization, last online time)
+```UserItem = 500```
+
+Working with websockets
+```ClientServer = 500```
+
+Outdated section with php api
+```ServerServer = 500```
+
+Working with radishes (obsolete section)
+```SimpleRedisClient = 500```
+
+Reception and distribution of network connections
+```tcpServer = 500```
+
+Blanks of clustering are not all ready
+```CometQLCluster = 500```
+
+Working with authorization from cometql connections
+```devManager = 500```
+
+Sending requests to the mysql database
+```dbLink = 500```
+
diff --git a/docs/dokuwiki/data/pages/comet/building-from-source.txt b/docs/dokuwiki/data/pages/comet/building-from-source.txt
index 09c1cdc..b050cb5 100644
--- a/docs/dokuwiki/data/pages/comet/building-from-source.txt
+++ b/docs/dokuwiki/data/pages/comet/building-from-source.txt
@@ -1,4 +1,4 @@
-RU::004-Администрирование
+RU::004-Администрирование::004-Установка
====== Установка ======
@@ -37,6 +37,8 @@ port = 3305
password = 0000000000000000000000000000000000000000000000000000000000000000
Остальные настройки из файла [[https://github.com/CppComet/comet-server/blob/master/comet.ini|comet.ini]] можно не менять.
+
+Весь перечень настроек в статье [[comet:ini-file|Настройка файла comet.ini]]
====== Запуск ======
Запуск в консольном режиме
@@ -159,8 +161,7 @@ server {
Это значит что подключатся надо так:
$link = mysqli_connect("example.ru", "root", "", "CometQL_v1", 3300);
-
-
+Так же обратите внимание на то что надо указывать имя базы данных CometQL_v1, оно символизирует версию апи и вероятно потом выйдет версия CometQL_v2 и можно будет при подключении выбирать версию для работы.
diff --git a/docs/dokuwiki/data/pages/comet/ini-file.txt b/docs/dokuwiki/data/pages/comet/ini-file.txt
new file mode 100644
index 0000000..9bb46e6
--- /dev/null
+++ b/docs/dokuwiki/data/pages/comet/ini-file.txt
@@ -0,0 +1,141 @@
+RU::004-Администрирование::005-Настройка файла comet.ini
+
+====== Настройка файла comet.ini ======
+
+ * Параметры можно задавать в любом порядке.
+ * Регистр важен
+ * Комментарий начинается с символа `;`
+
+Статья расчитана на версию [[https://github.com/CppComet/comet-server/releases/tag/3.22|CppComet 3.22]] и старше
+====== Секция [main] ======
+
+Пароль для доступа из cometQL
+password = 0000000000000000000000000000000000000000000000000000000000000000
+
+Максимальный размер буфера в байтах для работы с сообщениями
+buf_size = 10384
+
+Размер буфера в байтах для хранения фрагментированных сообщений
+fragment_buf_size = 600
+
+Максимальный размер буфера хранения фрагментированных сообщений
+fragment_buf_max_size = 10384
+
+Надо ли выводить в лог комет сервера запросы приходящие через cometQL
+useQueryLoger = false
+
+Максимальный размер буфера для ответа на запрос
+answer_buf_size = 1000000
+
+Комет сервер может отдавать статические файлы. По умолчанию такая возможность отключена. Но если задать параметр base_dir то он начнёт отдавать файлы по имени из этой дерриктории как примитивный http сервер. Поддерживает только get запросы. В секции [content-type] можно задать соответсвие расширения заголовку content-type
+base_dir = /var/www/html
+====== Секция [statistics] ======
+
+В комет сервере есть механизм сбор статистики использования и отправки на сервер разработчика ( Для чего и какие данные отправляет смотрите здесь http://statistics.comet-server.ru/api/statistics )
+Чтоб отключить отправку статистики надо выставить значение false
+allow = true
+
+====== Секция [db] ======
+Подключение к бд mysql
+host = localhost
+user = root
+password = root
+name = comet_db
+port = 3305
+
+====== Секция [ws] ======
+ip адрес для приёма соединений с вебсокетов
+ip = 0.0.0.0
+
+Количество потоков в которые обрабатываются соединения с вебсокетов, каждый поток увеличивает общее потребление памяти примерно 10 - 15 мб так что для малонагруженной конфигурации можно казывать 1 поток
+thread_num = 4
+
+Комет сервер учитывает количество соединений онлайн и количество сетевых событий, это интервал в секундах между замерами значение 0 не замерять
+statistics = 10
+
+Порт для прослушивания подключений по вебсокетам
+port = 8087
+
+Интервал в секундах для проверки uptime у подключений, 0 не запускать проверку
+uptimeTestInterval = 600
+
+Максимальный uptime подключения после которого соединение разрывается принудительно
+maxUptime = 0
+
+Список хостов через запятую с которых разрешено подключатся из javascript api (проверяется на основе http заголовка ) по умолчанию ограничения нет
+host = *
+
+====== Секция [cometql] ======
+ip = 0.0.0.0
+thread_num = 3 ; number of threads for receive message from cometql
+statistics = 10
+port = 3300
+uptimeTestInterval = 600
+maxUptime = 0
+
+====== Секция [content-type] ======
+
+Позволяет задать соответсвие content-type и типа файла.
+
+на пример так:
+js = text/javascript
+css = text/css
+====== Секция [log] ======
+Настройка уровня логирования чем выше число тем больше логов сыпится.
+ * 0 - не выводить
+ * 100 - критические ошибки
+ * 200 - ошибки
+ * 300 - предупреждения
+ * 400 - лог
+ * 500 - режим отладки
+
+Параметр выставляет общий для всех подсистем максимальный уровень логирования
+level = 200;
+
+Уровни логирования для отдельных подсистем для того чтоб было можно смотреть лог по отдельности для разных событий используется для удобства отладки
+Any = 500
+
+События от класса логера
+TagLoger = 500
+
+События класса хранения настроек
+appConf = 500
+
+События от класса взаимодействия через pipe (в операционной системе)
+pipeCommands = 500
+
+Модуль сбора статистики
+statistics = 500
+
+Отключение соединений по превышению uptime
+removeOldConnections = 500
+
+Работа с mysql
+MySqlServer = 500
+
+Класс работы с данными пользователей (авторизация, время последнего онлайна)
+UserIndex = 500
+
+Класс пользователя (авторизация, время последнего онлайна)
+UserItem = 500
+
+Работа с вебсокетами
+ClientServer = 500
+
+Устаревшая секция работы с php api
+ServerServer = 500
+
+Работа с редис (устаревшая секция)
+SimpleRedisClient = 500
+
+Приём и распределение сетевых соединений
+tcpServer = 500
+
+Заготовки кластеризапции ещё не всё готово
+CometQLCluster = 500
+
+Работа с авторизацией от cometql подключений
+devManager = 500
+
+Отправка запросов к бд mysql
+dbLink = 500
diff --git a/docs/dokuwiki/data/pages/en/comet/building-from-source.txt b/docs/dokuwiki/data/pages/en/comet/building-from-source.txt
index d647ef9..e7df00e 100644
--- a/docs/dokuwiki/data/pages/en/comet/building-from-source.txt
+++ b/docs/dokuwiki/data/pages/en/comet/building-from-source.txt
@@ -1,5 +1,4 @@
-EN::004-Administration
-
+EN::004-Administration::004-Install
====== Install ======
Recommended OS ubuntu, debian, centos
diff --git a/docs/dokuwiki/data/pages/en/comet/ini-file.txt b/docs/dokuwiki/data/pages/en/comet/ini-file.txt
new file mode 100644
index 0000000..d09252b
--- /dev/null
+++ b/docs/dokuwiki/data/pages/en/comet/ini-file.txt
@@ -0,0 +1,139 @@
+EN::004-Administration::005-Configuring the comet.ini file
+
+====== Configuring the comet.ini file ======
+
+ * Parameters can be specified in any order.
+ * Register is important
+ * The comment begins with the `;`
+
+====== Section [main] ======
+
+Password for access from cometQL
+password = 0000000000000000000000000000000000000000000000000000000000000000
+
+The maximum size of the buffer in bytes for working with messages
+buf_size = 10384
+
+Buffer size in bytes for storing fragmented messages
+fragment_buf_size = 600
+
+The maximum size of the fragmented messages storage buffer
+fragment_buf_max_size = 10384
+
+To output in a log queries coming through cometQL
+useQueryLoger = false
+
+The maximum size of the buffer to respond to a request
+answer_buf_size = 1000000
+
+The comet server can give out static files. By default, this feature is disabled. But if you set the parameter base_dir, then it starts to give files by name from this directory as a primitive http server. Supports only get requests. In the [content-type] section, you can set the extension to the content-type header
+base_dir = /var/www/html
+====== Section [statistics] ======
+
+In the comet server, there is a mechanism to collect usage statistics and send them to the developer server (For what and what data is sent, see http://statistics.comet-server.ru/api/statistics )
+To disable sending statistics, set the value to false
+allow = true
+
+====== Section [db] ======
+Connecting to mysql
+host = localhost
+user = root
+password = root
+name = comet_db
+port = 3305
+
+====== Section [ws] ======
+ip address for receiving connections from websockets
+ip = 0.0.0.0
+
+The number of streams into which connections from Web sites are processed, each thread increases the total memory consumption by approximately 10 - 15 mb so that for a low-loaded configuration one can call 1 stream
+thread_num = 4
+
+The comet server takes into account the number of online connections and the number of network events, it is the interval in seconds between the measurements that the value 0 does not measure
+statistics = 10
+
+Port for listening to connections on websockets
+port = 8087
+
+The interval in seconds to check uptime for connections, 0 do not run the check
+uptimeTestInterval = 600
+
+The maximum uptime connection after which the connection is terminated forcibly
+maxUptime = 0
+
+A comma-separated list of hosts from which it is allowed to connect from javascript api (checked based on the http header), there is no limit by default
+host = *
+
+====== Section [cometql] ======
+ip = 0.0.0.0
+thread_num = 3 ; number of threads for receive message from cometql
+statistics = 10
+port = 3300
+uptimeTestInterval = 600
+maxUptime = 0
+
+====== Section [content-type] ======
+
+Allows you to set the content-type and file type.
+For example:
+js = text/javascript
+css = text/css
+====== Section [log] ======
+Setting the Logging Level The higher the number the more logs are added.
+ * 0 - do not output
+ * 100 - Critical Errors
+ * 200 errors
+ * 300 - Warnings
+ * 400 - log
+ * 500 - debugging mode
+
+The parameter sets the maximum level of logging common for all subsystems
+level = 200;
+
+Logging levels for individual subsystems, in order to be able to watch the log separately for different events, is used for debugging convenience
+Any = 500
+
+Events from class logger
+TagLoger = 500
+
+Class storage events
+appConf = 500
+
+Events from the interaction class via pipe (in the operating system)
+pipeCommands = 500
+
+Statistics module
+statistics = 500
+
+Disabling overtime connections
+removeOldConnections = 500
+
+Working with mysql
+MySqlServer = 500
+
+Class of work with user data (authorization, the last time online)
+UserIndex = 500
+
+User class (authorization, last online time)
+UserItem = 500
+
+Working with websockets
+ClientServer = 500
+
+Outdated section with php api
+ServerServer = 500
+
+Working with radishes (obsolete section)
+SimpleRedisClient = 500
+
+Reception and distribution of network connections
+tcpServer = 500
+
+Blanks of clustering are not all ready
+CometQLCluster = 500
+
+Working with authorization from cometql connections
+devManager = 500
+
+Sending requests to the mysql database
+dbLink = 500
diff --git a/src/Client_connection.cpp b/src/Client_connection.cpp
index a87956a..02a415c 100644
--- a/src/Client_connection.cpp
+++ b/src/Client_connection.cpp
@@ -953,7 +953,7 @@ int Client_connection::web_socket_request_message(int client, int len, thread_da
int Client_connection::log_statistics(thread_data* local_buf, const char* event_data,int client, int len)
{
- // @todo Переделать на отправку данных в бд
+ // @todo simpleTask Переделать на отправку данных в бд
//local_buf->answer_buf.lock();
//mysql_real_escape_string(local_buf->db.getLink(), local_buf->answer_buf.getData(), event_data, strlen(event_data));
//local_buf->clusterRC.lpush_printf("log_statistics \"%s\"", local_buf->answer_buf.getData());
@@ -1004,7 +1004,7 @@ int Client_connection::track_pipe_users(thread_data* local_buf, char* event_data
CP r = tcpServer ::instance()->get(conection_id);
if(r)
{
- // @todo отдавать всем не uuid а его солёный хеш.
+ // @todo simpleTask отдавать всем не uuid а его солёный хеш.
bzero(strtmp, 200);
snprintf(strtmp, 200, "{\"user_id\":%d,\"uuid\":\"%s\"}", r->web_user_id, r->web_user_uuid);
usersstr.append(strtmp);
@@ -1220,6 +1220,11 @@ char* Client_connection::checking_event_name(thread_data* local_buf, const char*
*/
int Client_connection::web_pipe_msg_v1(thread_data* local_buf, char* event_data,int client, int len)
{
+ if(!appConf::instance()->get_bool('ws', 'support_old_api'))
+ {
+ return;
+ }
+
bool send_user_id = true;
char* name = event_data;
if(memcmp(name, "@web_", 5) == 0)
@@ -1229,8 +1234,7 @@ int Client_connection::web_pipe_msg_v1(thread_data* local_buf, char* event_data,
name++;
}
else if(memcmp(name, "web_", 4) != 0)
- {
- // @todo добавить ссылку на описание ошибки
+ {
message(local_buf, base64_encode((const char*) "{\"data\":{\"number_messages\":-1,\"error\":\"[pipe_msg] Invalid channel name. The channel should begin with web_\"},\"event_name\":\"answer\"}").data(), "_answer");
return -1;
}
@@ -1619,10 +1623,6 @@ int Client_connection::get_custom_request(int client, int len, thread_data* loca
return -1;
}*/
- /**
- * @todo add parameter to .ini file for http headers control
- * And make class for return correct headers for HTTP response
- */
char resp[]="HTTP/1.1 200 OK\r\nContent-Type:%s; charset=UTF-8\r\nServer:CppComet Server\r\nComet-Server:CppComet Server\r\nAccess-Control-Allow-Origin: *\
\r\nAccess-Control-Allow-Methods: GET\r\nAllow: GET\r\nAccess-Control-Allow-Headers: origin, content-type, accept\r\nCache-Control: max-age=3600\r\nConnection: close\r\n\r\n";
@@ -1638,10 +1638,7 @@ int Client_connection::get_custom_request(int client, int len, thread_data* loca
char headers_resp[1024];
snprintf(headers_resp, 1024, resp, headers.data());
-
- /**
- * @todo дополнить белым списком запрашиваемых файлов чтоб исключить нагрузку от левых запросов.
- */
+
int fp = open(name.data(), O_RDONLY);
if(fp < 0)
{
@@ -1923,9 +1920,7 @@ int Client_connection::message(thread_data* local_buf, const char* msg)
/**
* Устанавливает соединению статус
- * Вызывается при создании соединения с аргументом true и при удалении соединения с аргументом false
- * @todo Было бы круто разделить на 2 функции set_online и set_offline
- *
+ * Вызывается при создании соединения с аргументом true и при удалении соединения с аргументом false
* @param local_buf
* @param IsOnLine статус который надо постивить online или offline
* @return
diff --git a/src/Client_connection.h b/src/Client_connection.h
index 10dc3d8..03de415 100644
--- a/src/Client_connection.h
+++ b/src/Client_connection.h
@@ -36,7 +36,7 @@ class Client_connection;
/**
* Максимально количество подписок на каналы
- * @todo вынести в конфигурационный файл
+ * @todo вынести в конфигурационный файл | а лучше и экономичнее выделять память по мере надобности
*/
#define MAX_SUBSCRIPTION_PIPE 32
#define SUBSCRIPTION_DATA_LEN MAX_SUBSCRIPTION_PIPE*(PIPE_NAME_LEN+4)
@@ -60,17 +60,20 @@ class Client_connection:public connection
static std::map ram_file_cache;
friend class tcpServer;
- /**
- * Подписки на каналы
- * @note Содержит указатели на память принадлежащию масиву subscriptions_data
- */
- char *subscriptions[MAX_SUBSCRIPTION_PIPE];
-
- /**
- * Подписки на каналы
- */
- char subscriptions_data[SUBSCRIPTION_DATA_LEN];
-
+ /**
+ * Подписки на каналы
+ * @note Содержит указатели на память принадлежащию масиву subscriptions_data
+ *
+ * @todo Заменить на динамически выделяемые данные [opt1 -MAX_SUBSCRIPTION_PIPE*ws_online]
+ */
+ char *subscriptions[MAX_SUBSCRIPTION_PIPE];
+
+ /**
+ * Подписки на каналы
+ * @todo Заменить на динамически выделяемые данные [opt1 -SUBSCRIPTION_DATA_LEN*ws_online]
+ */
+ char subscriptions_data[SUBSCRIPTION_DATA_LEN];
+
/**
* Для хранения фрагментов сообщений которые пришли не полностью.
@@ -198,11 +201,23 @@ class Client_connection:public connection
/**
* Самоназвание клиента (для случаев если надо идентифицировать и дифференцировать не авторизованных пользователей)
+ * @todo Заменить на динамически выделяемые данные + добавить параметр на отключение парсинга этой строкм [opt1 -USER_UUID_LEN*ws_online]
*/
char web_user_uuid[USER_UUID_LEN+1];
+ /**
+ * @todo Заменить на динамически выделяемые данные + добавить параметр на отключение парсинга этой строкм [opt1 -USER_UUID_LEN*ws_online]
+ */
char web_user_agent[USER_AGENT_LEN+1];
+
+ /**
+ * @todo Заменить на динамически выделяемые данные + добавить параметр на отключение парсинга этой строкм [opt1 -USER_UUID_LEN*ws_online]
+ */
char web_user_host[USER_HOST_LEN+1];
+
+ /**
+ * @todo Заменить на динамически выделяемые данные + добавить параметр на отключение парсинга этой строкм [opt1 -USER_UUID_LEN*ws_online]
+ */
char web_user_language[USER_LANGUAGE_LEN+1];
/**
diff --git a/src/CometQL.h b/src/CometQL.h
index 004d3ea..b30d8d1 100644
--- a/src/CometQL.h
+++ b/src/CometQL.h
@@ -89,7 +89,7 @@ class tokPlace
/**
* Максимальное количество строк в ответе
- * @todo Вынести констану в конфигурационный файл
+ * @todo Вынести констану в конфигурационный файл | а лучше и экономичнее выделять память по мере надобности
*/
#define MAX_LINES_IN_ANSWER 512
diff --git a/src/Freeswitch_connection.cpp b/src/Freeswitch_connection.cpp
index 07eebe2..2d8487d 100644
--- a/src/Freeswitch_connection.cpp
+++ b/src/Freeswitch_connection.cpp
@@ -318,9 +318,7 @@ int Freeswitch_connection::request(int client, int len, thread_data* local_buf)
/**
* Устанавливает соединению статус
- * Вызывается при создании соединения с аргументом true и при удалении соединения с аргументом false
- * @todo Было бы круто разделить на 2 функции set_online и set_offline
- *
+ * Вызывается при создании соединения с аргументом true и при удалении соединения с аргументом false
* @param local_buf
* @param IsOnLine статус который надо постивить online или offline
* @return
diff --git a/src/MySqlProtocol.cpp b/src/MySqlProtocol.cpp
index 39cae3e..652ee2a 100644
--- a/src/MySqlProtocol.cpp
+++ b/src/MySqlProtocol.cpp
@@ -176,7 +176,7 @@ int LengthEncodedInteger::setToBuff(long long value, char* buff)
{
printf("warning LengthEncodedInteger is %lld (9)\n", value);
*buff = 0xfe;
- memcpy(buff+1, &value, 8); // @todo уточнить можноли так чтоб 9 байт
+ memcpy(buff+1, &value, 8); // @fixme уточнить можноли так чтоб 9 байт
return 9;
}
diff --git a/src/MySql_connection.cpp b/src/MySql_connection.cpp
index 51a24f9..25c6f95 100644
--- a/src/MySql_connection.cpp
+++ b/src/MySql_connection.cpp
@@ -48,8 +48,7 @@ pthread_mutex_t MySql_connection::QLParsing_mutex;
* @param msg сообщение (уже с экранированными данными)
* @param quote Кавычки
* @return
- *
- * @todo добавить обработку authType в логирование канала.
+ *
*/
int PipeLog::addToLog(thread_data* local_buf, const char* pipe_name, const char* event_name, unsigned int from_user_id, const char* msg, unsigned int msg_length)
{
@@ -94,7 +93,7 @@ int PipeLog::addToLog(thread_data* local_buf, const char* pipe_name, const char*
// Вставка в бд
local_buf->stm.pipe_messages_insert.execute(uid, (long int)time(NULL), pipe_name, event_name, msg, msg_length, from_user_id);
- // @todo Заменить потом на stm выражение
+ // @todo simpleTask Заменить потом на stm выражение
local_buf->db.query_format("delete from pipe_messages where pipe_messages.id in( \
select p2.id from ( \
select id FROM `pipe_messages` as p3 where p3.pipe_name = '%s' order by p3.time desc limit %d, 999\
@@ -929,7 +928,8 @@ int MySql_connection::sql_show_processlist(thread_data* local_buf, unsigned int
int MySql_connection::sql_show_variables(thread_data* local_buf, unsigned int PacketNomber)
{
// SHOW SESSION VARIABLES LIKE 'lower_case_table_names'
- // @todo не доделан like и флаги SESSION и GLOBAL
+ // @todo simpleTask не доделан like и флаги SESSION и GLOBAL
+ // @todo simpleTask показывать параметры ini файла
local_buf->answer_buf.lock();
char* answer = local_buf->answer_buf.getData();
diff --git a/src/MySql_connection.h b/src/MySql_connection.h
index 71b431f..b848803 100644
--- a/src/MySql_connection.h
+++ b/src/MySql_connection.h
@@ -54,7 +54,7 @@
/**
* Максимальный размер сообщения
- * @todo вынести в конфигурационный файл
+ * @todo вынести в конфигурационный файл | а лучше и экономичнее выделять память по мере надобности
*/
#define MAX_MESSAGE_SIZE 9000
#define MAX_OFLINE_TIME 90
@@ -62,13 +62,13 @@
/**
* Максимальная длина очереди сообщений на пользователя
- * @todo вынести в конфигурационный файл
+ * @todo simpleTask вынести в конфигурационный файл
*/
#define MAX_QUEUE_LENGTH 100
/**
* Максимальная длина лога сообщений в канале
- * @todo вынести в конфигурационный файл
+ * @todo simpleTask вынести в конфигурационный файл
*/
#define MAX_LOG_LENGTH 1000
@@ -122,8 +122,7 @@ class PipeSettings
/**
* Сохраняет настройки канала
* @param local_buf
- * @return
- * @todo добавить проверку на то что если длина логирования меньше чем было то надо из лога удалить лишние сообщения
+ * @return
*/
int save(thread_data* local_buf)
{
@@ -131,8 +130,7 @@ class PipeSettings
{
return -1;
}
-
- /* Временно отключаем mysql*/
+
// Сохраняем настройки канала в бд
local_buf->db.query_format("REPLACE INTO `pipes_settings`(`name`, `type`, `length`) VALUES ('%s', '0', %d);", pipe_name, log_length);
local_buf->db.query_format("DELETE FROM `pipes_log` WHERE `name` = '%s' ORDER BY `time` DESC limit %d, 99999", pipe_name, log_length);
diff --git a/src/appConf.cpp b/src/appConf.cpp
index 893f34b..fc5d249 100644
--- a/src/appConf.cpp
+++ b/src/appConf.cpp
@@ -63,6 +63,11 @@ bool appConf::initFromFile(const char *fileName)
sections["statistics"]["interval"] = "3600";
}
+ if(!is_property_exists("statistics", "allow"))
+ {
+ sections["statistics"]["allow"] = "true";
+ }
+
/*
; Объём буфера для сообщения
; Много ставить не надо, комет сервер не расчитан на передачу больших сообщений
diff --git a/src/ini_parser/ini_parser.hpp b/src/ini_parser/ini_parser.hpp
index d31fe5a..57532bc 100644
--- a/src/ini_parser/ini_parser.hpp
+++ b/src/ini_parser/ini_parser.hpp
@@ -29,6 +29,7 @@
#define INI_PARSER_H
#include