Permalink
Browse files

pass send_socket when forwarding replies

  • Loading branch information...
1 parent aa318ca commit 19e9da1e4065cf38f7b6c9a69d49736529df5931 vladut-paiu committed Feb 22, 2012
Showing with 14 additions and 14 deletions.
  1. +6 −6 forward.c
  2. +2 −1 modules/tm/t_reply.c
  3. +5 −6 msg_translator.c
  4. +1 −1 msg_translator.h
View
@@ -594,12 +594,6 @@ int forward_reply(struct sip_msg* msg)
goto error;
}
- new_buf = build_res_buf_from_sip_res( msg, &new_len);
- if (!new_buf){
- LM_ERR("failed to build rpl from req failed\n");
- goto error;
- }
-
proto=msg->via2->proto;
if (update_sock_struct_from_via( to, msg, msg->via2 )==-1) goto error;
@@ -620,6 +614,12 @@ int forward_reply(struct sip_msg* msg)
send_sock = get_send_socket(msg, to, proto);
+ new_buf = build_res_buf_from_sip_res( msg, &new_len, send_sock);
+ if (!new_buf){
+ LM_ERR("failed to build rpl from req failed\n");
+ goto error;
+ }
+
if (msg_send(send_sock, proto, to, id, new_buf, new_len)<0) {
update_stat( drp_rpls, 1);
goto error0;
View
@@ -1210,7 +1210,8 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
} else {
relayed_code=relayed_msg->REPLY_STATUS;
- buf = build_res_buf_from_sip_res( relayed_msg, &res_len );
+ buf = build_res_buf_from_sip_res( relayed_msg, &res_len,
+ uas_rb->dst.send_sock);
/* if we build a message from shmem, we need to remove
via delete lumps which are now stirred in the shmem-ed
structure
View
@@ -1546,7 +1546,7 @@ char * build_req_buf_from_sip_req( struct sip_msg* msg,
char * build_res_buf_from_sip_res( struct sip_msg* msg,
- unsigned int *returned_len)
+ unsigned int *returned_len, struct socket_info *sock)
{
unsigned int new_len, via_len, body_delta, len;
char *new_buf, *buf;
@@ -1580,8 +1580,7 @@ char * build_res_buf_from_sip_res( struct sip_msg* msg,
goto error;
}
- new_len=len+body_delta+lumps_len(msg, msg->add_rm, 0); /*FIXME: we don't
- know the send sock */
+ new_len=len+body_delta+lumps_len(msg, msg->add_rm, sock);
LM_DBG(" old size: %d, new size: %d\n", len, new_len);
new_buf=(char*)pkg_malloc(new_len+1); /* +1 is for debugging
@@ -1592,9 +1591,9 @@ char * build_res_buf_from_sip_res( struct sip_msg* msg,
}
new_buf[new_len]=0; /* debug: print the message */
offset=s_offset=0;
- /*FIXME: no send sock*/
- process_lumps(msg, msg->add_rm, new_buf, &offset, &s_offset, 0);/*FIXME:*/
- process_lumps(msg, msg->body_lumps, new_buf, &offset, &s_offset, 0);
+
+ process_lumps(msg, msg->add_rm, new_buf, &offset, &s_offset, sock);
+ process_lumps(msg, msg->body_lumps, new_buf, &offset, &s_offset, sock);
/* copy the rest of the message */
memcpy(new_buf+offset,
buf+s_offset,
View
@@ -83,7 +83,7 @@ char * build_req_buf_from_sip_req ( struct sip_msg* msg,
int proto, unsigned int flags);
char * build_res_buf_from_sip_res( struct sip_msg* msg,
- unsigned int *returned_len);
+ unsigned int *returned_len, struct socket_info *sock);
char * build_res_buf_from_sip_req( unsigned int code,

0 comments on commit 19e9da1

Please sign in to comment.