- if (dht_socket >= 0 && FD_ISSET(dht_socket, &readfds)) {
- rc = recvfrom(dht_socket, buf, 1536, 0, source, &sourcelen);
- } else if (dht_socket6 >= 0 && FD_ISSET(dht_socket6, &readfds)) {
- rc = recvfrom(dht_socket6, buf, 1536, 0, source, &sourcelen);
+ if (fds[0].revents != 0) {
+ if ((fds[0].revents & (POLLERR | POLLNVAL)) > 0) {
+ fprintf(stderr, "error in fds[0]");
+ rc = -1;
+ } else {
+ rc = recvfrom(dht_socket, buf, 1536, 0, source, &sourcelen);
+ }
+ } else if (fds[1].revents != 0) {
+ if ((fds[1].revents & (POLLERR | POLLNVAL)) > 0) {
+ fprintf(stderr, "error in fds[1]");
+ rc = -1;
+ } else {
+ rc = recvfrom(dht_socket6, buf, 1536, 0, source, &sourcelen);
+ };