diff --git a/io/io_mmapwritefile.c b/io/io_mmapwritefile.c index 964c29b..d553b48 100644 --- a/io/io_mmapwritefile.c +++ b/io/io_mmapwritefile.c @@ -57,7 +57,7 @@ int64 io_mmapwritefile(int64 out,int64 in,uint64 off,uint64 bytes,io_write_callb while (left>0) { m=writecb(out,c,left); if (m<0) { - io_eagain(out); + io_eagain_write(out); if (errno!=EAGAIN) { #ifdef __MINGW32__ UnmapViewOfFile(e->mmapped); diff --git a/io/io_sendfile.c b/io/io_sendfile.c index 8ba5eee..88e0edb 100644 --- a/io/io_sendfile.c +++ b/io/io_sendfile.c @@ -15,13 +15,11 @@ int64 io_sendfile(int64 s,int64 fd,uint64 off,uint64 n) { off_t sbytes; int r=sendfile(fd,s,off,n,0,&sbytes,0); if (r==-1) { - io_entry* e=iarray_get(&io_fds,s); - if (e) { - e->canwrite=0; - e->next_write=-1; - } + io_eagain_write(s); return (errno==EAGAIN?(sbytes?sbytes:-1):-3); } + if (sbytescanwrite=0; - e->next_write=-1; - } + if (r!=bytes) + io_eagain_write(out); } return r; } @@ -59,11 +53,7 @@ int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) { long long r=sendfile64(out,in,&o,bytes); if (r==-1 && errno!=EAGAIN) r=-3; if (r!=bytes) { - io_entry* e=iarray_get(&io_fds,s); - if (e) { - e->canwrite=0; - e->next_write=-1; - } + io_eagain_write(out); } return r; } @@ -87,11 +77,7 @@ int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) { p.trailer_length=0; if (send_file(&destfd,&p,0)>=0) { if (p.bytes_sent != bytes) { - io_entry* e=iarray_get(&io_fds,s); - if (e) { - e->canwrite=0; - e->next_write=-1; - } + io_eagain_write(out); } return p.bytes_sent; } if (errno==EAGAIN) @@ -127,10 +113,7 @@ int64 io_sendfile(int64 s,int64 fd,uint64 off,uint64 n) { if (n==0) return done; continue; } else { - if (e) { - e->canwrite=0; - e->next_write=-1; - } + io_eagain_write(s); if (i==-1) return (errno==EAGAIN?-1:-3); else