From bc24889c8384244ada89891691518108cdb663c0 Mon Sep 17 00:00:00 2001 From: Henning Westerholt Date: Thu, 9 Jan 2020 17:54:18 +0100 Subject: [PATCH] core: remove one function for blocking TCP write, deactivated since 2004 - remove one function for blocking TCP write, deactivated since 2004 in TCP core - code is not compiling anymore if activated --- src/core/tcp_main.c | 70 --------------------------------------------- 1 file changed, 70 deletions(-) diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c index 9687cbd4b81..a9fdf8445ad 100644 --- a/src/core/tcp_main.c +++ b/src/core/tcp_main.c @@ -892,75 +892,6 @@ inline static int wbufq_run(int fd, struct tcp_connection* c, int* empty) -#if 0 -/* blocking write even on non-blocking sockets - * if TCP_TIMEOUT will return with error */ -static int tcp_blocking_write(struct tcp_connection* c, int fd, char* buf, - unsigned int len) -{ - int n; - fd_set sel_set; - struct timeval timeout; - int ticks; - int initial_len; - - initial_len=len; -again: - - n=send(fd, buf, len, -#ifdef HAVE_MSG_NOSIGNAL - MSG_NOSIGNAL -#else - 0 -#endif - ); - if (n<0){ - if (errno==EINTR) goto again; - else if (errno!=EAGAIN && errno!=EWOULDBLOCK){ - LM_ERR("failed to send: (%d) %s\n", errno, strerror(errno)); - TCP_EV_SEND_TIMEOUT(errno, &c->rcv); - TCP_STATS_SEND_TIMEOUT(); - goto error; - } - }else if (n=tcp_send_timeout){ - LM_ERR("send timeout (%d)\n", tcp_send_timeout); - goto error; - } - continue; - } - if (FD_ISSET(fd, &sel_set)){ - /* we can write again */ - goto again; - } - } -error: - return -1; -end: - return initial_len; -} -#endif - /* Attempt to extract real connection information from an upstream load * balancer or reverse proxy. This should be called right after accept()ing the * connection, and before TLS negotiation. @@ -2794,7 +2725,6 @@ static int tcpconn_do_send(int fd, struct tcp_connection* c, n=_tcpconn_write_nb(fd, c, buf, len); }else{ #endif /* TCP_ASYNC */ - /* n=tcp_blocking_write(c, fd, buf, len); */ n=tsend_stream(fd, buf, len, TICKS_TO_S(cfg_get(tcp, tcp_cfg, send_timeout)) * 1000);