Sfoglia il codice sorgente

tm: lock replies before restoring flags for onreply_route

Daniel-Constantin Mierla 11 anni fa
parent
commit
ac2e49b418
1 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 5 3
      modules/tm/t_reply.c

+ 5 - 3
modules/tm/t_reply.c

@@ -2336,6 +2336,11 @@ int reply_received( struct sip_msg  *p_msg )
 	/* processing of on_reply block */
 	if (onreply_route) {
 		set_route_type(TM_ONREPLY_ROUTE);
+
+		/* lock onreply_route, for safe avp usage */
+		LOCK_REPLIES( t );
+		replies_locked=1;
+
 		/* transfer transaction flag to message context */
 		if (t->uas.request) p_msg->flags=t->uas.request->flags;
 		/* set the as avp_list the one from transaction */
@@ -2353,9 +2358,6 @@ int reply_received( struct sip_msg  *p_msg )
 		/* Pre- and post-script callbacks have already
 		 * been executed by the core. (Miklos)
 		 */
-		/* lock onreply_route, for safe avp usage */
-		LOCK_REPLIES( t );
-		replies_locked=1;
 		run_top_route(onreply_rt.rlist[onreply_route], p_msg, &ctx);
 		/* transfer current message context back to t */
 		if (t->uas.request) t->uas.request->flags=p_msg->flags;