mirror of
https://github.com/apache/httpd.git
synced 2026-01-06 09:01:14 +03:00
* server/core_filters.c (send_brigade_nonblocking): Use a non-blocking
bucket read, allowing any pending data to be flushed before trying a (potentially slow) blocking read. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1234899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -656,10 +656,26 @@ static apr_status_t send_brigade_nonblocking(apr_socket_t *s,
|
||||
if (!APR_BUCKET_IS_METADATA(bucket)) {
|
||||
const char *data;
|
||||
apr_size_t length;
|
||||
rv = apr_bucket_read(bucket, &data, &length, APR_BLOCK_READ);
|
||||
|
||||
/* Non-blocking read first, in case this is a morphing
|
||||
* bucket type. */
|
||||
rv = apr_bucket_read(bucket, &data, &length, APR_NONBLOCK_READ);
|
||||
if (APR_STATUS_IS_EAGAIN(rv)) {
|
||||
/* Read would block; flush any pending data and retry. */
|
||||
if (nvec) {
|
||||
rv = writev_nonblocking(s, vec, nvec, bb, bytes_written, c);
|
||||
if (rv) {
|
||||
return rv;
|
||||
}
|
||||
nvec = 0;
|
||||
}
|
||||
|
||||
rv = apr_bucket_read(bucket, &data, &length, APR_BLOCK_READ);
|
||||
}
|
||||
if (rv != APR_SUCCESS) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* reading may have split the bucket, so recompute next: */
|
||||
next = APR_BUCKET_NEXT(bucket);
|
||||
vec[nvec].iov_base = (char *)data;
|
||||
|
||||
Reference in New Issue
Block a user