socket: handle hangup after input but before output

poll may return POLLIN|POLLHUP and wicked didn't read the last data chunk then