diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-11-27 07:58:04 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-11-27 07:58:04 +0000 |
| commit | 7c97e8e40aaa665226fb54449773dc3134e755b2 (patch) | |
| tree | 47888d4c924fc24bf3b355bf58120ea3cdc74bc4 /src/buffer.c | |
| parent | eb0fc857ddea6f084d338589e2a33d3e7d4eade6 (diff) | |
| download | luasocket-7c97e8e40aaa665226fb54449773dc3134e755b2.tar.gz luasocket-7c97e8e40aaa665226fb54449773dc3134e755b2.tar.bz2 luasocket-7c97e8e40aaa665226fb54449773dc3134e755b2.zip | |
Almost ready for beta3
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; |
