* We don't expect to get here, as we marked it with skipping posting a * CQE if it was successful. If it does trigger, than means it fails and * that our close has not been done. Log the shutdown error and issue a new * separate close. */
| 1743 | * separate close. |
| 1744 | */ |
| 1745 | static int handle_shutdown(struct io_uring *ring, struct io_uring_cqe *cqe) |
| 1746 | { |
| 1747 | struct conn *c = cqe_to_conn(cqe); |
| 1748 | struct io_uring_sqe *sqe; |
| 1749 | int fd = cqe_to_fd(cqe); |
| 1750 | |
| 1751 | fprintf(stderr, "Got shutdown notification on fd %d\n", fd); |
| 1752 | |
| 1753 | if (!cqe->res) |
| 1754 | fprintf(stderr, "Unexpected success shutdown CQE\n"); |
| 1755 | else if (cqe->res < 0) |
| 1756 | fprintf(stderr, "Shutdown got %s\n", strerror(-cqe->res)); |
| 1757 | |
| 1758 | sqe = get_sqe(ring); |
| 1759 | if (fixed_files) |
| 1760 | io_uring_prep_close_direct(sqe, fd); |
| 1761 | else |
| 1762 | io_uring_prep_close(sqe, fd); |
| 1763 | encode_userdata(sqe, c, __CLOSE, 0, fd); |
| 1764 | return 0; |
| 1765 | } |
| 1766 | |
| 1767 | /* |
| 1768 | * Final stage of a connection, the shutdown and close has finished. Mark |
no test coverage detected