[sr-dev] git:master:de11e285: tm: removed async mutex define option

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 30 09:08:31 CEST 2019


Module: kamailio
Branch: master
Commit: de11e2850314b12320cf8fed29f709a38a986709
URL: https://github.com/kamailio/kamailio/commit/de11e2850314b12320cf8fed29f709a38a986709

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-09-30T09:07:58+02:00

tm: removed async mutex define option

- it was disbaled due to conflict with reply processing, the reply mutex
being used, t_continue() has same processing like a failure handling

---

Modified: src/modules/tm/h_table.c
Modified: src/modules/tm/h_table.h
Modified: src/modules/tm/lock.c
Modified: src/modules/tm/lock.h
Modified: src/modules/tm/t_suspend.c

---

Diff:  https://github.com/kamailio/kamailio/commit/de11e2850314b12320cf8fed29f709a38a986709.diff
Patch: https://github.com/kamailio/kamailio/commit/de11e2850314b12320cf8fed29f709a38a986709.patch

---

diff --git a/src/modules/tm/h_table.c b/src/modules/tm/h_table.c
index 3f10817013..d0ec6c8452 100644
--- a/src/modules/tm/h_table.c
+++ b/src/modules/tm/h_table.c
@@ -396,7 +396,6 @@ struct cell *build_cell(struct sip_msg *p_msg)
 
 	init_synonym_id(p_msg, new_cell->md5);
 	init_cell_lock(new_cell);
-	init_async_lock(new_cell);
 	t_stats_created();
 	return new_cell;
 
diff --git a/src/modules/tm/h_table.h b/src/modules/tm/h_table.h
index cf0a4b549f..ef666e5955 100644
--- a/src/modules/tm/h_table.h
+++ b/src/modules/tm/h_table.h
@@ -406,11 +406,6 @@ typedef struct cell
 	/* recursive reply lock count */
 	int reply_rec_lock_level;
 
-#ifdef ENABLE_ASYNC_MUTEX
-	/* protect against concurrent async continues */
-	ser_lock_t async_mutex;
-#endif
-
 	ticks_t fr_timeout;		/* final response interval for retr_bufs */
 	ticks_t fr_inv_timeout; /* final inv. response interval for retr_bufs */
 	retr_timeout_t rt_t1_timeout_ms; /* start retr. interval for retr_bufs */
diff --git a/src/modules/tm/lock.c b/src/modules/tm/lock.c
index 45b267d064..c06bd4c16a 100644
--- a/src/modules/tm/lock.c
+++ b/src/modules/tm/lock.c
@@ -50,9 +50,6 @@
 static int sem_nr;
 gen_lock_set_t *entry_semaphore = 0;
 gen_lock_set_t *reply_semaphore = 0;
-#ifdef ENABLE_ASYNC_MUTEX
-gen_lock_set_t *async_semaphore = 0;
-#endif
 #endif
 
 
@@ -82,12 +79,6 @@ int lock_initialize()
 			lock_set_destroy(reply_semaphore);
 			lock_set_dealloc(reply_semaphore);
 		}
-#ifdef ENABLE_ASYNC_MUTEX
-		if(async_semaphore != 0) {
-			lock_set_destroy(async_semaphore);
-			lock_set_dealloc(async_semaphore);
-		}
-#endif
 		if(i == 0) {
 			LOG(L_CRIT, "lock_initialize: could not allocate semaphore"
 						" sets\n");
@@ -139,20 +130,6 @@ int lock_initialize()
 		i--;
 		goto again;
 	}
-#ifdef ENABLE_ASYNC_MUTEX
-	i++;
-	if(((async_semaphore = lock_set_alloc(i)) == 0)
-			|| (lock_set_init(async_semaphore) == 0)) {
-		if(async_semaphore) {
-			lock_set_dealloc(async_semaphore);
-			async_semaphore = 0;
-		}
-		LM_DBG("async semaphore initialization failure: %s\n", strerror(errno));
-		probe_run = 1;
-		i--;
-		goto again;
-	}
-#endif
 
 	/* return success */
 	LM_INFO("semaphore arrays of size %d allocated\n", sem_nr);
@@ -192,13 +169,6 @@ void lock_cleanup()
 		lock_set_destroy(reply_semaphore);
 		lock_set_dealloc(reply_semaphore);
 	};
-#ifdef ENABLE_ASYNC_MUTEX
-	if(async_semaphore != 0) {
-		lock_set_destroy(async_semaphore);
-		lock_set_dealloc(async_semaphore);
-	}
-	async_semaphore = 0;
-#endif
 	entry_semaphore = reply_semaphore = 0;
 }
 #endif /*GEN_LOCK_T_PREFERED*/
@@ -232,22 +202,6 @@ int init_entry_lock(struct s_table *ht, struct entry *entry)
 	return 0;
 }
 
-int init_async_lock(struct cell *cell)
-{
-#ifdef ENABLE_ASYNC_MUTEX
-
-#ifdef GEN_LOCK_T_PREFERED
-	lock_init(&cell->async_mutex);
-#else
-	cell->async_mutex.semaphore_set = async_semaphore;
-	cell->async_mutex.semaphore_index = cell->hash_index % sem_nr;
-#endif /* GEN_LOCK_T_PREFERED */
-
-#endif /* ENABLE_ASYNC_MUTEX */
-
-	return 0;
-}
-
 int release_cell_lock(struct cell *cell)
 {
 #ifndef GEN_LOCK_T_PREFERED
diff --git a/src/modules/tm/lock.h b/src/modules/tm/lock.h
index 7e0bf58424..a44f4ebae0 100644
--- a/src/modules/tm/lock.h
+++ b/src/modules/tm/lock.h
@@ -56,7 +56,6 @@ void lock_cleanup(void);
 
 int init_cell_lock(struct cell *cell);
 int init_entry_lock(struct s_table *ht, struct entry *entry);
-int init_async_lock(struct cell *cell);
 
 
 int release_cell_lock(struct cell *cell);
diff --git a/src/modules/tm/t_suspend.c b/src/modules/tm/t_suspend.c
index 20807a5cfd..be7b0a6842 100644
--- a/src/modules/tm/t_suspend.c
+++ b/src/modules/tm/t_suspend.c
@@ -41,13 +41,8 @@
 #include "../../core/data_lump_rpl.h"
 
 
-#ifdef ENABLE_ASYNC_MUTEX
-#define LOCK_ASYNC_CONTINUE(_t) lock(&(_t)->async_mutex )
-#define UNLOCK_ASYNC_CONTINUE(_t) unlock(&(_t)->async_mutex )
-#else
 #define LOCK_ASYNC_CONTINUE(_t) LOCK_REPLIES(_t)
 #define UNLOCK_ASYNC_CONTINUE(_t) UNLOCK_REPLIES(_t)
-#endif
 
 /* Suspends the transaction for later use.
  * Save the returned hash_index and label to get




More information about the sr-dev mailing list