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) p_tm tm = buf->tm; size_t total = 0; int err = IO_DONE; - while (total < count && err == IO_DONE) { + while (total < count && (err == IO_DONE || err == IO_RETRY)) { size_t done; err = io->send(io->ctx, data+total, count-total, &done, tm_get(tm)); 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 function fail(...) local s = string.format(unpack(arg)) io.stderr:write("ERROR: ", s, "!\n") +socket.sleep(3) os.exit() end @@ -432,6 +433,20 @@ function rebind_test() end ------------------------------------------------------------------------ + +test("character line") +test_asciiline(1) +test_asciiline(17) +test_asciiline(200) +test_asciiline(4091) +test_asciiline(80199) +test_asciiline(8000000) +test_asciiline(80199) +test_asciiline(4091) +test_asciiline(200) +test_asciiline(17) +test_asciiline(1) + test("method registration") test_methods(socket.tcp(), { "accept", @@ -498,18 +513,6 @@ test_mixed(200) test_mixed(17) test_mixed(1) -test("character line") -test_asciiline(1) -test_asciiline(17) -test_asciiline(200) -test_asciiline(4091) -test_asciiline(80199) -test_asciiline(8000000) -test_asciiline(80199) -test_asciiline(4091) -test_asciiline(200) -test_asciiline(17) -test_asciiline(1) test("binary line") reconnect() 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 -- control:setoption("nodelay", true) while 1 do command, error = control:receive() +print(error) if error then control:close() print("server: closing connection...") @@ -24,6 +25,7 @@ while 1 do print("server: closing connection...") break end + print(command); (loadstring(command))() end end