From 07dda08c5d25dca0f8e79b80998559544aa7c398 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Thu, 17 Jun 2004 23:08:56 +0000 Subject: Changed the return of the send function... --- src/buffer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/buffer.c b/src/buffer.c index fd885a2..60e42ae 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -66,8 +66,16 @@ int buf_meth_send(lua_State *L, p_buf buf) err = sendraw(buf, data, count, &sent); total += sent; } - lua_pushnumber(L, total); - io_pusherror(L, err); + /* check if there was an error */ + if (err != IO_DONE) { + lua_pushnil(L); + io_pusherror(L, err); + lua_pushnumber(L, total); + } else { + lua_pushnumber(L, total); + lua_pushnil(L); + lua_pushnil(L); + } #ifdef LUASOCKET_DEBUG /* push time elapsed during operation as the last return value */ lua_pushnumber(L, (tm_gettime() - tm_getstart(tm))/1000.0); -- cgit v1.2.3-55-g6feb