diff options
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 12 |
1 files changed, 10 insertions, 2 deletions
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) | |||
66 | err = sendraw(buf, data, count, &sent); | 66 | err = sendraw(buf, data, count, &sent); |
67 | total += sent; | 67 | total += sent; |
68 | } | 68 | } |
69 | lua_pushnumber(L, total); | 69 | /* check if there was an error */ |
70 | io_pusherror(L, err); | 70 | if (err != IO_DONE) { |
71 | lua_pushnil(L); | ||
72 | io_pusherror(L, err); | ||
73 | lua_pushnumber(L, total); | ||
74 | } else { | ||
75 | lua_pushnumber(L, total); | ||
76 | lua_pushnil(L); | ||
77 | lua_pushnil(L); | ||
78 | } | ||
71 | #ifdef LUASOCKET_DEBUG | 79 | #ifdef LUASOCKET_DEBUG |
72 | /* push time elapsed during operation as the last return value */ | 80 | /* push time elapsed during operation as the last return value */ |
73 | lua_pushnumber(L, (tm_gettime() - tm_getstart(tm))/1000.0); | 81 | lua_pushnumber(L, (tm_gettime() - tm_getstart(tm))/1000.0); |