read_timeout support

This commit is contained in:
Oleg Moskalenko 2016-08-27 17:09:05 -07:00
parent 79aed7d8b7
commit 9124a167ed
9 changed files with 18 additions and 12 deletions

View File

@ -1,7 +1,8 @@
08/27/2016 Oleg Moskalenko <mom040267@gmail.com> 08/27/2016 Oleg Moskalenko <mom040267@gmail.com>
Version 4.5.0.5 'dan Eider': Version 4.5.0.5 'dan Eider':
- Typos in the text fixed. - Typos in the text fixed.
- LibreSSL compatibility fixed. - LibreSSL compatibility fixed.
- "read_timeout" option support for MySQL.
08/20/2016 Oleg Moskalenko <mom040267@gmail.com> 08/20/2016 Oleg Moskalenko <mom040267@gmail.com>
Version 4.5.0.4 'dan Eider': Version 4.5.0.4 'dan Eider':

View File

@ -1006,18 +1006,18 @@ have such a feature as "connection string", the TURN server parses the
connection string and converts it into MySQL database connection parameter. connection string and converts it into MySQL database connection parameter.
The format of the MySQL connection string is: The format of the MySQL connection string is:
"host=<host> dbname=<database-name> user=<database-user> password=<database-user-password> port=<port> connect_timeout=<seconds>" "host=<host> dbname=<database-name> user=<database-user> password=<database-user-password> port=<port> connect_timeout=<seconds> read_timeout=<seconds>"
(all parameters are optional) (all parameters are optional)
So, an example of the MySQL database parameter in the TURN server command So, an example of the MySQL database parameter in the TURN server command
line would be: line would be:
--mysql-userdb="host=localhost dbname=coturn user=turn password=turn connect_timeout=30" --mysql-userdb="host=localhost dbname=coturn user=turn password=turn connect_timeout=30 read_timeout=30"
Or in the turnserver.conf file: Or in the turnserver.conf file:
mysql-userdb="host=localhost dbname=coturn user=turn password=turn connect_timeout=30" mysql-userdb="host=localhost dbname=coturn user=turn password=turn connect_timeout=30 read_timeout=30"
If you have to use a secure MySQL connection (SSL) then you have to use also If you have to use a secure MySQL connection (SSL) then you have to use also
the optional connection string parameters for the secure communications: the optional connection string parameters for the secure communications:

View File

@ -108,7 +108,7 @@ User database settings:
secret-based timed authentication in TURN RESP API. secret-based timed authentication in TURN RESP API.
The connection string format is like that: The connection string format is like that:
"host=<host> dbname=<dbname> user=<db-user> password=<db-user-password> connect_timeout=<seconds>" "host=<host> dbname=<dbname> user=<db-user> password=<db-user-password> connect_timeout=<seconds> read_timeout=<seconds>"
See the INSTALL file for more explanations and examples. See the INSTALL file for more explanations and examples.

View File

@ -274,7 +274,7 @@
# #
# Use string format as below (space separated parameters, all optional): # Use string format as below (space separated parameters, all optional):
# #
#mysql-userdb="host=<host> dbname=<database-name> user=<database-user> password=<database-user-password> port=<port> connect_timeout=<seconds>" #mysql-userdb="host=<host> dbname=<database-name> user=<database-user> password=<database-user-password> port=<port> connect_timeout=<seconds> read_timeout=<seconds>"
# MongoDB database connection string in the case that we are using MongoDB # MongoDB database connection string in the case that we are using MongoDB
# as the user database. # as the user database.

View File

