handle read error in user socket adapter
@@ -73,14 +73,20 @@ static void connection_input(heap h, descriptor f, descriptor e, buffer_handler
{
buffer b = allocate_buffer(h, 512);
b->end = read(f, b->contents, b->length);
+
+ if (b->end == -1) {
+ rprintf("read err %E\n", errno);
+ }
// this should have been taken care of by EPOLLHUP, but the
// kernel doesn't support it
- if (!b->end) {
+ if (b->end == 0) {
epoll_ctl(e, EPOLL_CTL_DEL, f, 0);
close(f);
- }
+ apply(p, 0);
+ } else {
apply(p, b);
}
+}
static CLOSURE_1_1(connection_output, void, descriptor, buffer);
