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