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

Function recvall

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

-------------------------------------------------------------------------*\ * Reads everything until the connection is closed (buffered) \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

203* Reads everything until the connection is closed (buffered)
204\*-------------------------------------------------------------------------*/
205static int recvall(p_buffer buf, luaL_Buffer *b) {
206 int err = IO_DONE;
207 size_t total = 0;
208 while (err == IO_DONE) {
209 const char *data; size_t count;
210 err = buffer_get(buf, &data, &count);
211 total += count;
212 luaL_addlstring(b, data, count);
213 buffer_skip(buf, count);
214 }
215 if (err == IO_CLOSED) {
216 if (total > 0) return IO_DONE;
217 else return IO_CLOSED;
218 } else return err;
219}
220
221/*-------------------------------------------------------------------------*\
222* Reads a line terminated by a CR LF pair or just by a LF. The CR and LF

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