- FD_ZERO(&cr);
- FD_SET(udpfd, &cr);
- FD_SET(tunfd, &cr);
- FD_SET(controlfd, &cr);
- FD_SET(clifd, &cr);
- if (cluster_sockfd) FD_SET(cluster_sockfd, &cr);
- cn = udpfd;
- if (cn < tunfd) cn = tunfd;
- if (cn < controlfd) cn = controlfd;
- if (cn < clifd) cn = clifd;
- if (cn < cluster_sockfd) cn = cluster_sockfd;
- for (i = 0; i < config->num_radfds; i++)
- {
- if (!radfds[i]) continue;
- FD_SET(radfds[i], &cr);
- if (radfds[i] > cn)
- cn = radfds[i];
- }
+ FD_ZERO(&readset);
+ FD_SET(udpfd, &readset);
+ FD_SET(tunfd, &readset);
+ FD_SET(controlfd, &readset);
+ FD_SET(clifd, &readset);
+ if (cluster_sockfd) FD_SET(cluster_sockfd, &readset);
+ readset_n = udpfd;
+ if (tunfd > readset_n) readset_n = tunfd;
+ if (controlfd > readset_n) readset_n = controlfd;
+ if (clifd > readset_n) readset_n = clifd;
+ if (cluster_sockfd > readset_n) readset_n = cluster_sockfd;