-------------------------------------------------------------------------*\ * Reads a fixed number of bytes (buffered) \*-------------------------------------------------------------------------*/
| 185 | * Reads a fixed number of bytes (buffered) |
| 186 | \*-------------------------------------------------------------------------*/ |
| 187 | static int recvraw(p_buffer buf, size_t wanted, luaL_Buffer *b) { |
| 188 | int err = IO_DONE; |
| 189 | size_t total = 0; |
| 190 | while (err == IO_DONE) { |
| 191 | size_t count; const char *data; |
| 192 | err = buffer_get(buf, &data, &count); |
| 193 | count = MIN(count, wanted - total); |
| 194 | luaL_addlstring(b, data, count); |
| 195 | buffer_skip(buf, count); |
| 196 | total += count; |
| 197 | if (total >= wanted) break; |
| 198 | } |
| 199 | return err; |
| 200 | } |
| 201 | |
| 202 | /*-------------------------------------------------------------------------*\ |
| 203 | * Reads everything until the connection is closed (buffered) |
no test coverage detected