@@ -885,7 +885,7 @@ static inline void tcpconn_ref(struct tcp_connection* c)
885885
886886static struct tcp_connection * tcpconn_new (int sock , const union sockaddr_union * su ,
887887 const struct socket_info * si , const struct tcp_conn_profile * prof ,
888- int state , int flags )
888+ int state , int flags , int in_main_proc )
889889{
890890 struct tcp_connection * c ;
891891 union sockaddr_union local_su ;
@@ -952,8 +952,8 @@ static struct tcp_connection* tcpconn_new(int sock, const union sockaddr_union*
952952 goto error ;
953953 }
954954 }
955-
956- tcp_connections_no ++ ;
955+ if ( in_main_proc )
956+ tcp_connections_no ++ ;
957957 return c ;
958958
959959error :
@@ -980,7 +980,7 @@ struct tcp_connection* tcp_conn_create(int sock, const union sockaddr_union* su,
980980 tcp_con_get_profile (su , & si -> su , si -> proto , prof );
981981
982982 /* create the connection structure */
983- c = tcpconn_new (sock , su , si , prof , state , 0 );
983+ c = tcpconn_new (sock , su , si , prof , state , 0 , ! send2main );
984984 if (c == NULL ) {
985985 LM_ERR ("tcpconn_new failed\n" );
986986 return NULL ;
@@ -1123,7 +1123,7 @@ static inline int handle_new_connect(const struct socket_info* si)
11231123 }
11241124
11251125 /* add socket to list */
1126- tcpconn = tcpconn_new (new_sock , & su , si , & prof , S_CONN_OK , F_CONN_ACCEPTED );
1126+ tcpconn = tcpconn_new (new_sock , & su , si , & prof , S_CONN_OK , F_CONN_ACCEPTED , 1 );
11271127 if (tcpconn ){
11281128 tcpconn -> refcnt ++ ; /* safe, not yet available to the
11291129 outside world */
@@ -1502,6 +1502,7 @@ inline static int handle_worker(struct process_table* p, int fd_i)
15021502 tcpconn -> s = fd ;
15031503 /* add tcpconn to the list*/
15041504 tcpconn_add (tcpconn );
1505+ tcp_connections_no ++ ;
15051506 reactor_add_reader ( tcpconn -> s , F_TCPCONN , RCT_PRIO_NET , tcpconn );
15061507 tcpconn -> flags &=~F_CONN_REMOVED_READ ;
15071508 break ;
@@ -1515,6 +1516,7 @@ inline static int handle_worker(struct process_table* p, int fd_i)
15151516 tcpconn -> s = fd ;
15161517 /* add tcpconn to the list*/
15171518 tcpconn_add (tcpconn );
1519+ tcp_connections_no ++ ;
15181520 /* FIXME - now we have lifetime==default_lifetime - should we
15191521 * set a shorter one when waiting for a connect ??? */
15201522 /* only maintain the socket in the IO_WATCH_WRITE watcher
0 commit comments