aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-28 07:38:12 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-28 07:38:12 +0000
commit84f03fda7c2be57e14f937e295710b5e883fedc6 (patch)
treef8845f3e555d9ba1bd42fc77bc41791e241fdf5e
parentc98dc991998c724a3f6a1fdd90b5d1d8a80e3af3 (diff)
downloadluasocket-84f03fda7c2be57e14f937e295710b5e883fedc6.tar.gz
luasocket-84f03fda7c2be57e14f937e295710b5e883fedc6.tar.bz2
luasocket-84f03fda7c2be57e14f937e295710b5e883fedc6.zip
Previous bug fix caused a new bug. :o/
-rw-r--r--src/buffer.c2
-rw-r--r--test/testclnt.lua27
-rw-r--r--test/testsrvr.lua2
3 files changed, 18 insertions, 13 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 4bcfa1a..b771047 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -129,7 +129,7 @@ int sendraw(p_buf buf, const char *data, size_t count, size_t *sent)
129 p_tm tm = buf->tm; 129 p_tm tm = buf->tm;
130 size_t total = 0; 130 size_t total = 0;
131 int err = IO_DONE; 131 int err = IO_DONE;
132 while (total < count && err == IO_DONE) { 132 while (total < count && (err == IO_DONE || err == IO_RETRY)) {
133 size_t done; 133 size_t done;
134 err = io->send(io->ctx, data+total, count-total, &done, tm_get(tm)); 134 err = io->send(io->ctx, data+total, count-total, &done, tm_get(tm));
135 total += done; 135 total += done;
diff --git a/test/testclnt.lua b/test/testclnt.lua
index 556e54d..f5c0361 100644
--- a/test/testclnt.lua
+++ b/test/testclnt.lua
@@ -11,6 +11,7 @@ end
11function fail(...) 11function fail(...)
12 local s = string.format(unpack(arg)) 12 local s = string.format(unpack(arg))
13 io.stderr:write("ERROR: ", s, "!\n") 13 io.stderr:write("ERROR: ", s, "!\n")
14socket.sleep(3)
14 os.exit() 15 os.exit()
15end 16end
16 17
@@ -432,6 +433,20 @@ function rebind_test()
432end 433end
433 434
434------------------------------------------------------------------------ 435------------------------------------------------------------------------
436
437test("character line")
438test_asciiline(1)
439test_asciiline(17)
440test_asciiline(200)
441test_asciiline(4091)
442test_asciiline(80199)
443test_asciiline(8000000)
444test_asciiline(80199)
445test_asciiline(4091)
446test_asciiline(200)
447test_asciiline(17)
448test_asciiline(1)
449
435test("method registration") 450test("method registration")
436test_methods(socket.tcp(), { 451test_methods(socket.tcp(), {
437 "accept", 452 "accept",
@@ -498,18 +513,6 @@ test_mixed(200)
498test_mixed(17) 513test_mixed(17)
499test_mixed(1) 514test_mixed(1)
500 515
501test("character line")
502test_asciiline(1)
503test_asciiline(17)
504test_asciiline(200)
505test_asciiline(4091)
506test_asciiline(80199)
507test_asciiline(8000000)
508test_asciiline(80199)
509test_asciiline(4091)
510test_asciiline(200)
511test_asciiline(17)
512test_asciiline(1)
513 516
514test("binary line") 517test("binary line")
515reconnect() 518reconnect()
diff --git a/test/testsrvr.lua b/test/testsrvr.lua
index d172a9e..52f1f90 100644
--- a/test/testsrvr.lua
+++ b/test/testsrvr.lua
@@ -13,6 +13,7 @@ while 1 do
13 -- control:setoption("nodelay", true) 13 -- control:setoption("nodelay", true)
14 while 1 do 14 while 1 do
15 command, error = control:receive() 15 command, error = control:receive()
16print(error)
16 if error then 17 if error then
17 control:close() 18 control:close()
18 print("server: closing connection...") 19 print("server: closing connection...")
@@ -24,6 +25,7 @@ while 1 do
24 print("server: closing connection...") 25 print("server: closing connection...")
25 break 26 break
26 end 27 end
28 print(command);
27 (loadstring(command))() 29 (loadstring(command))()
28 end 30 end
29end 31end