Skip to content

Commit bbe60a5

Browse files
author
Christophe Jaillet
committed
When we are at flush_max_threshold and the next bucket is a metadata (i.e. next->length == 0), we still need to re-check for flush_max_threshold and associated optimisation (is_in_memory_bucket()) when we process this metadata bucket in the next iteration of the loop.
Follow-up to r1892450. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909966 13f79535-47bb-0310-9956-ffa450edef68
1 parent afad6e2 commit bbe60a5

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

server/core_filters.c

+30-30
Original file line numberDiff line numberDiff line change
@@ -584,41 +584,41 @@ static apr_status_t send_brigade_nonblocking(apr_socket_t *s,
584584
if (!nvec) {
585585
delete_meta_bucket(bucket);
586586
}
587-
continue;
588587
}
589-
590-
/* Make sure that these new data fit in our iovec. */
591-
if (nvec == ctx->nvec) {
592-
if (nvec == NVEC_MAX) {
593-
sock_nopush(s, 1);
594-
rv = writev_nonblocking(s, bb, ctx, nbytes, nvec, c);
595-
if (rv != APR_SUCCESS) {
596-
goto cleanup;
597-
}
598-
nbytes = 0;
599-
nvec = 0;
600-
}
601-
else {
602-
struct iovec *newvec;
603-
apr_size_t newn = nvec * 2;
604-
if (newn < NVEC_MIN) {
605-
newn = NVEC_MIN;
606-
}
607-
else if (newn > NVEC_MAX) {
608-
newn = NVEC_MAX;
588+
else {
589+
/* Make sure that these new data fit in our iovec. */
590+
if (nvec == ctx->nvec) {
591+
if (nvec == NVEC_MAX) {
592+
sock_nopush(s, 1);
593+
rv = writev_nonblocking(s, bb, ctx, nbytes, nvec, c);
594+
if (rv != APR_SUCCESS) {
595+
goto cleanup;
596+
}
597+
nbytes = 0;
598+
nvec = 0;
609599
}
610-
newvec = apr_palloc(c->pool, newn * sizeof(struct iovec));
611-
if (nvec) {
612-
memcpy(newvec, ctx->vec, nvec * sizeof(struct iovec));
600+
else {
601+
struct iovec *newvec;
602+
apr_size_t newn = nvec * 2;
603+
if (newn < NVEC_MIN) {
604+
newn = NVEC_MIN;
605+
}
606+
else if (newn > NVEC_MAX) {
607+
newn = NVEC_MAX;
608+
}
609+
newvec = apr_palloc(c->pool, newn * sizeof(struct iovec));
610+
if (nvec) {
611+
memcpy(newvec, ctx->vec, nvec * sizeof(struct iovec));
612+
}
613+
ctx->vec = newvec;
614+
ctx->nvec = newn;
613615
}
614-
ctx->vec = newvec;
615-
ctx->nvec = newn;
616616
}
617+
nbytes += length;
618+
ctx->vec[nvec].iov_base = (void *)data;
619+
ctx->vec[nvec].iov_len = length;
620+
nvec++;
617621
}
618-
nbytes += length;
619-
ctx->vec[nvec].iov_base = (void *)data;
620-
ctx->vec[nvec].iov_len = length;
621-
nvec++;
622622

623623
/* Flush above max threshold, unless the brigade still contains in
624624
* memory buckets which we want to try writing in the same pass (if

0 commit comments

Comments
 (0)