76 {
77 if (is_shutdown_.load()) {
78 return false;
79 }
80
81 if (info == nullptr) {
83 return false;
84 }
85
86 struct pollfd fds;
87 fds.fd = listen_fd_;
88 fds.events = POLLIN;
89 int ready_num = poll(&fds, 1, timeout_ms);
90 if (ready_num > 0) {
91 char buf[32] = {0};
92 ssize_t nbytes = recvfrom(listen_fd_, buf, 32, 0, nullptr, nullptr);
93 if (nbytes == -1) {
94 AERROR <<
"fail to recvfrom, " << strerror(errno);
95 return false;
96 }
97 return info->DeserializeFrom(buf, nbytes);
98 } else if (ready_num == 0) {
99 ADEBUG <<
"timeout, no readableinfo.";
100 } else {
101 if (errno == EINTR) {
102 AINFO <<
"poll was interrupted.";
103 } else {
104 AERROR <<
"fail to poll, " << strerror(errno);
105 }
106 }
107 return false;
108}