mirror of
https://github.com/vdukhovni/postfix
synced 2025-08-28 04:37:56 +00:00
postfix-2.10-20120715
This commit is contained in:
parent
38d3295b38
commit
7f53bacbb8
@ -17894,3 +17894,10 @@ Apologies for any names omitted.
|
|||||||
Bugfix (introduced: 20120527-8): infrastructure to specify
|
Bugfix (introduced: 20120527-8): infrastructure to specify
|
||||||
a smaller-than-default VSTREAM buffer, without the complex
|
a smaller-than-default VSTREAM buffer, without the complex
|
||||||
run-time checks. File: util/vstream.c, vstream_tweak.c.
|
run-time checks. File: util/vstream.c, vstream_tweak.c.
|
||||||
|
|
||||||
|
20120714
|
||||||
|
|
||||||
|
Cleanup: semantics of requests to query or modify the VSTREAM
|
||||||
|
buffer size that will be used with the next read(2) or
|
||||||
|
write(2) operation. Files: util/vstream.c, util/vstream.h,
|
||||||
|
util/vstream_tweak.c.
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* Patches change both the patchlevel and the release date. Snapshots have no
|
* Patches change both the patchlevel and the release date. Snapshots have no
|
||||||
* patchlevel; they change the release date only.
|
* patchlevel; they change the release date only.
|
||||||
*/
|
*/
|
||||||
#define MAIL_RELEASE_DATE "20120713"
|
#define MAIL_RELEASE_DATE "20120715"
|
||||||
#define MAIL_VERSION_NUMBER "2.10"
|
#define MAIL_VERSION_NUMBER "2.10"
|
||||||
|
|
||||||
#ifdef SNAPSHOT
|
#ifdef SNAPSHOT
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/* VSTREAM *vstream_printf(format, ...)
|
/* VSTREAM *vstream_printf(format, ...)
|
||||||
/* const char *format;
|
/* const char *format;
|
||||||
/*
|
/*
|
||||||
/* VSTREAM *vstream_fprintf(stream, format, ...)
|
/* VSTREAM *vstream_fprintf(stream, format, ...)
|
||||||
/* VSTREAM *stream;
|
/* VSTREAM *stream;
|
||||||
/* const char *format;
|
/* const char *format;
|
||||||
/*
|
/*
|
||||||
@ -40,7 +40,7 @@
|
|||||||
/* int ch;
|
/* int ch;
|
||||||
/*
|
/*
|
||||||
/* int vstream_ungetc(stream, ch)
|
/* int vstream_ungetc(stream, ch)
|
||||||
/* VSTREAM *stream;
|
/* VSTREAM *stream;
|
||||||
/* int ch;
|
/* int ch;
|
||||||
/*
|
/*
|
||||||
/* int vstream_fputs(str, stream)
|
/* int vstream_fputs(str, stream)
|
||||||
@ -60,7 +60,7 @@
|
|||||||
/*
|
/*
|
||||||
/* int vstream_fpurge(stream, direction)
|
/* int vstream_fpurge(stream, direction)
|
||||||
/* VSTREAM *stream;
|
/* VSTREAM *stream;
|
||||||
/* int direction;
|
/* int direction;
|
||||||
/*
|
/*
|
||||||
/* ssize_t vstream_fread(stream, buf, len)
|
/* ssize_t vstream_fread(stream, buf, len)
|
||||||
/* VSTREAM *stream;
|
/* VSTREAM *stream;
|
||||||
@ -80,10 +80,10 @@
|
|||||||
/* VSTREAM *stream;
|
/* VSTREAM *stream;
|
||||||
/*
|
/*
|
||||||
/* const ssize_t vstream_req_bufsize(stream)
|
/* const ssize_t vstream_req_bufsize(stream)
|
||||||
/* VSTREAM *stream;
|
/* VSTREAM *stream;
|
||||||
/*
|
/*
|
||||||
/* void *vstream_context(stream)
|
/* void *vstream_context(stream)
|
||||||
/* VSTREAM *stream;
|
/* VSTREAM *stream;
|
||||||
/*
|
/*
|
||||||
/* int vstream_ferror(stream)
|
/* int vstream_ferror(stream)
|
||||||
/* VSTREAM *stream;
|
/* VSTREAM *stream;
|
||||||
@ -324,18 +324,15 @@
|
|||||||
/* This involves allocation of additional memory that normally isn't
|
/* This involves allocation of additional memory that normally isn't
|
||||||
/* used.
|
/* used.
|
||||||
/* .IP "VSTREAM_CTL_BUFSIZE (ssize_t)"
|
/* .IP "VSTREAM_CTL_BUFSIZE (ssize_t)"
|
||||||
/* Specify a non-default write buffer size, or zero to implement
|
/* Specify a non-default buffer size for the next read(2) or
|
||||||
/* a no-op. Requests to shrink an existing buffer size are
|
/* write(2) operation, or zero to implement a no-op. Requests
|
||||||
/* silently ignored. To get a buffer size smaller than
|
/* to reduce the buffer size are silently ignored (i.e. any
|
||||||
/* VSTREAM_BUFSIZE, make the VSTREAM_CTL_BUFSIZE before the
|
/* positive value <= vstream_req_bufsize()). To get a buffer
|
||||||
/* stream has been used. Requests to change a fixed-size buffer
|
/* size smaller than VSTREAM_BUFSIZE, make the VSTREAM_CTL_BUFSIZE
|
||||||
/* (e.g., stderr) are not allowed.
|
/* request before the first stream read or write operation
|
||||||
/*
|
/* (i.e., vstream_req_bufsize() returns zero). Requests to
|
||||||
/* NOTE: the VSTREAM_CTL_BUFSIZE request specifies intent, not
|
/* change a fixed-size buffer (i.e., VSTREAM_ERR) are not
|
||||||
/* reality. Actual buffer sizes are not updated immediately.
|
/* allowed.
|
||||||
/* Instead, an existing write buffer will be resized when it
|
|
||||||
/* is full, and an existing read buffer will be resized when
|
|
||||||
/* the buffer is filled.
|
|
||||||
/*
|
/*
|
||||||
/* NOTE: the vstream_*printf() routines may silently expand a
|
/* NOTE: the vstream_*printf() routines may silently expand a
|
||||||
/* buffer, so that the result of some %letter specifiers can
|
/* buffer, so that the result of some %letter specifiers can
|
||||||
@ -358,13 +355,10 @@
|
|||||||
/* a buffered stream. With streams that have separate read/write
|
/* a buffered stream. With streams that have separate read/write
|
||||||
/* file descriptors, the result is the current descriptor.
|
/* file descriptors, the result is the current descriptor.
|
||||||
/*
|
/*
|
||||||
/* vstream_req_bufsize() returns the requested buffer size for
|
/* vstream_req_bufsize() returns the buffer size that will be
|
||||||
/* the named stream (default: VSTREAM_BUFSIZE). The result
|
/* used for the next read(2) or write(2) operation on the named
|
||||||
/* value reflects intent, not reality: actual buffer sizes are
|
/* stream. A zero result means that the next read(2) or write(2)
|
||||||
/* not updated immediately when the requested buffer size is
|
/* operation will use the default buffer size (VSTREAM_BUFSIZE).
|
||||||
/* specified with vstream_control(). Instead, an existing
|
|
||||||
/* write buffer will be resized when it is full, and an existing
|
|
||||||
/* read buffer will be resized when the buffer is filled.
|
|
||||||
/*
|
/*
|
||||||
/* vstream_context() returns the application context that is passed on to
|
/* vstream_context() returns the application context that is passed on to
|
||||||
/* the application-specified read/write routines.
|
/* the application-specified read/write routines.
|
||||||
@ -848,7 +842,7 @@ static int vstream_buf_get_ready(VBUF *bp)
|
|||||||
* allocation gives the application a chance to override the default
|
* allocation gives the application a chance to override the default
|
||||||
* buffering policy.
|
* buffering policy.
|
||||||
*
|
*
|
||||||
* XXX Tricky code to set the preferred buffer size as late as possible.
|
* XXX Subtle code to set the preferred buffer size as late as possible.
|
||||||
*/
|
*/
|
||||||
if (stream->req_bufsize == 0)
|
if (stream->req_bufsize == 0)
|
||||||
stream->req_bufsize = VSTREAM_BUFSIZE;
|
stream->req_bufsize = VSTREAM_BUFSIZE;
|
||||||
@ -960,7 +954,7 @@ static int vstream_buf_put_ready(VBUF *bp)
|
|||||||
* new buffer; obviously there is no data to be flushed yet. Otherwise,
|
* new buffer; obviously there is no data to be flushed yet. Otherwise,
|
||||||
* flush the buffer.
|
* flush the buffer.
|
||||||
*
|
*
|
||||||
* XXX Tricky code to set the preferred buffer size as late as possible.
|
* XXX Subtle code to set the preferred buffer size as late as possible.
|
||||||
*/
|
*/
|
||||||
if (stream->req_bufsize == 0)
|
if (stream->req_bufsize == 0)
|
||||||
stream->req_bufsize = VSTREAM_BUFSIZE;
|
stream->req_bufsize = VSTREAM_BUFSIZE;
|
||||||
@ -1015,7 +1009,7 @@ static int vstream_buf_space(VBUF *bp, ssize_t want)
|
|||||||
* VSTREAM_BUFSIZE. We flush multiples of VSTREAM_BUFSIZE in an attempt
|
* VSTREAM_BUFSIZE. We flush multiples of VSTREAM_BUFSIZE in an attempt
|
||||||
* to keep file updates block-aligned for better performance.
|
* to keep file updates block-aligned for better performance.
|
||||||
*
|
*
|
||||||
* XXX Tricky code to set the preferred buffer size as late as possible.
|
* XXX Subtle code to set the preferred buffer size as late as possible.
|
||||||
*/
|
*/
|
||||||
#define VSTREAM_TRUNCATE(count, base) (((count) / (base)) * (base))
|
#define VSTREAM_TRUNCATE(count, base) (((count) / (base)) * (base))
|
||||||
#define VSTREAM_ROUNDUP(count, base) VSTREAM_TRUNCATE(count + base - 1, base)
|
#define VSTREAM_ROUNDUP(count, base) VSTREAM_TRUNCATE(count + base - 1, base)
|
||||||
@ -1486,9 +1480,15 @@ void vstream_control(VSTREAM *stream, int name,...)
|
|||||||
if (req_bufsize < 0 || req_bufsize > INT_MAX)
|
if (req_bufsize < 0 || req_bufsize > INT_MAX)
|
||||||
msg_panic("unreasonable VSTREAM_CTL_BUFSIZE request: %ld",
|
msg_panic("unreasonable VSTREAM_CTL_BUFSIZE request: %ld",
|
||||||
(long) req_bufsize);
|
(long) req_bufsize);
|
||||||
if (stream != VSTREAM_ERR
|
if ((stream->buf.flags & VSTREAM_FLAG_FIXED) == 0
|
||||||
&& req_bufsize > stream->req_bufsize)
|
&& req_bufsize > stream->req_bufsize) {
|
||||||
|
if (msg_verbose)
|
||||||
|
msg_info("fd=%d: stream buffer size old=%ld new=%ld",
|
||||||
|
vstream_fileno(stream),
|
||||||
|
(long) stream->req_bufsize,
|
||||||
|
(long) req_bufsize);
|
||||||
stream->req_bufsize = req_bufsize;
|
stream->req_bufsize = req_bufsize;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -116,12 +116,20 @@ int vstream_tweak_tcp(VSTREAM *fp)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Fix for recent Postfix versions: increase the VSTREAM buffer size if
|
* Fix for recent Postfix versions: increase the VSTREAM buffer size if
|
||||||
* the default VSTREAM buffer size is smaller than the MSS. Note: the MSS
|
* it is smaller than the MSS. Note: the MSS may change when the route
|
||||||
* may change when the route changes and IP path MTU discovery is turned
|
* changes and IP path MTU discovery is turned on, so we choose a
|
||||||
* on, so we choose a somewhat larger buffer.
|
* somewhat larger buffer.
|
||||||
|
*
|
||||||
|
* Note: as of 20120527, the VSTREAM_CTL_BUFSIZE request can reduce the
|
||||||
|
* stream buffer size to less than VSTREAM_BUFSIZE, when the request is
|
||||||
|
* made before the first stream read or write operation. We don't want to
|
||||||
|
* reduce the buffer size.
|
||||||
*/
|
*/
|
||||||
|
#define EFF_BUFFER_SIZE(fp) (vstream_req_bufsize(fp) ? \
|
||||||
|
vstream_req_bufsize(fp) : VSTREAM_BUFSIZE)
|
||||||
|
|
||||||
#ifdef VSTREAM_CTL_BUFSIZE
|
#ifdef VSTREAM_CTL_BUFSIZE
|
||||||
if (mss > VSTREAM_BUFSIZE) {
|
if (mss > EFF_BUFFER_SIZE(fp) / 2) {
|
||||||
if (mss < INT_MAX / 2)
|
if (mss < INT_MAX / 2)
|
||||||
mss *= 2;
|
mss *= 2;
|
||||||
vstream_control(fp,
|
vstream_control(fp,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user