diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-17 23:08:56 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-17 23:08:56 +0000 |
| commit | 07dda08c5d25dca0f8e79b80998559544aa7c398 (patch) | |
| tree | 7501fff7707f67c24634256818b0336a8a1853ac /src | |
| parent | 597a062b1bc38488df1363995eece8a9f19c7111 (diff) | |
| download | luasocket-07dda08c5d25dca0f8e79b80998559544aa7c398.tar.gz luasocket-07dda08c5d25dca0f8e79b80998559544aa7c398.tar.bz2 luasocket-07dda08c5d25dca0f8e79b80998559544aa7c398.zip | |
Changed the return of the send function...
Diffstat (limited to 'src')
| -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); |
