MCPcopy Create free account
hub / github.com/defold/defold / recvraw

Function recvraw

engine/script/src/luasocket/buffer.c:186–199  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Reads a fixed number of bytes (buffered) \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

184* Reads a fixed number of bytes (buffered)
185\*-------------------------------------------------------------------------*/
186static 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)

Callers 1

buffer_meth_receiveFunction · 0.85

Calls 3

buffer_getFunction · 0.85
luaL_addlstringFunction · 0.85
buffer_skipFunction · 0.85

Tested by

no test coverage detected