in modules/fcgid/fcgid_proc_win.c [329:374]
apr_status_t proc_read_ipc(fcgid_ipc * ipc_handle, const char *buffer,
apr_size_t * size)
{
apr_status_t rv;
fcgid_namedpipe_handle *handle_info;
DWORD bytesread;
handle_info = (fcgid_namedpipe_handle *) ipc_handle->ipc_handle_info;
if (ReadFile(handle_info->handle_pipe, (LPVOID) buffer,
*size, &bytesread, &handle_info->overlap_read)) {
*size = bytesread;
return APR_SUCCESS;
} else if ((rv = GetLastError()) != ERROR_IO_PENDING) {
ap_log_rerror(APLOG_MARK, APLOG_WARNING, APR_FROM_OS_ERROR(rv),
ipc_handle->request,
"mod_fcgid: can't read from pipe");
return rv;
} else {
/* it's ERROR_IO_PENDING */
DWORD transferred;
DWORD dwWaitResult
= WaitForSingleObject(handle_info->overlap_read.hEvent,
ipc_handle->communation_timeout * 1000);
if (dwWaitResult == WAIT_OBJECT_0) {
if (!GetOverlappedResult(handle_info->handle_pipe,
&handle_info->overlap_read,
&transferred, FALSE /* don't wait */ )
|| transferred == 0) {
rv = apr_get_os_error();
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv,
ipc_handle->request,
"mod_fcgid: get overlap result error");
return rv;
}
*size = transferred;
return APR_SUCCESS;
} else {
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, ipc_handle->request,
"mod_fcgid: read timeout from pipe");
return APR_ETIMEDOUT;
}
}
}