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

Function sendraw

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

Source from the content-addressed store, hash-verified

166\*-------------------------------------------------------------------------*/
167#define STEPSIZE 8192
168static int sendraw(p_buffer buf, const char *data, size_t count, size_t *sent) {
169 p_io io = buf->io;
170 p_timeout tm = buf->tm;
171 size_t total = 0;
172 int err = IO_DONE;
173 while (total < count && err == IO_DONE) {
174 size_t done = 0;
175 size_t step = (count-total <= STEPSIZE)? count-total: STEPSIZE;
176 err = io->send(io->ctx, data+total, step, &done, tm);
177 total += done;
178 }
179 *sent = total;
180 buf->sent += total;
181 return err;
182}
183
184/*-------------------------------------------------------------------------*\
185* Reads a fixed number of bytes (buffered)

Callers 1

buffer_meth_sendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected