Previous bug fix caused a new bug. :o/

This commit is contained in:
Diego Nehab 2004-05-28 07:38:12 +00:00
parent c98dc99199
commit 84f03fda7c
3 changed files with 18 additions and 13 deletions

View File

@ -129,7 +129,7 @@ int sendraw(p_buf buf, const char *data, size_t count, size_t *sent)
p_tm tm = buf->tm; p_tm tm = buf->tm;
size_t total = 0; size_t total = 0;
int err = IO_DONE; int err = IO_DONE;
while (total < count && err == IO_DONE) { while (total < count && (err == IO_DONE || err == IO_RETRY)) {
size_t done; size_t done;
err = io->send(io->ctx, data+total, count-total, &done, tm_get(tm)); err = io->send(io->ctx, data+total, count-total, &done, tm_get(tm));
total += done; total += done;

View File

@ -11,6 +11,7 @@ end
function fail(...) function fail(...)
local s = string.format(unpack(arg)) local s = string.format(unpack(arg))
io.stderr:write("ERROR: ", s, "!\n") io.stderr:write("ERROR: ", s, "!\n")
socket.sleep(3)
os.exit() os.exit()
end end
@ -432,6 +433,20 @@ function rebind_test()
end 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("method registration")
test_methods(socket.tcp(), { test_methods(socket.tcp(), {
"accept", "accept",
@ -498,18 +513,6 @@ test_mixed(200)
test_mixed(17) test_mixed(17)
test_mixed(1) 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") test("binary line")
reconnect() reconnect()

View File

@ -13,6 +13,7 @@ while 1 do
-- control:setoption("nodelay", true) -- control:setoption("nodelay", true)
while 1 do while 1 do
command, error = control:receive() command, error = control:receive()
print(error)
if error then if error then
control:close() control:close()
print("server: closing connection...") print("server: closing connection...")
@ -24,6 +25,7 @@ while 1 do
print("server: closing connection...") print("server: closing connection...")
break break
end end
print(command);
(loadstring(command))() (loadstring(command))()
end end
end end