diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 07:38:12 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 07:38:12 +0000 |
| commit | 84f03fda7c2be57e14f937e295710b5e883fedc6 (patch) | |
| tree | f8845f3e555d9ba1bd42fc77bc41791e241fdf5e | |
| parent | c98dc991998c724a3f6a1fdd90b5d1d8a80e3af3 (diff) | |
| download | luasocket-84f03fda7c2be57e14f937e295710b5e883fedc6.tar.gz luasocket-84f03fda7c2be57e14f937e295710b5e883fedc6.tar.bz2 luasocket-84f03fda7c2be57e14f937e295710b5e883fedc6.zip | |
Previous bug fix caused a new bug. :o/
| -rw-r--r-- | src/buffer.c | 2 | ||||
| -rw-r--r-- | test/testclnt.lua | 27 | ||||
| -rw-r--r-- | test/testsrvr.lua | 2 |
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 | |||
| 11 | function fail(...) | 11 | function 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") |
| 14 | socket.sleep(3) | ||
| 14 | os.exit() | 15 | os.exit() |
| 15 | end | 16 | end |
| 16 | 17 | ||
| @@ -432,6 +433,20 @@ function rebind_test() | |||
| 432 | end | 433 | end |
| 433 | 434 | ||
| 434 | ------------------------------------------------------------------------ | 435 | ------------------------------------------------------------------------ |
| 436 | |||
| 437 | test("character line") | ||
| 438 | test_asciiline(1) | ||
| 439 | test_asciiline(17) | ||
| 440 | test_asciiline(200) | ||
| 441 | test_asciiline(4091) | ||
| 442 | test_asciiline(80199) | ||
| 443 | test_asciiline(8000000) | ||
| 444 | test_asciiline(80199) | ||
| 445 | test_asciiline(4091) | ||
| 446 | test_asciiline(200) | ||
| 447 | test_asciiline(17) | ||
| 448 | test_asciiline(1) | ||
| 449 | |||
| 435 | test("method registration") | 450 | test("method registration") |
| 436 | test_methods(socket.tcp(), { | 451 | test_methods(socket.tcp(), { |
| 437 | "accept", | 452 | "accept", |
| @@ -498,18 +513,6 @@ test_mixed(200) | |||
| 498 | test_mixed(17) | 513 | test_mixed(17) |
| 499 | test_mixed(1) | 514 | test_mixed(1) |
| 500 | 515 | ||
| 501 | test("character line") | ||
| 502 | test_asciiline(1) | ||
| 503 | test_asciiline(17) | ||
| 504 | test_asciiline(200) | ||
| 505 | test_asciiline(4091) | ||
| 506 | test_asciiline(80199) | ||
| 507 | test_asciiline(8000000) | ||
| 508 | test_asciiline(80199) | ||
| 509 | test_asciiline(4091) | ||
| 510 | test_asciiline(200) | ||
| 511 | test_asciiline(17) | ||
| 512 | test_asciiline(1) | ||
| 513 | 516 | ||
| 514 | test("binary line") | 517 | test("binary line") |
| 515 | reconnect() | 518 | 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 | |||
| 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() |
| 16 | print(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 |
| 29 | end | 31 | end |
