mirror of
https://github.com/brunoos/luasec.git
synced 2024-12-27 04:58:20 +01:00
parent
5787d51bb8
commit
5f4799d8cf
@ -78,9 +78,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
|
|||||||
const char *data = luaL_checklstring(L, 2, &size);
|
const char *data = luaL_checklstring(L, 2, &size);
|
||||||
long start = (long) luaL_optnumber(L, 3, 1);
|
long start = (long) luaL_optnumber(L, 3, 1);
|
||||||
long end = (long) luaL_optnumber(L, 4, -1);
|
long end = (long) luaL_optnumber(L, 4, -1);
|
||||||
#ifdef LUASOCKET_DEBUG
|
timeout_markstart(buf->tm);
|
||||||
p_timeout tm = timeout_markstart(buf->tm);
|
|
||||||
#endif
|
|
||||||
if (start < 0) start = (long) (size+start+1);
|
if (start < 0) start = (long) (size+start+1);
|
||||||
if (end < 0) end = (long) (size+end+1);
|
if (end < 0) end = (long) (size+end+1);
|
||||||
if (start < 1) start = (long) 1;
|
if (start < 1) start = (long) 1;
|
||||||
@ -98,7 +96,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
|
|||||||
}
|
}
|
||||||
#ifdef LUASOCKET_DEBUG
|
#ifdef LUASOCKET_DEBUG
|
||||||
/* push time elapsed during operation as the last return value */
|
/* push time elapsed during operation as the last return value */
|
||||||
lua_pushnumber(L, timeout_gettime() - timeout_getstart(tm));
|
lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm));
|
||||||
#endif
|
#endif
|
||||||
return lua_gettop(L) - top;
|
return lua_gettop(L) - top;
|
||||||
}
|
}
|
||||||
@ -117,9 +115,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
|
|||||||
top = 3;
|
top = 3;
|
||||||
}
|
}
|
||||||
part = luaL_optlstring(L, 3, "", &size);
|
part = luaL_optlstring(L, 3, "", &size);
|
||||||
#ifdef LUASOCKET_DEBUG
|
timeout_markstart(buf->tm);
|
||||||
p_timeout tm = timeout_markstart(buf->tm);
|
|
||||||
#endif
|
|
||||||
/* initialize buffer with optional extra prefix
|
/* initialize buffer with optional extra prefix
|
||||||
* (useful for concatenating previous partial results) */
|
* (useful for concatenating previous partial results) */
|
||||||
luaL_buffinit(L, &b);
|
luaL_buffinit(L, &b);
|
||||||
@ -155,7 +151,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
|
|||||||
}
|
}
|
||||||
#ifdef LUASOCKET_DEBUG
|
#ifdef LUASOCKET_DEBUG
|
||||||
/* push time elapsed during operation as the last return value */
|
/* push time elapsed during operation as the last return value */
|
||||||
lua_pushnumber(L, timeout_gettime() - timeout_getstart(tm));
|
lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm));
|
||||||
#endif
|
#endif
|
||||||
return lua_gettop(L) - top;
|
return lua_gettop(L) - top;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user