Changes with Apache 2.0.37
+ *) Close sockets on worker MPM when doing a graceless restart.
+ [Aaron Bannert]
+
*) Reverted a minor optimization in mod_ssl.c that used the vhost ID
as the session id context rather that a MD5 hash of that vhost ID,
because it caused very long vhost id's to be unusable with mod_ssl.
*/
#define LISTENER_SIGNAL SIGHUP
+/* An array of socket descriptors in use by each thread used to
+ * perform a non-graceful (forced) shutdown of the server. */
+static apr_socket_t **worker_sockets;
+
+static void close_worker_sockets(void)
+{
+ int i;
+ for (i = 0; i < ap_threads_per_child; i++) {
+ if (worker_sockets[i]) {
+ apr_socket_close(worker_sockets[i]);
+ worker_sockets[i] = NULL;
+ }
+ }
+}
+
static void wakeup_listener(void)
{
listener_may_exit = 1;
workers_may_exit = 1;
ap_queue_interrupt_all(worker_queue);
ap_queue_info_term(worker_queue_info);
+ close_worker_sockets(); /* forcefully kill all current connections */
}
}
}
continue;
}
+ worker_sockets[thread_slot] = csd;
process_socket(ptrans, csd, process_slot, thread_slot, bucket_alloc);
+ worker_sockets[thread_slot] = NULL;
requests_this_child--; /* FIXME: should be synchronized - aaron */
apr_pool_clear(ptrans);
last_ptrans = ptrans;
clean_child_exit(APEXIT_CHILDFATAL);
}
+ worker_sockets = apr_pcalloc(pchild, ap_threads_per_child
+ * sizeof(apr_socket_t *));
+
loops = prev_threads_created = 0;
while (1) {
/* ap_threads_per_child does not include the listener thread */