diff options
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index dbd5d2c..1b1b791 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
@@ -158,6 +158,7 @@ int buf_isempty(p_buf buf) { | |||
158 | /*-------------------------------------------------------------------------*\ | 158 | /*-------------------------------------------------------------------------*\ |
159 | * Sends a block of data (unbuffered) | 159 | * Sends a block of data (unbuffered) |
160 | \*-------------------------------------------------------------------------*/ | 160 | \*-------------------------------------------------------------------------*/ |
161 | #define STEPSIZE 8192 | ||
161 | static int sendraw(p_buf buf, const char *data, size_t count, size_t *sent) { | 162 | static int sendraw(p_buf buf, const char *data, size_t count, size_t *sent) { |
162 | p_io io = buf->io; | 163 | p_io io = buf->io; |
163 | p_tm tm = buf->tm; | 164 | p_tm tm = buf->tm; |
@@ -165,7 +166,8 @@ static int sendraw(p_buf buf, const char *data, size_t count, size_t *sent) { | |||
165 | int err = IO_DONE; | 166 | int err = IO_DONE; |
166 | while (total < count && err == IO_DONE) { | 167 | while (total < count && err == IO_DONE) { |
167 | size_t done; | 168 | size_t done; |
168 | err = io->send(io->ctx, data+total, count-total, &done, tm); | 169 | size_t step = (count-total <= STEPSIZE)? count-total: STEPSIZE; |
170 | err = io->send(io->ctx, data+total, step, &done, tm); | ||
169 | total += done; | 171 | total += done; |
170 | } | 172 | } |
171 | *sent = total; | 173 | *sent = total; |