aboutsummaryrefslogtreecommitdiff
path: root/test/testclnt.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/testclnt.lua')
-rw-r--r--test/testclnt.lua16
1 files changed, 7 insertions, 9 deletions
diff --git a/test/testclnt.lua b/test/testclnt.lua
index c2c782c..e3f2b94 100644
--- a/test/testclnt.lua
+++ b/test/testclnt.lua
@@ -465,16 +465,14 @@ print("Testing " .. 2*size .. " bytes")
465remote(string.format([[ 465remote(string.format([[
466 data:send(string.rep("a", %d)) 466 data:send(string.rep("a", %d))
467 socket.sleep(0.5) 467 socket.sleep(0.5)
468 data:send(string.rep("b", %d)) 468 data:send(string.rep("b", %d) .. "\n")
469]], size, size)) 469]], size, size))
470 local err = "timeout" 470 local err = "timeout"
471 local part = "" 471 local part = ""
472 local str 472 local str
473 data:settimeout(0) 473 data:settimeout(0)
474 while 1 do 474 while 1 do
475 local needed = 2*size - string.len(part) 475 str, err, part = data:receive("*l", part)
476 assert(needed > 0, "weird")
477 str, err, part = data:receive(needed, part)
478 if err ~= "timeout" then break end 476 if err ~= "timeout" then break end
479 end 477 end
480 assert(str == (string.rep("a", size) .. string.rep("b", size))) 478 assert(str == (string.rep("a", size) .. string.rep("b", size)))
@@ -482,15 +480,14 @@ remote(string.format([[
482remote(string.format([[ 480remote(string.format([[
483 str = data:receive(%d) 481 str = data:receive(%d)
484 socket.sleep(0.5) 482 socket.sleep(0.5)
485 str = data:receive(%d, str) 483 str = data:receive(2*%d, str)
486 data:send(str) 484 data:send(str)
487]], size, size)) 485]], size, size))
488 data:settimeout(0) 486 data:settimeout(0)
489 local sofar = 1 487 local start = 0
490 while 1 do 488 while 1 do
491 _, err, part = data:send(str, sofar) 489 ret, err, start = data:send(str, start+1)
492 if err ~= "timeout" then break end 490 if err ~= "timeout" then break end
493 sofar = sofar + part
494 end 491 end
495 data:send("\n") 492 data:send("\n")
496 data:settimeout(-1) 493 data:settimeout(-1)
@@ -501,6 +498,7 @@ end
501 498
502------------------------------------------------------------------------ 499------------------------------------------------------------------------
503 500
501
504test("method registration") 502test("method registration")
505test_methods(socket.tcp(), { 503test_methods(socket.tcp(), {
506 "accept", 504 "accept",
@@ -622,7 +620,7 @@ test_nonblocking(17)
622test_nonblocking(200) 620test_nonblocking(200)
623test_nonblocking(4091) 621test_nonblocking(4091)
624test_nonblocking(80199) 622test_nonblocking(80199)
625test_nonblocking(8000000) 623test_nonblocking(800000)
626test_nonblocking(80199) 624test_nonblocking(80199)
627test_nonblocking(4091) 625test_nonblocking(4091)
628test_nonblocking(200) 626test_nonblocking(200)