* include/ap_listen.h:
- Add prototype for include/ap_listen.heraccept
- Wire in new directive ListenTCPDeferAccept
* include/mpm_common.h:
Define the previous static value as default value via DEFAULT_TCP_DEFER_ACCEPT
* server/listen.c:
- Add static int ap_listentcpdeferaccept
- ap_apply_accept_filter: Use value of ap_listenbacklog for setting TCP_DEFER_ACCEPT
- ap_listen_pre_config: Set default value
- Add ap_set_listentcpdeferaccept
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@
1927885 13f79535-47bb-0310-9956-
ffa450edef68
* called.
*/
AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg);
+AP_DECLARE_NONSTD(const char *) ap_set_listentcpdeferaccept(cmd_parms *cmd, void *dummy, const char *arg);
AP_DECLARE_NONSTD(const char *) ap_set_listencbratio(cmd_parms *cmd, void *dummy, const char *arg);
AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
int argc, char *const argv[]);
AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
RSRC_CONF, "Receive buffer size in bytes"), \
AP_INIT_FLAG("AcceptErrorsNonFatal", ap_set_accept_errors_nonfatal, NULL, \
- RSRC_CONF, "Some accept() errors are not fatal to the process")
+ RSRC_CONF, "Some accept() errors are not fatal to the process"), \
+AP_INIT_TAKE1("ListenTCPDeferAccept", ap_set_listentcpdeferaccept, NULL, RSRC_CONF, \
+ "Value set for the socket option TCP_DEFER_ACCEPT if it is set")
#ifdef __cplusplus
}
#endif
#define DEFAULT_LISTENBACKLOG 511
#endif
+/*
+ * Define the default value set for the socket option TCP_DEFER_ACCEPT
+ * if it is set.
+ */
+#ifndef DEFAULT_TCP_DEFER_ACCEPT
+#define DEFAULT_TCP_DEFER_ACCEPT 30
+#endif
+
/* Signal used to gracefully restart */
#define AP_SIG_GRACEFUL SIGUSR1
static ap_listen_rec *old_listeners;
static int ap_listenbacklog;
+static int ap_listentcpdeferaccept;
static int ap_listencbratio;
static int send_buffer_size;
static int receive_buffer_size;
accf);
}
#else
- rv = apr_socket_opt_set(s, APR_TCP_DEFER_ACCEPT, 30);
+ rv = apr_socket_opt_set(s, APR_TCP_DEFER_ACCEPT, ap_listenbacklog);
if (rv != APR_SUCCESS && !APR_STATUS_IS_ENOTIMPL(rv)) {
ap_log_perror(APLOG_MARK, APLOG_WARNING, rv, p, APLOGNO(00076)
"Failed to enable APR_TCP_DEFER_ACCEPT");
ap_listen_buckets = NULL;
ap_num_listen_buckets = 0;
ap_listenbacklog = DEFAULT_LISTENBACKLOG;
+ ap_listentcpdeferaccept = DEFAULT_TCP_DEFER_ACCEPT;
ap_listencbratio = 0;
/* Check once whether or not SO_REUSEPORT is supported. */
return NULL;
}
+AP_DECLARE_NONSTD(const char *) ap_set_listentcpdeferaccept(cmd_parms *cmd,
+ void *dummy,
+ const char *arg)
+{
+ int b;
+ const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+
+ if (err != NULL) {
+ return err;
+ }
+
+ b = atoi(arg);
+ if (b < 1) {
+ return "ListenTCPDeferAccept must be > 0";
+ }
+
+ ap_listentcpdeferaccept = b;
+ return NULL;
+}
+
AP_DECLARE_NONSTD(const char *) ap_set_listencbratio(cmd_parms *cmd,
void *dummy,
const char *arg)