~ubuntu-branches/debian/sid/coturn/sid

« back to all changes in this revision

Viewing changes to src/apps/relay/dbdrivers/dbd_mysql.c

  • Committer: Package Import Robot
  • Author(s): Oleg Moskalenko
  • Date: 2014-12-24 00:50:38 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20141224005038-ppryqxsqss7oazf9
Tags: 4.3.3.1-1
Sync to 4.3.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
189
189
}
190
190
 
191
191
static MYSQL *get_mydb_connection(void) {
 
192
 
192
193
        persistent_users_db_t *pud = get_persistent_users_db();
193
194
 
194
 
        MYSQL *mydbconnection = (MYSQL*)(pud->connection);
 
195
        MYSQL *mydbconnection = (MYSQL*)pthread_getspecific(connection_key);
195
196
 
196
197
        if(mydbconnection) {
197
198
                if(mysql_ping(mydbconnection)) {
198
199
                        mysql_close(mydbconnection);
199
200
                        mydbconnection=NULL;
 
201
                        (void) pthread_setspecific(connection_key, mydbconnection);
200
202
                }
201
203
        }
202
204
 
238
240
                                        mydbconnection=NULL;
239
241
                                } else if(!donot_print_connection_success) {
240
242
                                        TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "MySQL DB connection success: %s\n",pud->userdb);
 
243
                                        donot_print_connection_success = 1;
241
244
                                }
242
245
                        }
243
246
                        MyconninfoFree(co);
244
247
                }
245
 
                pud->connection = mydbconnection;
 
248
                if(mydbconnection) {
 
249
                        (void) pthread_setspecific(connection_key, mydbconnection);
 
250
                }
246
251
        }
247
252
        return mydbconnection;
248
253
}
872
877
  
873
878
static void mysql_auth_ping(void * rch) {
874
879
        UNUSED_ARG(rch);
875
 
        donot_print_connection_success = 1;
876
880
        MYSQL * myc = get_mydb_connection();
877
881
        if(myc) {
878
882
                char statement[TURN_LONG_STRING_SIZE];
1063
1067
 
1064
1068
///////////////////////////////////////////////////////////////////////////////////////////////////////////
1065
1069
 
1066
 
static turn_dbdriver_t driver = {
 
1070
static const turn_dbdriver_t driver = {
1067
1071
  &mysql_get_auth_secrets,
1068
1072
  &mysql_get_user_key,
1069
1073
  &mysql_get_user_pwd,
1088
1092
  &mysql_list_oauth_keys
1089
1093
};
1090
1094
 
1091
 
turn_dbdriver_t * get_mysql_dbdriver(void) {
 
1095
const turn_dbdriver_t * get_mysql_dbdriver(void) {
1092
1096
  return &driver;
1093
1097
}
1094
1098
 
1096
1100
 
1097
1101
#else
1098
1102
 
1099
 
turn_dbdriver_t * get_mysql_dbdriver(void) {
 
1103
const turn_dbdriver_t * get_mysql_dbdriver(void) {
1100
1104
  return NULL;
1101
1105
}
1102
1106