Browse code

core: get_send_socket fix for tcp or tls forced socket

One of the get_send_socket() sanity tests, checks if ser really
listens on the forced socket. For tcp and tls this test should not
be performed (the sockets are closed for the processes that do not
need them => cannot test by looking at the fd).

Andrei Pelinescu-Onciul authored on 20/07/2009 23:10:05
Showing 1 changed files
... ...
@@ -195,7 +195,12 @@ struct socket_info* get_send_socket2(struct socket_info* force_send_socket,
195 195
 			if (likely(mismatch)) *mismatch=SS_MISMATCH_AF;
196 196
 			goto not_forced;
197 197
 		}
198
-		if (likely((force_send_socket->socket!=-1) &&
198
+		/* check if listening on the socket (the check does not work
199
+		   for TCP and TLS, for them socket==-1 on all the processes
200
+		   except tcp_main(), see close_extra_socks() */
201
+		if (likely((force_send_socket->socket!=-1 ||
202
+						force_send_socket->proto==PROTO_TCP ||
203
+						force_send_socket->proto==PROTO_TLS) &&
199 204
 					!(force_send_socket->flags & SI_IS_MCAST)))
200 205
 				return force_send_socket;
201 206
 		else{