@ -15,7 +15,7 @@
# 3) use 3 relay threads (-m 3) # 3) use 3 relay threads (-m 3)
# 4) use min UDP relay port 32355 and max UDP relay port 65535 # 4) use min UDP relay port 32355 and max UDP relay port 65535
# 5) "-r north.gov" means "use authentication realm north.gov" # 5) "-r north.gov" means "use authentication realm north.gov"
# 6) --mysql-userdb="host=localhost dbname=coturn user=turn password=turn connect_timeout=30" # 6) --mysql-userdb="host=localhost dbname=coturn user=turn password=turn connect_timeout=30 read_timeout=30"
# means that local MySQL database "coturn" will be used, with database user "turn" and # means that local MySQL database "coturn" will be used, with database user "turn" and
# database user password "turn", and connection timeout 30 seconds. # database user password "turn", and connection timeout 30 seconds.
# 7) "--cert=example_turn_server_cert.pem" sets the OpenSSL certificate file name. # 7) "--cert=example_turn_server_cert.pem" sets the OpenSSL certificate file name.
@ -32,4 +32,4 @@ fi
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/ export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/
PATH="./bin/:../bin/:../../bin/:${PATH}" turnserver --server-name="blackdow.carleon.gov" -v --syslog -a -L 127.0.0.1 -L ::1 -E 127.0.0.1 -E ::1 --max-bps=3000000 -f -m 3 --min-port=32355 --max-port=65535 -r north.gov --mysql-userdb="host=localhost dbname=coturn user=turn password=turn connect_timeout=30" --cert=turn_server_cert.pem --pkey=turn_server_pkey.pem --log-file=stdout --cipher-list=ALL --oauth $@ PATH="./bin/:../bin/:../../bin/:${PATH}" turnserver --server-name="blackdow.carleon.gov" -v --syslog -a -L 127.0.0.1 -L ::1 -E 127.0.0.1 -E ::1 --max-bps=3000000 -f -m 3 --min-port=32355 --max-port=65535 -r north.gov --mysql-userdb="host=localhost dbname=coturn user=turn password=turn connect_timeout=30 read_timeout=30" --cert=turn_server_cert.pem --pkey=turn_server_pkey.pem --log-file=stdout --cipher-list=ALL --oauth $@

View File

@ -15,7 +15,7 @@
# 3) use 3 relay threads (-m 3) # 3) use 3 relay threads (-m 3)
# 4) use min UDP relay port 32355 and max UDP relay port 65535 # 4) use min UDP relay port 32355 and max UDP relay port 65535
# 5) "-r north.gov" means "use authentication realm north.gov" # 5) "-r north.gov" means "use authentication realm north.gov"
# 6) --mysql-userdb="host=localhost dbname=coturn user=turn password=turn cipher=DHE-RSA-AES256-SHA connect_timeout=30" # 6) --mysql-userdb="host=localhost dbname=coturn user=turn password=turn cipher=DHE-RSA-AES256-SHA connect_timeout=30 read_timeout=30"
# means that local MySQL database "coturn" will be used, with database user "turn" and # means that local MySQL database "coturn" will be used, with database user "turn" and
# database user password "turn", and with SSL connection with cipher DHE-RSA-AES256-SHA, # database user password "turn", and with SSL connection with cipher DHE-RSA-AES256-SHA,
# and connection timeout 30 seconds. # and connection timeout 30 seconds.
@ -33,4 +33,4 @@ fi
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/ export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/
PATH="./bin/:../bin/:../../bin/:${PATH}" turnserver --server-name="blackdow.carleon.gov" -v --syslog -a -L 127.0.0.1 -L ::1 -E 127.0.0.1 -E ::1 --max-bps=3000000 -f -m 3 --min-port=32355 --max-port=65535 -r north.gov --mysql-userdb="host=localhost dbname=coturn user=turn password=turn cipher=DHE-RSA-AES256-SHA connect_timeout=30" --cert=turn_server_cert.pem --pkey=turn_server_pkey.pem --log-file=stdout --cipher-list=ALL --oauth $@ PATH="./bin/:../bin/:../../bin/:${PATH}" turnserver --server-name="blackdow.carleon.gov" -v --syslog -a -L 127.0.0.1 -L ::1 -E 127.0.0.1 -E ::1 --max-bps=3000000 -f -m 3 --min-port=32355 --max-port=65535 -r north.gov --mysql-userdb="host=localhost dbname=coturn user=turn password=turn cipher=DHE-RSA-AES256-SHA connect_timeout=30 read_timeout=30" --cert=turn_server_cert.pem --pkey=turn_server_pkey.pem --log-file=stdout --cipher-list=ALL --oauth $@

