change io_eagain to io_eagain_wite
This commit is contained in:
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) {
|
||||
m=writecb(out,c,left);
|
||||
if (m<0) {
|
||||
io_eagain(out);
|
||||
io_eagain_write(out);
|
||||
if (errno!=EAGAIN) {
|
||||
#ifdef __MINGW32__
|
||||
UnmapViewOfFile(e->mmapped);
|
||||
|
@ -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 (sbytes<n)
|
||||
io_eagain_write(s);
|
||||
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) {
|
||||
long long r=sendfile64(out,in,off,bytes,0,0);
|
||||
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;
|
||||
}
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user