浏览代码

core: allow forcing send socket for replies

- patch by Marcus Hunger, closes FS#142
Daniel-Constantin Mierla 14 年之前
父节点
当前提交
bf48d46366
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      forward.c

+ 12 - 0
forward.c

@@ -124,6 +124,8 @@ static int sock_inet = -1;
 static int sock_inet6 = -1;
 #endif /* USE_IPV6 */
 
+static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg);
+
 struct socket_info* get_out_socket(union sockaddr_union* to, int proto)
 {
 	int* temp_sock;
@@ -829,6 +831,9 @@ int forward_reply(struct sip_msg* msg)
 				
 	} 
 #endif
+
+	apply_force_send_socket(&dst, msg);
+
 	if (msg_send(&dst, new_buf, new_len)<0)
 	{
 		STATS_RPL_FWD_DROP();
@@ -850,3 +855,10 @@ error:
 	if (new_buf) pkg_free(new_buf);
 	return -1;
 }
+
+static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg)
+{
+	if (msg->force_send_socket != 0) {
+		dst->send_sock = get_send_socket(msg, &dst->to, dst->proto);
+	}
+}