aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-17 23:08:56 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-17 23:08:56 +0000
commit07dda08c5d25dca0f8e79b80998559544aa7c398 (patch)
tree7501fff7707f67c24634256818b0336a8a1853ac
parent597a062b1bc38488df1363995eece8a9f19c7111 (diff)
downloadluasocket-07dda08c5d25dca0f8e79b80998559544aa7c398.tar.gz
luasocket-07dda08c5d25dca0f8e79b80998559544aa7c398.tar.bz2
luasocket-07dda08c5d25dca0f8e79b80998559544aa7c398.zip
Changed the return of the send function...
-rw-r--r--luasocket.sln8
-rw-r--r--samples/talker.lua2
-rw-r--r--src/buffer.c12
-rw-r--r--test/testclnt.lua8
4 files changed, 15 insertions, 15 deletions
diff --git a/luasocket.sln b/luasocket.sln
index 11d7824..6a1d0b8 100644
--- a/luasocket.sln
+++ b/luasocket.sln
@@ -7,10 +7,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mime", "mime.vcproj", "{128
7 ProjectSection(ProjectDependencies) = postProject 7 ProjectSection(ProjectDependencies) = postProject
8 EndProjectSection 8 EndProjectSection
9EndProject 9EndProject
10Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smtp", "smtp.vcproj", "{128E8BD0-174A-48F0-8771-92B1E8D18713}"
11 ProjectSection(ProjectDependencies) = postProject
12 EndProjectSection
13EndProject
14Global 10Global
15 GlobalSection(SolutionConfiguration) = preSolution 11 GlobalSection(SolutionConfiguration) = preSolution
16 Debug = Debug 12 Debug = Debug
@@ -25,10 +21,6 @@ Global
25 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Debug.Build.0 = Debug|Win32 21 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Debug.Build.0 = Debug|Win32
26 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.ActiveCfg = Release|Win32 22 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.ActiveCfg = Release|Win32
27 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.Build.0 = Release|Win32 23 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.Build.0 = Release|Win32
28 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Debug.ActiveCfg = Debug|Win32
29 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Debug.Build.0 = Debug|Win32
30 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.ActiveCfg = Release|Win32
31 {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.Build.0 = Release|Win32
32 EndGlobalSection 24 EndGlobalSection
33 GlobalSection(ExtensibilityGlobals) = postSolution 25 GlobalSection(ExtensibilityGlobals) = postSolution
34 EndGlobalSection 26 EndGlobalSection
diff --git a/samples/talker.lua b/samples/talker.lua
index 94d2133..bafd021 100644
--- a/samples/talker.lua
+++ b/samples/talker.lua
@@ -4,7 +4,7 @@
4-- Author: Diego Nehab 4-- Author: Diego Nehab
5-- RCS ID: $Id$ 5-- RCS ID: $Id$
6----------------------------------------------------------------------------- 6-----------------------------------------------------------------------------
7require("socket") 7socket = require("socket")
8host = host or "localhost" 8host = host or "localhost"
9port = port or 8080 9port = port or 8080
10if arg then 10if arg then
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);
diff --git a/test/testclnt.lua b/test/testclnt.lua
index da6b2e8..b295cf3 100644
--- a/test/testclnt.lua
+++ b/test/testclnt.lua
@@ -225,7 +225,7 @@ function test_totaltimeoutsend(len, tm, sl)
225 ]], 2*tm, len, sl, sl, len)) 225 ]], 2*tm, len, sl, sl, len))
226 data:settimeout(tm, "total") 226 data:settimeout(tm, "total")
227 str = string.rep("a", 2*len) 227 str = string.rep("a", 2*len)
228 total, err, elapsed = data:send(str) 228 total, err, partial, elapsed = data:send(str)
229 check_timeout(tm, sl, elapsed, err, "send", "total", 229 check_timeout(tm, sl, elapsed, err, "send", "total",
230 total == 2*len) 230 total == 2*len)
231end 231end
@@ -265,7 +265,7 @@ function test_blockingtimeoutsend(len, tm, sl)
265 ]], 2*tm, len, sl, sl, len)) 265 ]], 2*tm, len, sl, sl, len))
266 data:settimeout(tm) 266 data:settimeout(tm)
267 str = string.rep("a", 2*len) 267 str = string.rep("a", 2*len)
268 total, err, elapsed = data:send(str) 268 total, err, partial, elapsed = data:send(str)
269 check_timeout(tm, sl, elapsed, err, "send", "blocking", 269 check_timeout(tm, sl, elapsed, err, "send", "blocking",
270 total == 2*len) 270 total == 2*len)
271end 271end
@@ -326,13 +326,13 @@ function test_closed()
326 data:close() 326 data:close()
327 data = nil 327 data = nil
328 ]] 328 ]]
329 total, err = data:send(string.rep("ugauga", 100000)) 329 total, err, partial = data:send(string.rep("ugauga", 100000))
330 if not err then 330 if not err then
331 pass("failed: output buffer is at least %d bytes long!", total) 331 pass("failed: output buffer is at least %d bytes long!", total)
332 elseif err ~= "closed" then 332 elseif err ~= "closed" then
333 fail("got '"..err.."' instead of 'closed'.") 333 fail("got '"..err.."' instead of 'closed'.")
334 else 334 else
335 pass("graceful 'closed' received after %d bytes were sent", total) 335 pass("graceful 'closed' received after %d bytes were sent", partial)
336 end 336 end
337end 337end
338 338