Return index into range passed to :send rather than bytes written

This is what LuaSocket used to do.
This commit is contained in:
Tamás Bálint Misius 2021-06-22 20:57:17 +02:00
parent dcf0764fd8
commit fb514ca9e3
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -227,7 +227,7 @@ namespace LuaTCPSocket
Reset(tcps);
lua_pushnil(l);
lua_pushliteral(l, "closed");
lua_pushinteger(l, writtenTotal);
lua_pushinteger(l, writtenTotal + begin);
return 3;
}
if (res == CURLE_AGAIN)
@ -242,11 +242,11 @@ namespace LuaTCPSocket
}
lua_pushnil(l);
lua_pushliteral(l, "timeout");
lua_pushinteger(l, writtenTotal);
lua_pushinteger(l, writtenTotal + begin);
return 3;
}
}
lua_pushinteger(l, writtenTotal);
lua_pushinteger(l, writtenTotal + begin);
return 1;
}