Module: sip-router
Branch: master
Commit: bc71de00c3e8cddf76044180315f5ce8c93495f4
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bc71de0…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Tue Jul 21 01:10:05 2009 +0200
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).
---
forward.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/forward.c b/forward.c
index b9e8ead..3080b1d 100644
--- a/forward.c
+++ b/forward.c
@@ -195,7 +195,12 @@ struct socket_info* get_send_socket2(struct socket_info*
force_send_socket,
if (likely(mismatch)) *mismatch=SS_MISMATCH_AF;
goto not_forced;
}
- if (likely((force_send_socket->socket!=-1) &&
+ /* check if listening on the socket (the check does not work
+ for TCP and TLS, for them socket==-1 on all the processes
+ except tcp_main(), see close_extra_socks() */
+ if (likely((force_send_socket->socket!=-1 ||
+ force_send_socket->proto==PROTO_TCP ||
+ force_send_socket->proto==PROTO_TLS) &&
!(force_send_socket->flags & SI_IS_MCAST)))
return force_send_socket;
else{