From b3020062dacf5e2d9a7a67dc138c354f36aea373 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20Salvet?= Date: Thu, 11 May 2006 15:53:24 +0000 Subject: [PATCH] Use poll() instead of select() in order to allow high fd numbers. --- org.glite.lb.client/src/notification.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/org.glite.lb.client/src/notification.c b/org.glite.lb.client/src/notification.c index a9fe57b..c9d8579 100644 --- a/org.glite.lb.client/src/notification.c +++ b/org.glite.lb.client/src/notification.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "glite/security/glite_gss.h" #include "glite/lb/notification.h" @@ -707,7 +708,7 @@ err: #endif /* NotifReceive */ { - fd_set fds; + struct pollfd pollfds[1]; struct sockaddr_in a; int recv_sock, alen; edg_wll_Event *event = NULL; @@ -731,8 +732,8 @@ err: } } - FD_ZERO(&fds); - FD_SET(fd,&fds); + pollfds[0].fd = fd; + pollfds[0].events = POLLIN; tv.tv_sec = timeout->tv_sec; tv.tv_usec = timeout->tv_usec; @@ -750,14 +751,18 @@ select: if (ctx->connPoolNotif[0].gss.context == GSS_C_NO_CONTEXT) { int ret; - switch(select(fd+1, &fds, NULL, NULL, &tv)) { + switch(poll(pollfds, 1, tv.tv_sec*1000+tv.tv_usec/1000)) { case -1: - edg_wll_SetError(ctx, errno, "select() failed"); + edg_wll_SetError(ctx, errno, "edg_wll_NotifReceive: poll() failed"); goto err; case 0: - edg_wll_SetError(ctx, ETIMEDOUT, "select() timeouted"); + edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive: poll() timed out"); goto err; default: + if (!(pollfds[0].revents & POLLIN)) { + edg_wll_SetError(ctx, errno, "edg_wll_NotifReceive: error on filedescriptor"); + goto err; + } break; } -- 1.8.2.3