Ver Fonte

tm: backup/restore lump lists for faked requests

- some cfg functions that can be used in failure_route can destroy the
  head of lump lists, thus better backup before and restore after failure_route
  execution
Daniel-Constantin Mierla há 14 anos atrás
pai
commit
b6d90904de
1 ficheiros alterados com 13 adições e 0 exclusões
  1. 13 0
      modules/tm/t_reply.c

+ 13 - 0
modules/tm/t_reply.c

@@ -764,6 +764,11 @@ void faked_env( struct cell *t, struct sip_msg *msg)
 #endif
 	static struct socket_info* backup_si;
 
+	static struct lump *backup_add_rm;
+	static struct lump *backup_body_lumps;
+	static struct lump_rpl *backup_reply_lump;
+
+
 	if (msg) {
 		/* remember we are back in request processing, but process
 		 * a shmem-ed replica of the request; advertise it in route type;
@@ -803,6 +808,10 @@ void faked_env( struct cell *t, struct sip_msg *msg)
 		/* set default send address to the saved value */
 		backup_si=bind_address;
 		bind_address=t->uac[0].request.dst.send_sock;
+		/* backup lump lists */
+		backup_add_rm = t->uas.request->add_rm;
+		backup_body_lumps = t->uas.request->body_lumps;
+		backup_reply_lump = t->uas.request->reply_lump;
 	} else {
 		/* restore original environment */
 		set_t(backup_t, backup_branch);
@@ -819,6 +828,10 @@ void faked_env( struct cell *t, struct sip_msg *msg)
 		xavp_set_list(backup_xavps);
 #endif
 		bind_address=backup_si;
+		/* restore lump lists */
+		t->uas.request->add_rm = backup_add_rm;
+		t->uas.request->body_lumps = backup_body_lumps;
+		t->uas.request->reply_lump = backup_reply_lump;
 	}
 }