Переглянути джерело

tm: reset T_ASYNC_SUSPENDED flag at beginning of t_continue()

- should allow doing t_suspend() inside the route executed by
  t_continue()
- related to GH #644 and #645
Daniel-Constantin Mierla 9 роки тому
батько
коміт
827ec4fc2c
1 змінених файлів з 4 додано та 6 видалено
  1. 4 6
      modules/tm/t_suspend.c

+ 4 - 6
modules/tm/t_suspend.c

@@ -204,8 +204,11 @@ int t_continue(unsigned int hash_index, unsigned int label,
 	t->flags |= T_ASYNC_CONTINUE;   /* we can now know anywhere in kamailio
 	t->flags |= T_ASYNC_CONTINUE;   /* we can now know anywhere in kamailio
 					 * that we are executing post a suspend */
 					 * that we are executing post a suspend */
 
 
+	/* transaction is no longer suspended, resetting the SUSPEND flag */
+	t->flags &= ~T_ASYNC_SUSPENDED;
+
 	/* which route block type were we in when we were suspended */
 	/* which route block type were we in when we were suspended */
-	cb_type =  FAILURE_CB_TYPE;;
+	cb_type =  FAILURE_CB_TYPE;
 	switch (t->async_backup.backup_route) {
 	switch (t->async_backup.backup_route) {
 		case REQUEST_ROUTE:
 		case REQUEST_ROUTE:
 			cb_type = FAILURE_CB_TYPE;
 			cb_type = FAILURE_CB_TYPE;
@@ -231,7 +234,6 @@ int t_continue(unsigned int hash_index, unsigned int label,
 				/* Either t_continue() has already been
 				/* Either t_continue() has already been
 				* called or the branch has already timed out.
 				* called or the branch has already timed out.
 				* Needless to continue. */
 				* Needless to continue. */
-				t->flags &= ~T_ASYNC_SUSPENDED;
 				UNLOCK_ASYNC_CONTINUE(t);
 				UNLOCK_ASYNC_CONTINUE(t);
 				UNREF(t); /* t_unref would kill the transaction */
 				UNREF(t); /* t_unref would kill the transaction */
 				return 1;
 				return 1;
@@ -456,14 +458,10 @@ done:
 		t->uac[branch].reply = 0;
 		t->uac[branch].reply = 0;
 	}
 	}
 
 
-	/*This transaction is no longer suspended so unsetting the SUSPEND flag*/
-	t->flags &= ~T_ASYNC_SUSPENDED;
-
 
 
 	return 0;
 	return 0;
 
 
 kill_trans:
 kill_trans:
-	t->flags &= ~T_ASYNC_SUSPENDED;
 	/* The script has hopefully set the error code. If not,
 	/* The script has hopefully set the error code. If not,
 	 * let us reply with a default error. */
 	 * let us reply with a default error. */
 	if ((kill_transaction_unsafe(t,
 	if ((kill_transaction_unsafe(t,