Explorar o código

default turndb changed to ~/turndb

mom040267 %!s(int64=11) %!d(string=hai) anos
pai
achega
ef149fb30d

+ 2 - 2
README.turnadmin

@@ -80,7 +80,7 @@ Commands:
   
   
 Options with required values:  
 Options with required values:  
 
 
--b, --db, --userdb		SQLite user database file name (default - /var/turndb).
+-b, --db, --userdb		SQLite user database file name (default - ~/turndb).
 			See the same option in the turnserver section.
 			See the same option in the turnserver section.
 -e, --psql-userdb	PostgreSQL user database connection string.
 -e, --psql-userdb	PostgreSQL user database connection string.
 			See the --psql-userdb option in the turnserver section.
 			See the --psql-userdb option in the turnserver section.
@@ -170,7 +170,7 @@ to see the man page.
 
 
 /etc/turnserver.conf
 /etc/turnserver.conf
 
 
-/var/turndb
+~/turndb
 
 
 /usr/local/etc/turnserver.conf
 /usr/local/etc/turnserver.conf
 
 

+ 3 - 3
README.turnserver

@@ -81,7 +81,7 @@ Config file settings:
 
 
 User database settings:  
 User database settings:  
 
 
--b, --db, --userdb	SQLite user database file name (default - /var/turndb).
+-b, --db, --userdb	SQLite user database file name (default - ~/turndb).
 				  
 				  
 -e, --psql-userdb	User database connection string for PostgreSQL.
 -e, --psql-userdb	User database connection string for PostgreSQL.
 		This database can be used for long-term and short-term 
 		This database can be used for long-term and short-term 
@@ -716,7 +716,7 @@ For the user database, the turnserver has the following options:
 Obviously, only a few users can be set that way, and their credentials are fixed 
 Obviously, only a few users can be set that way, and their credentials are fixed 
 for the turnserver process lifetime.
 for the turnserver process lifetime.
 
 
-2) Users can be stored in SQlite DB. The default SQLite database file is /var/turndb.
+2) Users can be stored in SQLite DB. The default SQLite database file is ~/turndb.
 
 
 3) Users can be stored in PostgreSQL database, if the turnserver was compiled with PostgreSQL
 3) Users can be stored in PostgreSQL database, if the turnserver was compiled with PostgreSQL
 support. Each time turnserver checks user credentials, it reads the database (asynchronously,
 support. Each time turnserver checks user credentials, it reads the database (asynchronously,
@@ -841,7 +841,7 @@ FILES
 
 
 /etc/turnserver.conf
 /etc/turnserver.conf
 
 
-/var/turndb
+~/turndb
 
 
 /usr/local/etc/turnserver.conf
 /usr/local/etc/turnserver.conf
 
 

+ 1 - 1
README.turnutils

@@ -251,7 +251,7 @@ FILES
 
 
 /etc/turnserver.conf
 /etc/turnserver.conf
 
 
-/var/turndb
+~/turndb
 
 
 /usr/local/etc/turnserver.conf
 /usr/local/etc/turnserver.conf
 
 

+ 2 - 2
examples/etc/turnserver.conf

@@ -250,9 +250,9 @@
 
 
 # SQLite database file name.
 # SQLite database file name.
 #
 #
-# Default file name is /var/turndb
+# Default file name is ~/turndb (turndb in the process' home directory).
 # 
 # 
-#userdb=/var/turndb
+#userdb=~/turndb
 
 
 # PostgreSQL database connection string in the case that we are using PostgreSQL
 # PostgreSQL database connection string in the case that we are using PostgreSQL
 # as the user database.
 # as the user database.

+ 2 - 2
man/man1/turnadmin.1

@@ -132,7 +132,7 @@ Options with required values:
 .TP
 .TP
 .B
 .B
 \fB\-b\fP, \fB\-\-db\fP, \fB\-\-userdb\fP
 \fB\-b\fP, \fB\-\-db\fP, \fB\-\-userdb\fP
-SQLite user database file name (default \- /var/turndb).
+SQLite user database file name (default \- ~/turndb).
 See the same option in the \fIturnserver\fP section.
 See the same option in the \fIturnserver\fP section.
 .TP
 .TP
 .B
 .B
@@ -261,7 +261,7 @@ to see the man page.
 
 
 /etc/turnserver.conf
 /etc/turnserver.conf
 .PP
 .PP
-/var/turndb
+~/turndb
 .PP
 .PP
 /usr/local/etc/turnserver.conf
 /usr/local/etc/turnserver.conf
 .PP
 .PP

+ 3 - 3
man/man1/turnserver.1

@@ -132,7 +132,7 @@ User database settings:
 .TP
 .TP
 .B
 .B
 \fB\-b\fP, \fB\-\-db\fP, \fB\-\-userdb\fP
 \fB\-b\fP, \fB\-\-db\fP, \fB\-\-userdb\fP
-SQLite user database file name (default \- /var/turndb).
+SQLite user database file name (default \- ~/turndb).
 .TP
 .TP
 .B
 .B
 \fB\-e\fP, \fB\-\-psql\-userdb\fP
 \fB\-e\fP, \fB\-\-psql\-userdb\fP
@@ -971,7 +971,7 @@ Users can be set in the command line, with multiple \fB\-u\fP or \fB\-\-user\fP
 Obviously, only a few users can be set that way, and their credentials are fixed 
 Obviously, only a few users can be set that way, and their credentials are fixed 
 for the \fIturnserver\fP process lifetime.
 for the \fIturnserver\fP process lifetime.
 .IP 2) 4
 .IP 2) 4
