MCPcopy Create free account
hub / github.com/Tencent/UnLua / buffer_get

Function buffer_get

Plugins/UnLuaExtensions/LuaSocket/Source/src/buffer.cpp:260–273  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Return any data available in buffer, or get more data from transport layer * if buffer is empty \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

258* if buffer is empty
259\*-------------------------------------------------------------------------*/
260static int buffer_get(p_buffer buf, const char **data, size_t *count) {
261 int err = IO_DONE;
262 p_io io = buf->io;
263 p_timeout tm = buf->tm;
264 if (buffer_isempty(buf)) {
265 size_t got;
266 err = io->recv(io->ctx, buf->data, BUF_SIZE, &got, tm);
267 buf->first = 0;
268 buf->last = got;
269 }
270 *count = buf->last - buf->first;
271 *data = buf->data + buf->first;
272 return err;
273}

Callers 3

recvrawFunction · 0.85
recvallFunction · 0.85
recvlineFunction · 0.85

Calls 1

buffer_isemptyFunction · 0.85

Tested by

no test coverage detected