Skip to content
Snippets Groups Projects
Commit ff705842 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Fixed some more bugs in Stdio.sendfile().

Rev: lib/modules/Stdio.pmod/module.pmod:1.47
parent d72831a9
No related branches found
No related tags found
No related merge requests found
// $Id: module.pmod,v 1.46 1999/04/19 20:56:45 grubba Exp $ // $Id: module.pmod,v 1.47 1999/04/19 21:19:26 grubba Exp $
import String; import String;
...@@ -809,8 +809,10 @@ static class nb_sendfile ...@@ -809,8 +809,10 @@ static class nb_sendfile
function(int, mixed ...:void) cb = callback; function(int, mixed ...:void) cb = callback;
args = 0; args = 0;
callback = 0; callback = 0;
if (cb) {
cb(sent, @a); cb(sent, @a);
} }
}
static int do_write() static int do_write()
{ {
...@@ -846,10 +848,14 @@ static class nb_sendfile ...@@ -846,10 +848,14 @@ static class nb_sendfile
{ {
if (do_write()) { if (do_write()) {
if (from) { if (from) {
if (sizeof(to_write) < READER_RESTART) {
if (blocking_from) { if (blocking_from) {
do_read(); do_read();
if (!sizeof(to_write)) {
// Done.
writer_done();
}
} else { } else {
if (sizeof(to_write) < READER_RESTART) {
if (!sizeof(to_write)) { if (!sizeof(to_write)) {
// Go to sleep. // Go to sleep.
to->set_nonblocking(0,0,0); to->set_nonblocking(0,0,0);
...@@ -885,6 +891,7 @@ static class nb_sendfile ...@@ -885,6 +891,7 @@ static class nb_sendfile
if (sizeof(to_write) && do_write()) { if (sizeof(to_write) && do_write()) {
call_out(do_blocking, 0); call_out(do_blocking, 0);
} else { } else {
// Done.
from = 0; from = 0;
to = 0; to = 0;
writer_done(); writer_done();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment