Skip to content

Commit e074ef0

Browse files
v 3.29
1 parent 979ca69 commit e074ef0

File tree

10 files changed

+178
-34
lines changed

10 files changed

+178
-34
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ FEATURES:
55
IMPROVEMENTS:
66
BUG FIXES:
77

8+
## v3.29
9+
10+
BUG FIXES:
11+
12+
* fix bug in star scripts
13+
14+
IMPROVEMENTS:
15+
16+
* add parametr connection_attempts to section db
17+
* rebild docs in .md files and impruve links in docs
18+
19+
820
## v3.28
921

1022
BUG FIXES:

docs/Administration/Install.md

+57-12
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ password = 0000000000000000000000000000000000000000000000000000000000000000
5050
```
5151

5252

53+
# Add to Startup
54+
55+
56+
```
57+
cp ./comet.service /etc/systemd/system
58+
systemctl daemon-reload
59+
systemctl enable comet.service
60+
```
61+
62+
63+
After successes run server we can begin create chat. If you get error create issue in [github repository](https://github.com/Levhav/comet-server/issues).
64+
5365
# Launch
5466
Run in console mode
5567

@@ -68,18 +80,6 @@ systemctl start comet.service
6880
```
6981

7082

71-
# Add to Startup
72-
73-
74-
```
75-
cp ./comet.service /etc/systemd/system
76-
systemctl daemon-reload
77-
systemctl enable comet.service
78-
```
79-
80-
81-
After successes run server we can begin create chat. If you get error create issue in [github repository](https://github.com/Levhav/comet-server/issues).
82-
8383
# Configuring nginx as a reverse proxy
8484

8585
In order to configure the operation of comets on one machine with a web server, or just have the ability to work not only on http but also on https, you need to configure the reverse proxy.
@@ -198,3 +198,48 @@ $link = mysqli_connect("example.ru", "root", "", "CometQL_v1", 3300);
198198
```
199199

200200

201+
# Unreadable file comet.ini
202+
203+
Some text editors add unprintable simbols to the utf8 file. After that, the file may look the same but the comet server will not parse it correctly. You can try using another editor or delete the old file and create a new one with the same text.
204+
205+
# Error while assembling in CentOS
206+
207+
208+
```
209+
210+
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
211+
Please set them or make sure they are set and tested correctly in the CMake files:
212+
MYSQL_INCLUDE_DIR (ADVANCED)
213+
214+
```
215+
216+
217+
Can not find the client's mysql header files. You can try installing the mysql-devel package
218+
219+
220+
```
221+
222+
yum install mysql-devel
223+
224+
```
225+
226+
227+
# Error while assembling in CentOS
228+
229+
230+
```
231+
232+
/etc/comet-server/comet-server/src/mystring.cpp:15:51: fatal error: uuid / uuid.h: No such file or directory exists
233+
 #include <uuid/uuid.h>
234+
235+
```
236+
237+
238+
Can not find the file uuid.h. You can try installing the libuuid libuuid-devel package
239+
240+
241+
```
242+
243+
yum install libuuid libuuid-devel
244+
245+
```

docs/Examples/PHP chat example.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ subscription Code to the pipe on comet server. This callback will be called when
101101

102102
# Links
103103

104-
* [JavaScript API](/docs/API/JavaScript%20API/JavaScript%20API.md)
105-
* [CometQL API](/docs/API/CometQL/CometQL%20API.md)
104+
* [JavaScript API](/docs/API/JavaScript%20API/JavaScript%20API)
105+
* [CometQL API](/docs/API/CometQL/CometQL%20API)
106106
* [Online demo](https://jsfiddle.net/o35kvmn2/5/)
107107
* [CppComet](https://github.com/CppComet/comet-server)
108108
* [Creating a simple chat using CppComet](https://www.codeproject.com/script/Articles/ArticleVersion.aspx?waid=235463&aid=1181698)

docs/Introduction/Introduction.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Push notifications can be implemented by PHP, but PHP need to use more memory co
3939
# Links
4040
We recommend you to read these articles:
4141

42-
* [PHP chat example](/docs/Examples/PHP%20chat%20example.md)
43-
* [JavaScript API](/docs/API/JavaScript%20API/JavaScript%20API.md)
44-
* [CometQL API](/docs/API/CometQL/CometQL%20API.md)
42+
* [PHP chat example](/docs/Examples/PHP%20chat%20example)
43+
* [JavaScript API](/docs/API/JavaScript%20API/JavaScript%20API)
44+
* [CometQL API](/docs/API/CometQL/CometQL%20API)
4545
* [CppComet](https://github.com/CppComet/comet-server)
46-
* [An example of sending a message from a bash script](/docs/Examples/An%20example%20of%20sending%20a%20message%20from%20a%20bash%20script.md)
46+
* [An example of sending a message from a bash script](/docs/Examples/An%20example%20of%20sending%20a%20message%20from%20a%20bash%20script)

docs/README.md

+48-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# CppComet Documentation
33

44
* [Russian](http://comet-server.org/doku.php/ru) language
5-
* [English](http://comet-server.org/doku.php/en) language
5+
* English language on [project site](http://comet-server.org/doku.php/en) or in [readthedocs](http://cppcomet.readthedocs.io/en/latest/)
66

77
# CppComet community
88

@@ -11,4 +11,50 @@
1111

1212
# CppComet roadmap
1313

14-
* [Roadmap](https://github.com/CppComet/comet-server/projects/1)
14+
* [Roadmap](https://github.com/CppComet/comet-server/projects/1)
15+
16+
# CppComet github
17+
18+
* [Github](https://github.com/CppComet/comet-server)
19+
20+
21+
22+
# Star.Comet - Documentation
23+
24+
* If you want to understand why you need a server that comets read [Introduction](/docs/Introduction/Introduction)
25+
* Start API study recommended with aticle [CometQL](/docs/comet/CometQL) and [JavaScript API](/docs/API/JavaScript%20API/JavaScript%20API)
26+
27+
# Articles
28+
29+
* [Introduction](/docs/Introduction/Introduction) - the description of comet-technology, abilities, sphere of usage and how really work push-notifications.
30+
* [CometQL documentation](/docs/comet/CometQL) - a server API for work with the comet-server
31+
* [JavaScript API documentation](/docs/API/JavaScript%20API/JavaScript%20API) - a client API for work with the comet-server
32+
* [Star.Comet-Chat](/docs/comet/star-comet-chat) - a chat plugin for private correspondence between two users.
33+
* [Reserved channel names](/docs/API/Reserved%20channel%20names) - description of channels with special properties
34+
* [An example of sending a message from a bash script](/docs/Examples/An%20example%20of%20sending%20a%20message%20from%20a%20bash%20script)
35+
* [Error codes in CometQL](/docs/API/Error%20codes%20in%20CometQL) - Error codes that are available when working with CometQL API
36+
* [Public identifier Developer](/docs/API/Connection%20settings) - What is a "Public ID Developer" and "Secret developer key"
37+
* [Users authorization](/docs/API/Authorization%20on%20the%20CppComet) - Description of the mechanism on the user authorization server on comets
38+
* [Creating a simple php chat](https://www.codeproject.com/Articles/1181698/Creating-a-simple-chat-using-CppComet)
39+
* [php chat example](https://github.com/CppComet/php-chat-example)
40+
* [Fast PHP Comet chat system tutorial](https://www.phpclasses.org/blog/post/452-Fast-PHP-Comet-Chat-System-Tutorial.html)
41+
* [Example for taking a message getting of the channel in JavaScript](/docs/Examples/How%20to%20take%20a%20message%20out%20of%20the%20channel%20in%20JavaScript)
42+
* [Online CometQL command line](/docs/Examples/Online%20CometQL%20CLI)
43+
44+
# Administering comet servers
45+
46+
* [Install](/docs/Administration/Install) - Instructions for assembling and installing comets on your server
47+
* [Checking the hosting](/docs/Troubleshooting/Checking%20the%20hosting%20for%20possible%20connect%20to%20the%20comet%20server) - Checking the hosting for possible connect to the comet server
48+
* [load testing](/docs/load%20testing/Stress%20testing) - Example of load testing for comet server with tsung
49+
* [load testing results](/docs/load%20testing/Report%20about%20testing%20of%2064000%20connections%20online) - Report about testing of 64,000 connections online
50+
51+
52+
# Plans for the development of the project
53+
54+
About what improvements are planned, and which ones are already being implemented you can look at [this page](https://github.com/CppComet/comet-server/projects/1/). If there are any suggestions, questions, requests or requests for adding new features, you can [create issue](https://github.com/CppComet/comet-server/issues) or write to tech support after registration.
55+
56+
57+
___
58+
If you have a question that may be of interest to other users, it's better to ask about the problem on [github](https://github.com/CppComet/comet-server) ([creating issue](https://github.com/CppComet/comet-server/issues))
59+
___
60+

docs/load testing/Report about testing of 64000 connections online.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Report about testing of 64,000 connections online
33

44

5-
At previous article we examined the [ how to conduct the stress testing.](/docs/load%20testing/Stress%20testing.md) And here I want to show you how I conducted it by myself, and give its results.
5+
At previous article we examined the [ how to conduct the stress testing.](/docs/load%20testing/Stress%20testing) And here I want to show you how I conducted it by myself, and give its results.
66

77

88
___

install.sh

Whitespace-only changes.

src/appConf.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ bool appConf::initFromFile(const char *fileName)
181181
/**
182182
* mysql db
183183
*/
184+
185+
if(!is_property_exists("db", "connection_attempts"))
186+
{
187+
sections["db"]["connection_attempts"] = "10";
188+
}
189+
184190
if(!is_property_exists("db", "host"))
185191
{
186192
// Ошибочка, параметр обязателен

src/main.cpp

+46-11
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ int main(int argc, char *argv[])
406406
return 0;
407407
}
408408

409-
TagLoger::log(Log_Any, 0, "Server starting pid:%d, getrusage:%d\n", getpid());
409+
TagLoger::log(Log_Any, 0, "Server starting pid:%d, getrusage:%d\n", (int)getpid());
410410
TagLoger::initTagLevels();
411411

412412
dbLink mydb;
@@ -415,21 +415,56 @@ int main(int argc, char *argv[])
415415
appConf::instance()->get_chars("db", "password"),
416416
appConf::instance()->get_chars("db", "name"),
417417
appConf::instance()->get_int("db", "port"));
418-
if(!mydb.connect())
418+
419+
int connection_attempts = appConf::instance()->get_int("db", "connection_attempts");
420+
if(!connection_attempts)
419421
{
420-
TagLoger::error(Log_Any, 0, "\x1b[1;31mError: MySQL connection not established\x1b[0m");
422+
connection_attempts = 1;
421423
}
424+
425+
int count = 0;
426+
bool isSuccess = false;
427+
do{
428+
count++;
429+
if(!mydb.connect())
430+
{
431+
TagLoger::error(Log_Any, 0, "\x1b[1;31mError: MySQL connection not established (attempt=%d)\x1b[0m", count);
432+
sleep(5);
433+
continue;
434+
}
422435

423-
if(!mydb.query_format("INSERT INTO `log_event`(`id`, `text`) VALUES (NULL,'start-%s');", appConf::instance()->get_chars("main", "node_name")))
436+
if(!mydb.query_format("INSERT INTO `log_event`(`id`, `text`) VALUES (NULL,'start-%s');", appConf::instance()->get_string("main", "node_name").data()))
437+
{
438+
sleep(5);
439+
continue;
440+
}
441+
else
442+
{
443+
isSuccess = true;
444+
break;
445+
}
446+
447+
}while(count < connection_attempts);
448+
449+
if(!isSuccess)
424450
{
425-
return 0;
451+
TagLoger::error(Log_Any, 0, "\x1b[1;31mError: MySQL connection not established\x1b[0m");
452+
return -1;
426453
}
427-
454+
428455
// Запись pid в var run
429456
auto fp = fopen(appConf::instance()->get_chars("main", "pidfile"), "w");
430-
fprintf(fp, "%d", getpid());
431-
fclose(fp);
432-
457+
if(fp == NULL)
458+
{
459+
TagLoger::error(Log_Any, 0, "\x1b[1;31mError: pidfile is not updated\x1b[0m");
460+
perror("Error: pidfile is not updated");
461+
}
462+
else
463+
{
464+
fprintf(fp, "%d", (int)getpid());
465+
fclose(fp);
466+
}
467+
433468
while(true)
434469
{
435470
pid_t pid = fork();
@@ -444,15 +479,15 @@ int main(int argc, char *argv[])
444479
else if(pid == 0)
445480
{
446481
// Это процесс-потомок
447-
TagLoger::debug(Log_appConf, 0, "PID=%d, PPID=%d", getpid(), getppid());
482+
TagLoger::debug(Log_appConf, 0, "PID=%d, PPID=%d", (int)getpid(), (int)getppid());
448483
signal(SIGHUP, posix_death_signal); // сигнал, посылаемый процессу для уведомления о потере соединения с управляющим терминалом пользователя. ( может быть перехвачен или проигнорирован программой. )
449484

450485
break;
451486
}
452487
else
453488
{
454489
// Это процесс-родитель
455-
TagLoger::debug(Log_appConf, 0, "PID=%d, Child PID=%d", getpid(), pid);
490+
TagLoger::debug(Log_appConf, 0, "PID=%d, Child PID=%d", (int)getpid(), pid);
456491
signal(SIGHUP, posix_log_signal); // сигнал, посылаемый процессу для уведомления о потере соединения с управляющим терминалом пользователя. ( может быть перехвачен или проигнорирован программой. )
457492

458493
int status;

src/main.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@
102102
</body>\
103103
</html>"
104104

105-
#define MYSQL_SERVERNAME "CppComet 3.28"
106-
#define MYSQL_SYSTEMVARIBLE "CppComet 3.28 (comet-server.com, [email protected])"
105+
#define MYSQL_SERVERNAME "CppComet 3.29"
106+
#define MYSQL_SYSTEMVARIBLE "CppComet 3.29 (comet-server.com, [email protected])"
107107

108108
#define maxValue( a, b ) ( (a) > (b) ? (a) : (b) )
109109
#define minValue( a, b ) ( (a) < (b) ? (a) : (b) )

0 commit comments

Comments
 (0)