Browse code

core: allow forcing send socket for replies

- patch by Marcus Hunger, closes FS#142

Daniel-Constantin Mierla authored on 27/07/2011 17:34:35
Showing 1 changed files
... ...
@@ -124,6 +124,8 @@ static int sock_inet = -1;
124 124
 static int sock_inet6 = -1;
125 125
 #endif /* USE_IPV6 */
126 126
 
127
+static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg);
128
+
127 129
 struct socket_info* get_out_socket(union sockaddr_union* to, int proto)
128 130
 {
129 131
 	int* temp_sock;
... ...
@@ -829,6 +831,9 @@ int forward_reply(struct sip_msg* msg)
829 829
 				
830 830
 	} 
831 831
 #endif
832
+
833
+	apply_force_send_socket(&dst, msg);
834
+
832 835
 	if (msg_send(&dst, new_buf, new_len)<0)
833 836
 	{
834 837
 		STATS_RPL_FWD_DROP();
... ...
@@ -850,3 +855,10 @@ error:
850 850
 	if (new_buf) pkg_free(new_buf);
851 851
 	return -1;
852 852
 }
853
+
854
+static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg)
855
+{
856
+	if (msg->force_send_socket != 0) {
857
+		dst->send_sock = get_send_socket(msg, &dst->to, dst->proto);
858
+	}
859
+}