Commit f501b840 authored by devsaurus's avatar devsaurus
Browse files

signal an error in case TCP send data was only written partly

parent d26c8ea2
......@@ -650,6 +650,11 @@ int net_send( lua_State *L ) {
} else if (ud->type == TYPE_TCP_CLIENT) {
size_t bytes_written;
err = netconn_write_partly(ud->netconn, data, datalen, NETCONN_COPY, &bytes_written);
if (err == ERR_OK && (datalen != bytes_written)) {
// the string object is potentially gc'ed after net_send finishes and we can't ensure
// integrity of the data pointer to netconn -> signal error to Lua layer
err = ERR_BUF;
}
}
else {
err = ERR_VAL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment