Răsfoiți Sursa

updates related to the new lump_rpl changes

Bogdan-Andrei Iancu 22 ani în urmă
părinte
comite
c13b8274b3
2 a modificat fișierele cu 21 adăugiri și 21 ștergeri
  1. 3 1
      modules/tm/sip_msg.c
  2. 18 20
      modules/tm/t_reply.c

+ 3 - 1
modules/tm/sip_msg.c

@@ -44,6 +44,7 @@
  *  2003-03-31  removed msg->repl_add_rm (andrei)
  *  2003-04-04  parsed uris are recalculated on cloning (jiri)
  *  2003-05-07  received, rport & i via shortcuts are also translated (andrei)
+ *  2003-11-11  updated cloning of lump_rpl (bogdan)
  */
 
 #include "defs.h"
@@ -678,7 +679,8 @@ do { \
 	{
 		*(rpl_lump_anchor)=(struct lump_rpl*)p;
 		p+=ROUND4(sizeof( struct lump_rpl ));
-		(*rpl_lump_anchor)->type = rpl_lump->type;
+		(*rpl_lump_anchor)->flags =
+			rpl_lump->flags&(!(LUMP_RPL_NODUP|LUMP_RPL_NOFREE));
 		(*rpl_lump_anchor)->text.len = rpl_lump->text.len;
 		(*rpl_lump_anchor)->text.s=p;
 		p+=ROUND4(rpl_lump->text.len);

+ 18 - 20
modules/tm/t_reply.c

@@ -51,6 +51,7 @@
  *              build_res_buf_with_body_from_sip_req() (bogdan)
  *  2003-11-05  flag context updated from failure/reply handlers back
  *              to transaction context (jiri)
+ *  2003-11-11: build_lump_rpl() removed, add_lump_rpl() has flags (bogdan)
  */
 
 
@@ -1202,27 +1203,24 @@ int t_reply_with_body( struct cell *trans, unsigned int code,
 	/* mark the transaction as replied */
 	if (code>=200) set_kr(REQ_RPLD);
 
-	/* build the lumps for new_header and for body (by bogdan) */
-	hdr_lump = build_lump_rpl( new_header , strlen(new_header) , LUMP_RPL_HDR );
-	if (hdr_lump==0) {
-		LOG(L_ERR,"ERROR:tm:t_reply_with_body: cannot create hdr lump\n");
+	/* add the lumps for new_header and for body (by bogdan) */
+	hdr_lump = add_lump_rpl( trans->uas.request, new_header,
+		strlen(new_header), LUMP_RPL_HDR );
+	if ( !hdr_lump ) {
+		LOG(L_ERR,"ERROR:tm:t_reply_with_body: cannot add hdr lump\n");
 		goto error;
 	}
-	add_lump_rpl( trans->uas.request, hdr_lump);
 	/* body lump */
 	if(body && strlen(body)) {
-	    body_lump = build_lump_rpl( body , strlen(body) , LUMP_RPL_BODY );
-	    if (body_lump==0) {
-		LOG(L_ERR,"ERROR:tm:t_reply_with_body: cannot create body lump\n");
-		goto error_1;
-	    }
-	    if (add_lump_rpl( trans->uas.request, body_lump)==-1) {
-		LOG(L_ERR,"ERROR:tm:t_reply_with_body: cannot add body lump\n");
-		goto error_1;
-	    }
+		body_lump = add_lump_rpl( trans->uas.request, body, strlen(body),
+			LUMP_RPL_BODY );
+		if (body_lump==0) {
+			LOG(L_ERR,"ERROR:tm:t_reply_with_body: cannot add body lump\n");
+			goto error_1;
+		}
+	} else {
+		body_lump = 0;
 	}
-	else
-	    body_lump = 0;
 
 	rpl.s = build_res_buf_from_sip_req(
 			code, text, &s_to_tag,
@@ -1232,10 +1230,10 @@ int t_reply_with_body( struct cell *trans, unsigned int code,
 	 * memory leak or crashing (lumps are create in private memory) I will
 	 * remove the lumps by myself here (bogdan) */
 	unlink_lump_rpl( trans->uas.request, hdr_lump);
-	pkg_free( hdr_lump );
+	free_lump_rpl( hdr_lump );
 	if( body_lump ) {
-	    unlink_lump_rpl( trans->uas.request, body_lump);
-	    pkg_free( body_lump );
+		unlink_lump_rpl( trans->uas.request, body_lump);
+		free_lump_rpl( body_lump );
 	}
 
 	if (rpl.s==0) {
@@ -1257,7 +1255,7 @@ int t_reply_with_body( struct cell *trans, unsigned int code,
 	return ret;
 error_1:
 	unlink_lump_rpl( trans->uas.request, hdr_lump);
-	pkg_free( hdr_lump );
+	free_lump_rpl( hdr_lump );
 error:
 	return -1;
 }