[sr-dev] git:master: permissions(k): reverted incomplete fix for mi cmd

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 1 12:24:16 CEST 2010


Module: sip-router
Branch: master
Commit: 5dcc8789096e9c7148aa9ba1242f84e3412b050d
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5dcc8789096e9c7148aa9ba1242f84e3412b050d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu Jul  1 12:10:34 2010 +0200

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

---

 modules_k/permissions/address.c |   23 +++++------------------
 1 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/modules_k/permissions/address.c b/modules_k/permissions/address.c
index 0dd7b10..469e21a 100644
--- a/modules_k/permissions/address.c
+++ b/modules_k/permissions/address.c
@@ -79,17 +79,6 @@ int reload_address_table(void)
     cols[2] = &mask_col;
     cols[3] = &port_col;
     cols[4] = &tag_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");
@@ -177,9 +166,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;
 
@@ -222,13 +208,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;
 
@@ -263,6 +245,9 @@ int init_addresses(void)
 	goto error;
     }
 
+    perm_dbf.close(db_handle);
+    db_handle = 0;
+
     return 0;
 
 error:
@@ -290,6 +275,8 @@ error:
 	shm_free(subnet_table);
 	subnet_table = 0;
     }
+    perm_dbf.close(db_handle);
+    db_handle = 0;
     return -1;
 }
 




More information about the sr-dev mailing list