@@ -112,8 +112,8 @@ static int *tcp_main_proc_no = 0;
112112/* array of TCP partitions */
113113static struct tcp_partition tcp_parts [TCP_PARTITION_SIZE ];
114114
115- /*!< tcp protocol number as returned by getprotobyname */
116- static int tcp_proto_no = -1 ;
115+ /* communication socket from generic proc to TCP main */
116+ int unix_tcp_sock = -1 ;
117117
118118/*!< current number of open connections */
119119static unsigned int * tcp_connections_no = 0 ;
@@ -246,8 +246,7 @@ int tcp_init_sock_opt(int s, const struct tcp_conn_profile *prof, enum si_flags
246246
247247#ifdef DISABLE_NAGLE
248248 flags = 1 ;
249- if ( (tcp_proto_no != -1 ) && (setsockopt (s , tcp_proto_no , TCP_NODELAY ,
250- & flags , sizeof (flags ))< 0 ) ){
249+ if (setsockopt (s , IPPROTO_TCP , TCP_NODELAY , & flags , sizeof (flags )) < 0 ){
251250 LM_WARN ("could not disable Nagle: %s\n" , strerror (errno ));
252251 }
253252#endif
@@ -418,10 +417,12 @@ int tcp_write_in_main(void)
418417int tcp_init_listener (struct socket_info * si )
419418{
420419 union sockaddr_union * addr = & si -> su ;
420+
421421 if (init_su (addr , & si -> address , si -> port_no )< 0 ){
422422 LM_ERR ("could no init sockaddr_union\n" );
423423 return -1 ;
424424 }
425+
425426 return 0 ;
426427}
427428
@@ -432,17 +433,6 @@ int tcp_bind_listener(struct socket_info *si)
432433 int optval ;
433434#ifdef DISABLE_NAGLE
434435 int flag ;
435- struct protoent * pe ;
436-
437- if (tcp_proto_no == -1 ){ /* if not already set */
438- pe = getprotobyname ("tcp" );
439- if (pe == 0 ){
440- LM_ERR ("could not get TCP protocol number\n" );
441- tcp_proto_no = -1 ;
442- }else {
443- tcp_proto_no = pe -> p_proto ;
444- }
445- }
446436#endif
447437
448438 addr = & si -> su ;
@@ -453,9 +443,7 @@ int tcp_bind_listener(struct socket_info *si)
453443 }
454444#ifdef DISABLE_NAGLE
455445 flag = 1 ;
456- if ( (tcp_proto_no != -1 ) &&
457- (setsockopt (si -> socket , tcp_proto_no , TCP_NODELAY ,
458- & flag , sizeof (flag ))< 0 ) ){
446+ if (setsockopt (si -> socket , IPPROTO_TCP , TCP_NODELAY , & flag , sizeof (flag )) < 0 ){
459447 LM_ERR ("could not disable Nagle: %s\n" ,strerror (errno ));
460448 }
461449#endif
0 commit comments