| 54 | // Check poll's return and validate against the passed function. |
| 55 | template <typename Func> |
| 56 | bool |
| 57 | poll_on_socket(Func &&check_poll_return, std::chrono::milliseconds timeout, int fd) |
| 58 | { |
| 59 | struct pollfd poll_fd; |
| 60 | poll_fd.fd = fd; |
| 61 | poll_fd.events = POLLIN; // when data is ready. |
| 62 | int poll_ret; |
| 63 | do { |
| 64 | poll_ret = poll(&poll_fd, 1, timeout.count()); |
| 65 | } while (check_poll_return(poll_ret)); |
| 66 | |
| 67 | if (!(poll_fd.revents & POLLIN)) { |
| 68 | return false; |
| 69 | } |
| 70 | return true; |
| 71 | } |
| 72 | |
| 73 | static bool |
| 74 | has_peereid() |
no test coverage detected