Parcourir la source

permissions(k): reverted incomplete fix for mi cmd

- the mi command execution via rpc is fixed by initialization of mi commands
  done now by mi_rpc module
Daniel-Constantin Mierla il y a 15 ans
Parent
commit
a92bb2ee26
1 fichiers modifiés avec 5 ajouts et 18 suppressions
  1. 5 18
      modules_k/permissions/address.c

+ 5 - 18
modules_k/permissions/address.c

@@ -78,17 +78,6 @@ int reload_address_table(void)
     cols[2] = &mask_col;
     cols[3] = &port_col;
 
-    if (db_handle) {
-       LM_ERR("db_handle already exists\n");
-       return -1;
-    }
-       
-    db_handle = perm_dbf.init(&db_url);
-    if (!db_handle) {
-       LM_ERR("unable to connect database\n");
-       return -1;
-    }
-
     if (perm_dbf.use_table(db_handle, &address_table) < 0) {
 	    LM_ERR("failed to use table\n");
 		return -1;
@@ -172,9 +161,6 @@ int reload_address_table(void)
 
     perm_dbf.free_result(db_handle, res);
 
-    perm_dbf.close(db_handle);
-    db_handle = 0;
-
     *addr_hash_table = new_hash_table;
     *subnet_table = new_subnet_table;
 
@@ -217,13 +203,9 @@ int init_addresses(void)
     if(db_check_table_version(&perm_dbf, db_handle, &address_table, TABLE_VERSION) < 0) {
 		LM_ERR("error during table version check.\n");
 		perm_dbf.close(db_handle);
-		db_handle = 0;
 		return -1;
     }
 
-    perm_dbf.close(db_handle);
-    db_handle = 0;
-
     addr_hash_table_1 = new_addr_hash_table();
     if (!addr_hash_table_1) return -1;
 
@@ -252,6 +234,9 @@ int init_addresses(void)
 	goto error;
     }
 
+    perm_dbf.close(db_handle);
+    db_handle = 0;
+
     return 0;
 
 error:
@@ -280,6 +265,8 @@ error:
 	shm_free(subnet_table);
 	subnet_table = 0;
     }
+    perm_dbf.close(db_handle);
+    db_handle = 0;
     return -1;
 }