change io_eagain to io_eagain_wite

master
leitner 3 years ago
parent ebec6ee140
commit 1564beb8a3

@ -57,7 +57,7 @@ int64 io_mmapwritefile(int64 out,int64 in,uint64 off,uint64 bytes,io_write_callb
while (left>0) { while (left>0) {
m=writecb(out,c,left); m=writecb(out,c,left);
if (m<0) { if (m<0) {
io_eagain(out); io_eagain_write(out);
if (errno!=EAGAIN) { if (errno!=EAGAIN) {
#ifdef __MINGW32__ #ifdef __MINGW32__
UnmapViewOfFile(e->mmapped); UnmapViewOfFile(e->mmapped);

@ -15,13 +15,11 @@ int64 io_sendfile(int64 s,int64 fd,uint64 off,uint64 n) {
off_t sbytes; off_t sbytes;
int r=sendfile(fd,s,off,n,0,&sbytes,0); int r=sendfile(fd,s,off,n,0,&sbytes,0);
if (r==-1) { if (r==-1) {
io_entry* e=iarray_get(&io_fds,s); io_eagain_write(s);
if (e) {
e->canwrite=0;
e->next_write=-1;
}
return (errno==EAGAIN?(sbytes?sbytes:-1):-3); return (errno==EAGAIN?(sbytes?sbytes:-1):-3);
} }
if (sbytes<n)
io_eagain_write(s);
return n; return n;
} }
@ -37,12 +35,8 @@ int64 io_sendfile(int64 s,int64 fd,uint64 off,uint64 n) {
int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) { int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) {
long long r=sendfile64(out,in,off,bytes,0,0); long long r=sendfile64(out,in,off,bytes,0,0);
if (r==-1 && errno!=EAGAIN) r=-3; if (r==-1 && errno!=EAGAIN) r=-3;
if (r!=bytes) { if (r!=bytes)
io_entry* e=iarray_get(&io_fds,s); io_eagain_write(out);
if (e) {
e->canwrite=0;
e->next_write=-1;
}
} }
return r; 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); long long r=sendfile64(out,in,&o,bytes);
if (r==-1 && errno!=EAGAIN) r=-3; if (r==-1 && errno!=EAGAIN) r=-3;
if (r!=bytes) { if (r!=bytes) {
io_entry* e=iarray_get(&io_fds,s); io_eagain_write(out);
if (e) {
e->canwrite=0;
e->next_write=-1;
}
} }
return r; return r;
} }
@ -87,11 +77,7 @@ int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) {
p.trailer_length=0; p.trailer_length=0;
if (send_file(&destfd,&p,0)>=0) { if (send_file(&destfd,&p,0)>=0) {
if (p.bytes_sent != bytes) { if (p.bytes_sent != bytes) {
io_entry* e=iarray_get(&io_fds,s); io_eagain_write(out);
if (e) {
e->canwrite=0;
e->next_write=-1;
}
} }
return p.bytes_sent; return p.bytes_sent;
} if (errno==EAGAIN) } if (errno==EAGAIN)
@ -127,10 +113,7 @@ int64 io_sendfile(int64 s,int64 fd,uint64 off,uint64 n) {
if (n==0) return done; if (n==0) return done;
continue; continue;
} else { } else {
if (e) { io_eagain_write(s);
e->canwrite=0;
e->next_write=-1;
}
if (i==-1) if (i==-1)
return (errno==EAGAIN?-1:-3); return (errno==EAGAIN?-1:-3);
else else

Loading…
Cancel
Save