in io_eagain, make sure the kernel knows we wanted to write to the

descriptor in case we optimized the syscall away previously
in iob_send leave loop if we got a partial write
master
leitner 4 years ago
parent f84ff9a817
commit 45f99bbd0a

@ -5,6 +5,8 @@ void io_eagain(int64 d) {
if (e) { if (e) {
if (e->wantread) e->canread=0; if (e->wantread) e->canread=0;
if (e->wantwrite) e->canwrite=0; if (e->wantwrite) e->canwrite=0;
if (e->wantwrite && !e->kernelwantwrite)
io_wantwrite(d);
#if defined(HAVE_SIGIO) #if defined(HAVE_SIGIO)
if (d==alt_curread) { if (d==alt_curread) {
#if 0 #if 0

@ -4,6 +4,8 @@ void io_eagain_write(int64 d) {
io_entry* e=iarray_get(&io_fds,d); io_entry* e=iarray_get(&io_fds,d);
if (e) { if (e) {
e->canwrite=0; e->canwrite=0;
if (e->wantwrite && !e->kernelwantwrite)
io_wantwrite(d);
#if defined(HAVE_SIGIO) #if defined(HAVE_SIGIO)
if (d==alt_curwrite) { if (d==alt_curwrite) {
#if 0 #if 0

@ -286,13 +286,13 @@ eagain:
io_eagain_write(s); io_eagain_write(s);
return -1; return -1;
} }
sent = totalsent;
// fall through // fall through
} }
// actual error // actual error
break; break;
} }
// if we get here, we wrote it all // if we get here, we wrote it all or we got an EAGAIN after
// writing something. Treat as regular partial write.
sent = totalsent; sent = totalsent;
} else } else
sent=sendmsg(s,&msg,MSG_MORE|ZEROCOPY); sent=sendmsg(s,&msg,MSG_MORE|ZEROCOPY);
@ -354,6 +354,7 @@ eagain:
} }
} }
io_eagain_write(s); io_eagain_write(s);
return total;
} else break; } else break;
} }
abort: abort:

Loading…
Cancel
Save