View File

@ -166,7 +166,7 @@ secret\-based timed authentication in TURN RESP API.
The connection string format is like that: The connection string format is like that:
.RS .RS
.PP .PP
"host=<host> dbname=<dbname> user=<db\-user> password=<db\-user\-password> connect_timeout=<seconds>" "host=<host> dbname=<dbname> user=<db\-user> password=<db\-user\-password> connect_timeout=<seconds> read_timeout=<seconds>"
.PP .PP
See the INSTALL file for more explanations and examples. See the INSTALL file for more explanations and examples.
.PP .PP

View File

@ -46,6 +46,7 @@ struct _Myconninfo {
char *password; char *password;
unsigned int port; unsigned int port;
unsigned int connect_timeout; unsigned int connect_timeout;
unsigned int read_timeout;
/* SSL ==>> */ /* SSL ==>> */
char *key; char *key;
char *ca; char *ca;
@ -139,6 +140,8 @@ static Myconninfo *MyconninfoParse(char *userdb, char **errmsg) {
co->connect_timeout = (unsigned int)atoi(seq+1); co->connect_timeout = (unsigned int)atoi(seq+1);
else if(!strcmp(s,"timeout")) else if(!strcmp(s,"timeout"))
co->connect_timeout = (unsigned int)atoi(seq+1); co->connect_timeout = (unsigned int)atoi(seq+1);
else if(!strcmp(s,"read_timeout"))
co->read_timeout = (unsigned int)atoi(seq+1);
else if(!strcmp(s,"key")) else if(!strcmp(s,"key"))
co->key = turn_strdup(seq+1); co->key = turn_strdup(seq+1);
else if(!strcmp(s,"ssl-key")) else if(!strcmp(s,"ssl-key"))
@ -226,6 +229,8 @@ static MYSQL *get_mydb_connection(void) {
} else { } else {
if(co->connect_timeout) if(co->connect_timeout)
mysql_options(mydbconnection,MYSQL_OPT_CONNECT_TIMEOUT,&(co->connect_timeout)); mysql_options(mydbconnection,MYSQL_OPT_CONNECT_TIMEOUT,&(co->connect_timeout));
if(co->read_timeout)
mysql_options(mydbconnection,MYSQL_OPT_READ_TIMEOUT,&(co->read_timeout));
if(co->ca || co->capath || co->cert || co->cipher || co->key) { if(co->ca || co->capath || co->cert || co->cipher || co->key) {
mysql_ssl_set(mydbconnection, co->key, co->cert, co->ca, co->capath, co->cipher); mysql_ssl_set(mydbconnection, co->key, co->cert, co->ca, co->capath, co->cipher);
} }

View File

@ -462,7 +462,7 @@ static char Usage[] = "Usage: turnserver [options]\n"
" This database can be used for long-term credentials mechanism users,\n" " This database can be used for long-term credentials mechanism users,\n"
" and it can store the secret value(s) for secret-based timed authentication in TURN RESP API.\n" " and it can store the secret value(s) for secret-based timed authentication in TURN RESP API.\n"
" The connection string my be space-separated list of parameters:\n" " The connection string my be space-separated list of parameters:\n"
" \"host=<ip-addr> dbname=<database-name> user=<database-user> \\\n password=<database-user-password> port=<db-port> connect_timeout=<seconds>\".\n\n" " \"host=<ip-addr> dbname=<database-name> user=<database-user> \\\n password=<database-user-password> port=<db-port> connect_timeout=<seconds> read_timeout=<seconds>\".\n\n"
" The connection string parameters for the secure communications (SSL):\n" " The connection string parameters for the secure communications (SSL):\n"
" ca, capath, cert, key, cipher\n" " ca, capath, cert, key, cipher\n"
" (see http://dev.mysql.com/doc/refman/5.1/en/ssl-options.html for the\n" " (see http://dev.mysql.com/doc/refman/5.1/en/ssl-options.html for the\n"