浏览代码

pipelimit: if db url or table name are empty, skip loading pipes from db

Daniel-Constantin Mierla 11 年之前
父节点
当前提交
658aabd74b
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      modules/pipelimit/pl_db.c

+ 6 - 6
modules/pipelimit/pl_db.c

@@ -106,18 +106,18 @@ int pl_init_db(void)
 	if(pl_db_url.s==NULL)
 		return 1;
 
-	if(rlp_table_name.s == 0)
-	{
-		LM_ERR("invalid database table name\n");
-		return -1;
-	}
-
 	pl_db_url.len         = strlen(pl_db_url.s);
 	rlp_table_name.len    = strlen(rlp_table_name.s);
 	rlp_pipeid_col.len    = strlen(rlp_pipeid_col.s);
 	rlp_limit_col.len     = strlen(rlp_limit_col.s);
 	rlp_algorithm_col.len = strlen(rlp_algorithm_col.s);
 
+	if(rlp_table_name.len <= 0 || pl_db_url.len<=0)
+	{
+		LM_INFO("no table name or db url - skipping loading from db\n");
+		return 0;
+	}
+
 	/* Find a database module */
 	if (db_bind_mod(&pl_db_url, &pl_dbf) < 0)
 	{