read_timeout support

pull/40/head
Oleg Moskalenko 9 years ago
parent 79aed7d8b7
commit 9124a167ed
  1. 3
      ChangeLog
  2. 6
      INSTALL
  3. 2
      README.turnserver
  4. 2
      examples/etc/turnserver.conf
  5. 4
      examples/scripts/longtermsecuredb/secure_relay_with_db_mysql.sh
  6. 4
      examples/scripts/longtermsecuredb/secure_relay_with_db_mysql_ssl.sh
  7. 2
      man/man1/turnserver.1
  8. 5
      src/apps/relay/dbdrivers/dbd_mysql.c
  9. 2
      src/apps/relay/mainrelay.c

@ -1,7 +1,8 @@
08/27/2016 Oleg Moskalenko <mom040267@gmail.com>
Version 4.5.0.5 'dan Eider':
- 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>
Version 4.5.0.4 'dan Eider':

@ -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.
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)
So, an example of the MySQL database parameter in the TURN server command
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:
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
the optional connection string parameters for the secure communications:

@ -108,7 +108,7 @@ User database settings:
secret-based timed authentication in TURN RESP API.
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.

@ -274,7 +274,7 @@
#
# 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
# as the user database.

@ -15,7 +15,7 @@
# 3) use 3 relay threads (-m 3)
# 4) use min UDP relay port 32355 and max UDP relay port 65535
# 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
# database user password "turn", and connection timeout 30 seconds.
# 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 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 $@

@ -15,7 +15,7 @@
# 3) use 3 relay threads (-m 3)
# 4) use min UDP relay port 32355 and max UDP relay port 65535
# 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
# database user password "turn", and with SSL connection with cipher DHE-RSA-AES256-SHA,
# 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 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 $@

@ -166,7 +166,7 @@ secret\-based timed authentication in TURN RESP API.
The connection string format is like that:
.RS
.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
See the INSTALL file for more explanations and examples.
.PP

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

@ -462,7 +462,7 @@ static char Usage[] = "Usage: turnserver [options]\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"
" 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"
" ca, capath, cert, key, cipher\n"
" (see http://dev.mysql.com/doc/refman/5.1/en/ssl-options.html for the\n"

Loading…
Cancel
Save