Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions iocore/net/UnixNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,17 @@ write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
if (s->vio.ntodo() <= 0) {
write_signal_done(VC_EVENT_WRITE_COMPLETE, nh, vc);
return;
} else if (signalled && (wbe_event != vc->write_buffer_empty_event)) {
}
int e = 0;
if (!signalled) {
e = VC_EVENT_WRITE_READY;
} else if (wbe_event != vc->write_buffer_empty_event) {
// @a signalled means we won't send an event, and the event values differing means we
// had a write buffer trap and cleared it, so we need to send it now.
if (write_signal_and_update(wbe_event, vc) != EVENT_CONT)
return;
} else if (!signalled) {
if (write_signal_and_update(VC_EVENT_WRITE_READY, vc) != EVENT_CONT) {
e = wbe_event;
}
if (e) {
if (write_signal_and_update(e, vc) != EVENT_CONT) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a bit to understand the point of this tidying up. But looking back at the bug description, this rearrangement stops the early return which would miss the lock change detection. So that makes sense.

return;
}

Expand All @@ -573,17 +577,18 @@ write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
}
}

if (!buf.reader()->read_avail()) {
if ((needs & EVENTIO_READ) == EVENTIO_READ) {
read_reschedule(nh, vc);
}

if (!(buf.reader()->is_read_avail_more_than(0))) {
write_disable(nh, vc);
return;
}

if ((needs & EVENTIO_WRITE) == EVENTIO_WRITE) {
write_reschedule(nh, vc);
}
if ((needs & EVENTIO_READ) == EVENTIO_READ) {
read_reschedule(nh, vc);
}
return;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving up the read enable check looks good.

}
}
Expand Down