current jbsockets.c, 1.146, 1.147 jcc.c, 1.462, 1.463

Fabian Keil via ijbswa-commits <[email protected]> Mon, 26 Jun 2017 12:12:57 +0000
Newsgroups gmane.comp.web.privoxy.cvs
Message-ID <[email protected]>
Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv21749

Modified Files:
	jbsockets.c jcc.c 
Log Message:
Enable accept filter only once

Previously Privoxy would (attempt to) enable it before
each accept call which isn't necessary.

Sponsored by: Robert Klemme


Index: jcc.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jcc.c,v
retrieving revision 1.462
retrieving revision 1.463
diff -C2 -d -r1.462 -r1.463
*** jcc.c	26 Jun 2017 12:10:31 -0000	1.462
--- jcc.c	26 Jun 2017 12:12:55 -0000	1.463
***************
*** 4211,4214 ****
--- 4211,4228 ----
        {
           sockets[i] = bind_port_helper(config->haddr[i], config->hport[i]);
+ #if defined(FEATURE_ACCEPT_FILTER) && defined(SO_ACCEPTFILTER)
+          if (config->enable_accept_filter && sockets[i] != JB_INVALID_SOCKET)
+          {
+             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(sockets[i], SOL_SOCKET, SO_ACCEPTFILTER, &af_options,
+                   sizeof(af_options)))
+             {
+                log_error(LOG_LEVEL_ERROR,
+                   "Enabling accept filter for socket %d failed: %E", sockets[i]);
+             }
+          }
+ #endif
        }
        else

Index: jbsockets.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jbsockets.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -C2 -d -r1.146 -r1.147
*** jbsockets.c	26 Jun 2017 12:11:12 -0000	1.146
--- jbsockets.c	26 Jun 2017 12:12:55 -0000	1.147
***************
*** 1378,1395 ****
     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);
--- 1378,1381 ----


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot