From fb514ca9e3c7f4f419b697913dc51ae88e21f24b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Tue, 22 Jun 2021 20:57:17 +0200 Subject: [PATCH] Return index into range passed to :send rather than bytes written This is what LuaSocket used to do. --- src/lua/LuaTCPSocket.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lua/LuaTCPSocket.cpp b/src/lua/LuaTCPSocket.cpp index 521ed7f89..dbfe4c358 100644 --- a/src/lua/LuaTCPSocket.cpp +++ b/src/lua/LuaTCPSocket.cpp @@ -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; }