Browse code

- fix: get_send_socket bug in some unlikely circumstances$ (a socket of a diff. proto is forced and find_si cannot fix it to$ a corresp. socket of the correct proto

Andrei Pelinescu-Onciul authored on 05/10/2007 08:27:13
Showing 1 changed files
... ...
@@ -165,19 +165,19 @@ struct socket_info* get_send_socket(struct sip_msg *msg,
165 165
 			msg->force_send_socket=find_si(&(msg->force_send_socket->address),
166 166
 											msg->force_send_socket->port_no,
167 167
 											proto);
168
-		}
169
-		if (msg->force_send_socket && (msg->force_send_socket->socket!=-1)) 
170
-			return msg->force_send_socket;
171
-		else{
172
-			if (msg->force_send_socket->socket==-1)
173
-				LOG(L_WARN, "WARNING: get_send_socket: not listening"
174
-						 " on the requested socket, no fork mode?\n");
175
-			else
168
+			if (msg->force_send_socket == 0){
176 169
 				LOG(L_WARN, "WARNING: get_send_socket: "
177 170
 						"protocol/port mismatch\n");
171
+				goto not_forced;
172
+			}
178 173
 		}
174
+		if (msg->force_send_socket->socket!=-1)
175
+				return msg->force_send_socket;
176
+		else
177
+			LOG(L_WARN, "WARNING: get_send_socket: not listening"
178
+						 " on the requested socket, no fork mode?\n");
179 179
 	};
180
-
180
+not_forced:
181 181
 	if (mhomed && proto==PROTO_UDP){
182 182
 		send_sock=get_out_socket(to, proto);
183 183
 		if ((send_sock==0) || (send_sock->socket!=-1))