aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buffer.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 4ef4e8e..423d804 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -78,9 +78,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
78 const char *data = luaL_checklstring(L, 2, &size); 78 const char *data = luaL_checklstring(L, 2, &size);
79 long start = (long) luaL_optnumber(L, 3, 1); 79 long start = (long) luaL_optnumber(L, 3, 1);
80 long end = (long) luaL_optnumber(L, 4, -1); 80 long end = (long) luaL_optnumber(L, 4, -1);
81#ifdef LUASOCKET_DEBUG 81 timeout_markstart(buf->tm);
82 p_timeout tm = timeout_markstart(buf->tm);
83#endif
84 if (start < 0) start = (long) (size+start+1); 82 if (start < 0) start = (long) (size+start+1);
85 if (end < 0) end = (long) (size+end+1); 83 if (end < 0) end = (long) (size+end+1);
86 if (start < 1) start = (long) 1; 84 if (start < 1) start = (long) 1;
@@ -98,7 +96,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
98 } 96 }
99#ifdef LUASOCKET_DEBUG 97#ifdef LUASOCKET_DEBUG
100 /* push time elapsed during operation as the last return value */ 98 /* push time elapsed during operation as the last return value */
101 lua_pushnumber(L, timeout_gettime() - timeout_getstart(tm)); 99 lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm));
102#endif 100#endif
103 return lua_gettop(L) - top; 101 return lua_gettop(L) - top;
104} 102}
@@ -111,9 +109,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
111 luaL_Buffer b; 109 luaL_Buffer b;
112 size_t size; 110 size_t size;
113 const char *part = luaL_optlstring(L, 3, "", &size); 111 const char *part = luaL_optlstring(L, 3, "", &size);
114#ifdef LUASOCKET_DEBUG 112 timeout_markstart(buf->tm);
115 p_timeout tm = timeout_markstart(buf->tm);
116#endif
117 /* initialize buffer with optional extra prefix 113 /* initialize buffer with optional extra prefix
118 * (useful for concatenating previous partial results) */ 114 * (useful for concatenating previous partial results) */
119 luaL_buffinit(L, &b); 115 luaL_buffinit(L, &b);
@@ -149,7 +145,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
149 } 145 }
150#ifdef LUASOCKET_DEBUG 146#ifdef LUASOCKET_DEBUG
151 /* push time elapsed during operation as the last return value */ 147 /* push time elapsed during operation as the last return value */
152 lua_pushnumber(L, timeout_gettime() - timeout_getstart(tm)); 148 lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm));
153#endif 149#endif
154 return lua_gettop(L) - top; 150 return lua_gettop(L) - top;
155} 151}