AP_DECLARE(void) mpm_recycle_completion_context(PCOMP_CONTEXT context)
{
/* Recycle the completion context.
- * - destroy the ptrans pool
+ * - clear the ptrans pool
* - put the context on the queue to be consumed by the accept thread
* Note:
* context->accept_socket may be in a disconnected but reusable
*/
if (context) {
apr_pool_clear(context->ptrans);
- apr_pool_destroy(context->ptrans);
context->ptrans = NULL;
context->next = NULL;
apr_thread_mutex_lock(qlock);
AP_DECLARE(PCOMP_CONTEXT) mpm_get_completion_context(void)
{
+ apr_status_t rv;
PCOMP_CONTEXT context = NULL;
/* Grab a context off the queue */
}
return NULL;
}
+ /* Note:
+ * Multiple failures in the next two steps will cause the pchild pool
+ * to 'leak' storage. I don't think this is worth fixing...
+ */
context = (PCOMP_CONTEXT) apr_pcalloc(pchild, sizeof(COMP_CONTEXT));
context->Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
"mpm_get_completion_context: CreateEvent failed.");
return NULL;
}
+
+ /* Create the tranaction pool */
+ if ((rv = apr_pool_create(&context->ptrans, pchild)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK,APLOG_WARNING, rv, ap_server_conf,
+ "mpm_get_completion_context: Failed to create the transaction pool.");
+ CloseHandle(context->Overlapped.hEvent);
+ return NULL;
+ }
+ apr_pool_tag(context->ptrans, "ptrans");
+
context->accept_socket = INVALID_SOCKET;
context->ba = apr_bucket_alloc_create(pchild);
num_completion_contexts++;
}
+
return context;
}
static PCOMP_CONTEXT win9x_get_connection(PCOMP_CONTEXT context)
{
+ apr_os_sock_info_t sockinfo;
int len;
if (context == NULL) {
context->ba = apr_bucket_alloc_create(pchild);
}
-
while (1) {
apr_pool_clear(context->ptrans);
context->accept_socket = remove_job();
"getpeername failed");
memset(&context->sa_client, '\0', sizeof(context->sa_client));
}
+ sockinfo.os_sock = &context->accept_socket;
+ sockinfo.local = context->sa_server;
+ sockinfo.remote = context->sa_client;
+ sockinfo.family = APR_INET;
+ sockinfo.type = SOCK_STREAM;
+ apr_os_sock_make(&context->sock, &sockinfo, context->ptrans);
- /* do we NEED_DUPPED_CSD ?? */
-
return context;
}
}
*/
static void winnt_accept(void *listen_socket)
{
-
+ apr_os_sock_info_t sockinfo;
PCOMP_CONTEXT context;
DWORD BytesRead;
SOCKET nlsd;
&context->sa_client,
&context->sa_client_len);
+ sockinfo.os_sock = &context->accept_socket;
+ sockinfo.local = context->sa_server;
+ sockinfo.remote = context->sa_client;
+ sockinfo.family = APR_INET;
+ sockinfo.type = SOCK_STREAM;
+ apr_os_sock_make(&context->sock, &sockinfo, context->ptrans);
+
/* When a connection is received, send an io completion notification to
* the ThreadDispatchIOCP. This function could be replaced by
* mpm_post_completion_context(), but why do an extra function call...
g_blocked_threads--;
- if ((rc = apr_pool_create(&context->ptrans, pconf)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK,APLOG_DEBUG, rc, ap_server_conf,
- "Child %d: apr_pool_create failed with rc %d", my_pid, rc);
- } else {
- apr_pool_tag(context->ptrans, "ptrans");
- }
-
return context;
}
{
static int requests_this_child = 0;
PCOMP_CONTEXT context = NULL;
- apr_os_sock_info_t sockinfo;
ap_sb_handle_t *sbh;
while (1) {
}
}
- sockinfo.os_sock = &context->accept_socket;
- sockinfo.local = context->sa_server;
- sockinfo.remote = context->sa_client;
- sockinfo.family = APR_INET;
- sockinfo.type = SOCK_STREAM;
- /* ### is this correct? Shouldn't be inheritable (at this point) */
- apr_os_sock_make(&context->sock, &sockinfo, context->ptrans);
-
ap_create_sb_handle(&sbh, context->ptrans, 0, thread_num);
c = ap_run_create_connection(context->ptrans, ap_server_conf,
context->sock, thread_num, sbh,