[prev in list] [next in list] [prev in thread] [next in thread] 

List:       privoxy-commits
Subject:    [privoxy-commits] current jbsockets.c, 1.147, 1.148 jbsockets.h, 1.25, 1.26 jcc.c, 1.463, 1.464 load
From:       Fabian Keil via ijbswa-commits <ijbswa-commits () lists ! sourceforge ! net>
Date:       2017-06-26 12:13:54
Message-ID: E1dPStw-0003mt-DM () sfs-ml-2 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv21798

Modified Files:
	jbsockets.c jbsockets.h jcc.c loadcfg.c project.h 
Log Message:
Add a listen-backlog directive

Which specifies the backlog value passed to listen().

Sponsored by: Robert Klemme


Index: project.h
===================================================================
RCS file: /cvsroot/ijbswa/current/project.h,v
retrieving revision 1.222
retrieving revision 1.223
diff -C2 -d -r1.222 -r1.223
*** project.h	26 Jun 2017 12:11:13 -0000	1.222
--- project.h	26 Jun 2017 12:13:52 -0000	1.223
***************
*** 1355,1358 ****
--- 1355,1361 ----
     int enable_accept_filter;
  
+    /** Backlog passed to listen() */
+    int listen_backlog;
+ 
  #ifdef FEATURE_TRUST
  

Index: jcc.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jcc.c,v
retrieving revision 1.463
retrieving revision 1.464
diff -C2 -d -r1.463 -r1.464
*** jcc.c	26 Jun 2017 12:12:55 -0000	1.463
--- jcc.c	26 Jun 2017 12:13:52 -0000	1.464
***************
*** 163,167 ****
  #endif
  static void initialize_mutexes(void);
! static jb_socket bind_port_helper(const char *haddr, int hport);
  static void bind_ports_helper(struct configuration_spec *config, jb_socket sockets[]);
  static void close_ports_helper(jb_socket sockets[]);
--- 163,167 ----
  #endif
  static void initialize_mutexes(void);
! static jb_socket bind_port_helper(const char *haddr, int hport, int backlog);
  static void bind_ports_helper(struct configuration_spec *config, jb_socket sockets[]);
  static void close_ports_helper(jb_socket sockets[]);
***************
*** 4121,4134 ****
   *                        INADDR_ANY.
   *          2  :  hport = Specifies port to bind to.
   *
   * Returns     :  Port that was opened.
   *
   *********************************************************************/
