2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

FD_ZERO/SET must be done everytime before select().

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@264 e5f2f494-b856-4b98-b285-d166d9295462
This commit is contained in:
JINMEI Tatuya 2009-10-30 22:34:59 +00:00
parent 271fc481f9
commit 858bd245a9

View File

@ -79,12 +79,12 @@ main(int argc, char* argv[]) {
int ss = session.getSocket(); int ss = session.getSocket();
int nfds = max(ps, ss) + 1; int nfds = max(ps, ss) + 1;
FD_ZERO(&fds);
FD_SET(ps, &fds);
FD_SET(ss, &fds);
cout << "server running" << endl; cout << "server running" << endl;
while (true) { while (true) {
FD_ZERO(&fds);
FD_SET(ps, &fds);
FD_SET(ss, &fds);
int n = select(nfds, &fds, NULL, NULL, NULL); int n = select(nfds, &fds, NULL, NULL, NULL);
if (n < 0) if (n < 0)
throw FatalError("select error"); throw FatalError("select error");