-Users can be stored in SQlite DB. The default SQLite database file is /var/turndb.
+Users can be stored in SQLite DB. The default SQLite database file is ~/turndb.
 .IP 3) 4
 .IP 3) 4
 Users can be stored in PostgreSQL database, if the \fIturnserver\fP was compiled with PostgreSQL
 Users can be stored in PostgreSQL database, if the \fIturnserver\fP was compiled with PostgreSQL
 support. Each time \fIturnserver\fP checks user credentials, it reads the database (asynchronously,
 support. Each time \fIturnserver\fP checks user credentials, it reads the database (asynchronously,
@@ -1096,7 +1096,7 @@ it would affect the performance.
 
 
 /etc/turnserver.conf
 /etc/turnserver.conf
 .PP
 .PP
-/var/turndb
+~/turndb
 .PP
 .PP
 /usr/local/etc/turnserver.conf
 /usr/local/etc/turnserver.conf
 .PP
 .PP

+ 1 - 1
man/man1/turnutils.1

@@ -374,7 +374,7 @@ to see the man page.
 
 
 /etc/turnserver.conf
 /etc/turnserver.conf
 .PP
 .PP
-/var/turndb
+~/turndb
 .PP
 .PP
 /usr/local/etc/turnserver.conf
 /usr/local/etc/turnserver.conf
 .PP
 .PP

+ 20 - 0
src/apps/relay/dbdrivers/dbd_sqlite.c

@@ -36,6 +36,26 @@
 
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
+static int sqlite_init_multithreaded(void) {
+
+	sqlite3_shutdown();
+
+	if (sqlite3_threadsafe() > 0) {
+		int retCode = sqlite3_config(SQLITE_CONFIG_SERIALIZED);
+		if (retCode == SQLITE_OK) {
+			TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Can now use sqlite on multiple threads, using the same connection\n");
+		} else {
+			TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "setting sqlite thread safe mode to serialized failed!!! return code: %d\n", retCode);
+			return -1;
+		}
+	} else {
+		TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Your SQLite database is not compiled to be threadsafe.\n");
+		return -1;
+	}
+
+	return 0;
+}
+
 #if 0
 #if 0
 
 
 static int donot_print_connection_success = 0;
 static int donot_print_connection_success = 0;

+ 2 - 2
src/apps/relay/mainrelay.c

@@ -412,7 +412,7 @@ static char Usage[] = "Usage: turnserver [options]\n"
 "						Total bytes-per-second bandwidth the TURN server is allowed to allocate\n"
 "						Total bytes-per-second bandwidth the TURN server is allowed to allocate\n"
 "						for the sessions, combined (input and output network streams are treated separately).\n"
 "						for the sessions, combined (input and output network streams are treated separately).\n"
 " -c				<filename>	Configuration file name (default - turnserver.conf).\n"
 " -c				<filename>	Configuration file name (default - turnserver.conf).\n"
-" -b, , --db, --userdb	<filename>		SQLite database file name (default - "DEFAULT_USERDB_FILE").\n"
+" -b, , --db, --userdb	<filename>		SQLite database file name (default - ~/turndb).\n"
 #if !defined(TURN_NO_PQ)
 #if !defined(TURN_NO_PQ)
 " -e, --psql-userdb, --sql-userdb <conn-string>	PostgreSQL database connection string, if used (default - empty, no PostreSQL DB used).\n"
 " -e, --psql-userdb, --sql-userdb <conn-string>	PostgreSQL database connection string, if used (default - empty, no PostreSQL DB used).\n"
 "		                                This database can be used for long-term and short-term credentials mechanisms,\n"
 "		                                This database can be used for long-term and short-term credentials mechanisms,\n"
@@ -584,7 +584,7 @@ static char AdminUsage[] = "Usage: turnadmin [command] [options]\n"
 	"	-g, --set-realm-option		Set realm params: max-bps, total-quota, user-quota.\n"
 	"	-g, --set-realm-option		Set realm params: max-bps, total-quota, user-quota.\n"
 	"	-G, --list-realm-options	List realm params.\n"
 	"	-G, --list-realm-options	List realm params.\n"
 	"\nOptions with mandatory values:\n\n"
 	"\nOptions with mandatory values:\n\n"
-	"	-b, --db, --userdb		SQLite database file, default value is "DEFAULT_USERDB_FILE".\n"
+	"	-b, --db, --userdb		SQLite database file, default value is ~/turndb.\n"
 #if !defined(TURN_NO_PQ)
 #if !defined(TURN_NO_PQ)
 	"	-e, --psql-userdb, --sql-userdb	PostgreSQL user database connection string, if PostgreSQL DB is used.\n"
 	"	-e, --psql-userdb, --sql-userdb	PostgreSQL user database connection string, if PostgreSQL DB is used.\n"
 #endif
 #endif

+ 1 - 1
src/apps/relay/userdb.h

@@ -48,7 +48,7 @@ extern "C" {
 
 
 //////////// Defines //////////////////////////////
 //////////// Defines //////////////////////////////
 
 
-#define DEFAULT_USERDB_FILE ("/var/turndb")
+#define DEFAULT_USERDB_FILE ("~/turndb")
 
 
 #define AUTH_SECRET_SIZE (512)
 #define AUTH_SECRET_SIZE (512)