X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=jbsockets.c;h=078344145d44c6eb38bb154a474791130538e897;hp=fef395abe0c050cbabc2ac15e41bd9806f35086b;hb=41cc7ed71679ba3b5c371c8b78da492faf210498;hpb=788cbf28fbb00d5feea27a03e1363272fd864182 diff --git a/jbsockets.c b/jbsockets.c index fef395ab..07834414 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -1,4 +1,4 @@ -const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.145 2017/06/08 13:04:56 fabiankeil Exp $"; +const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.147 2017/06/26 12:12:55 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $ @@ -116,8 +116,6 @@ const char jbsockets_h_rcs[] = JBSOCKETS_H_VERSION; */ #define MAX_DNS_RETRIES 10 -#define MAX_LISTEN_BACKLOG 128 - #ifdef HAVE_RFC2553 static jb_socket rfc2553_connect_to(const char *host, int portnum, struct client_state *csp); #else @@ -890,14 +888,15 @@ void drain_and_close_socket(jb_socket fd) * Parameters : * 1 : hostnam = TCP/IP address to bind/listen to * 2 : portnum = port to listen on - * 3 : pfd = pointer used to return file descriptor. + * 3 : backlog = Listen backlog + * 4 : pfd = pointer used to return file descriptor. * * Returns : if success, returns 0 and sets *pfd. * if failure, returns -3 if address is in use, * -2 if address unresolvable, * -1 otherwise *********************************************************************/ -int bind_port(const char *hostnam, int portnum, jb_socket *pfd) +int bind_port(const char *hostnam, int portnum, int backlog, jb_socket *pfd) { #ifdef HAVE_RFC2553 struct addrinfo hints; @@ -1072,7 +1071,7 @@ int bind_port(const char *hostnam, int portnum, jb_socket *pfd) } #endif /* ndef HAVE_RFC2553 */ - while (listen(fd, MAX_LISTEN_BACKLOG) == -1) + while (listen(fd, backlog) == -1) { if (errno != EINTR) { @@ -1377,20 +1376,6 @@ int accept_connection(struct client_state * csp, jb_socket fds[]) #else do { -#if defined(FEATURE_ACCEPT_FILTER) && defined(SO_ACCEPTFILTER) - if (csp->config->enable_accept_filter) - { - struct accept_filter_arg af_options; - bzero(&af_options, sizeof(af_options)); - strlcpy(af_options.af_name, "httpready", sizeof(af_options.af_name)); - if (setsockopt(fd, SOL_SOCKET, SO_ACCEPTFILTER, &af_options, - sizeof(af_options))) - { - log_error(LOG_LEVEL_ERROR, - "Enabling accept filter for socket %d failed: %E", fd); - } - } -#endif afd = accept (fd, (struct sockaddr *) &client, &c_length); } while (afd < 0 && errno == EINTR); if (afd < 0)