! static jb_socket bind_port_helper(const char *haddr, int hport)
  {
     int result;
     jb_socket bfd;
  
!    result = bind_port(haddr, hport, &bfd);
  
     if (result < 0)
--- 4121,4135 ----
   *                        INADDR_ANY.
   *          2  :  hport = Specifies port to bind to.
+  *          3  :  backlog = Listen backlog.
   *
   * Returns     :  Port that was opened.
   *
   *********************************************************************/
! static jb_socket bind_port_helper(const char *haddr, int hport, int backlog)
  {
     int result;
     jb_socket bfd;
  
!    result = bind_port(haddr, hport, backlog, &bfd);
  
     if (result < 0)
***************
*** 4210,4214 ****
        if (config->hport[i])
        {
!          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)
--- 4211,4216 ----
        if (config->hport[i])
        {
!          sockets[i] = bind_port_helper(config->haddr[i],
!             config->hport[i], config->listen_backlog);
  #if defined(FEATURE_ACCEPT_FILTER) && defined(SO_ACCEPTFILTER)
           if (config->enable_accept_filter && sockets[i] != JB_INVALID_SOCKET)

Index: jbsockets.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jbsockets.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -C2 -d -r1.147 -r1.148
*** jbsockets.c	26 Jun 2017 12:12:55 -0000	1.147
--- jbsockets.c	26 Jun 2017 12:13:52 -0000	1.148
***************
*** 117,122 ****
  #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);
--- 117,120 ----
***************
*** 891,895 ****
   *          1  :  hostnam = TCP/IP address to bind/listen to
   *          2  :  portnum = port to listen on
!  *          3  :  pfd = pointer used to return file descriptor.
   *
   * Returns     :  if success, returns 0 and sets *pfd.
--- 889,894 ----
   *          1  :  hostnam = TCP/IP address to bind/listen to
   *          2  :  portnum = port to listen on
!  *          3  :  backlog = Listen backlog
!  *          4  :  pfd = pointer used to return file descriptor.
   *
   * Returns     :  if success, returns 0 and sets *pfd.
***************
*** 898,902 ****
   *                                    -1 otherwise
   *********************************************************************/
! int bind_port(const char *hostnam, int portnum, jb_socket *pfd)
  {
  #ifdef HAVE_RFC2553
--- 897,901 ----
   *                                    -1 otherwise
   *********************************************************************/
! int bind_port(const char *hostnam, int portnum, int backlog, jb_socket *pfd)
  {
  #ifdef HAVE_RFC2553
***************
*** 1073,1077 ****
  #endif /* ndef HAVE_RFC2553 */
  
!    while (listen(fd, MAX_LISTEN_BACKLOG) == -1)
     {
        if (errno != EINTR)
--- 1072,1076 ----
  #endif /* ndef HAVE_RFC2553 */
  
!    while (listen(fd, backlog) == -1)
     {
        if (errno != EINTR)

Index: loadcfg.c
===================================================================
RCS file: /cvsroot/ijbswa/current/loadcfg.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -C2 -d -r1.164 -r1.165
*** loadcfg.c	26 Jun 2017 12:11:13 -0000	1.164
--- loadcfg.c	26 Jun 2017 12:13:52 -0000	1.165
***************
*** 97,100 ****
--- 97,105 ----
  #define DEFAULT_KEEP_ALIVE_TIMEOUT 180
  
+ /*
+  * Default backlog passed to listen().
+  */
+ #define DEFAULT_LISTEN_BACKLOG 128
+ 
  const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
  
***************
*** 161,164 ****
--- 166,170 ----
  #define hash_keep_alive_timeout          3878599515U /* "keep-alive-timeout" */
  #define hash_listen_address              1255650842U /* "listen-address" */
+ #define hash_listen_backlog              1255655735U /* "listen-backlog" */
  #define hash_logdir                          422889U /* "logdir" */
  #define hash_logfile                        2114766U /* "logfile" */
***************
*** 617,620 ****
--- 623,627 ----
     config->enable_accept_filter      = 0;
  #endif
+    config->listen_backlog            = DEFAULT_LISTEN_BACKLOG;
     config->trusted_cgi_referrer      = NULL;
     /*
***************
*** 1368,1371 ****
--- 1375,1390 ----
  
  /* *************************************************************************
+  * listen-backlog n
+  * *************************************************************************/
+          case hash_listen_backlog :
+             /*
+              * We don't enfore an upper or lower limit because on
+              * many platforms all values are valid and negative
+              * number mean "use the highest value allowed".
+              */
+             config->listen_backlog = parse_numeric_value(cmd, arg);
+             break;
+ 
+ /* *************************************************************************
   * logdir directory-name
   * *************************************************************************/

Index: jbsockets.h
===================================================================
RCS file: /cvsroot/ijbswa/current/jbsockets.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** jbsockets.h	4 Jun 2017 14:37:05 -0000	1.25
--- jbsockets.h	26 Jun 2017 12:13:52 -0000	1.26
***************
*** 54,58 ****
  extern void drain_and_close_socket(jb_socket fd);
  
! extern int bind_port(const char *hostnam, int portnum, jb_socket *pfd);
  extern int accept_connection(struct client_state * csp, jb_socket fds[]);
  extern void get_host_information(jb_socket afd, char **ip_address, char **port, char **hostname);
--- 54,58 ----
  extern void drain_and_close_socket(jb_socket fd);
  
! extern int bind_port(const char *hostnam, int portnum, int backlog, jb_socket *pfd);
  extern int accept_connection(struct client_state * csp, jb_socket fds[]);
  extern void get_host_information(jb_socket afd, char **ip_address, char **port, char **hostname);


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
ijbswa-commits mailing list
ijbswa-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ijbswa-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic