summaryrefslogtreecommitdiff
path: root/lib/ZRetSubs.c
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1988-07-08 06:17:10 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1988-07-08 06:17:10 +0000
commitcd8947b75038d28d16095c6f3a5b7e6fb3c0e6fe (patch)
tree302cd138bf5d41607a7d7d9750bb199d43478e29 /lib/ZRetSubs.c
parentc68b027989b2280657640b607abb2d5dd96885d2 (diff)
more intelligent select()
Diffstat (limited to 'lib/ZRetSubs.c')
-rw-r--r--lib/ZRetSubs.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ZRetSubs.c b/lib/ZRetSubs.c
index dabf9b9..9af736d 100644
--- a/lib/ZRetSubs.c
+++ b/lib/ZRetSubs.c
@@ -64,7 +64,8 @@ static Code_t Z_RetSubs(notice, nsubs)
register int i;
ZNotice_t retnotice;
char *ptr,*end,*ptr2;
- fd_set read, write, except;
+ fd_set read, setup;
+ int nfds;
struct timeval tv;
int gotone;
@@ -92,14 +93,23 @@ static Code_t Z_RetSubs(notice, nsubs)
gimmeack = 0;
__subscriptions_list = (ZSubscription_t *) 0;
+ FD_ZERO(&setup);
+ FD_SET(ZGetFD(), &setup);
+ nfds = ZGetFD() + 1;
+
while (!nrecv || !gimmeack) {
tv.tv_sec = 0;
tv.tv_usec = 500000;
for (i=0;i<HM_TIMEOUT*2;i++) { /* 30 secs in 1/2 sec
intervals */
gotone = 0;
- if (select(0, &read, &write, &except, &tv) < 0)
+ read = setup;
+ if (select(nfds, &read, (fd_set *) 0,
+ (fd_set *) 0, &tv) < 0)
return (errno);
+ if (FD_ISSET(ZGetFD(), &read))
+ i--; /* make sure we time out the
+ full 30 secs */
retval = ZCheckIfNotice(&retnotice,
(struct sockaddr_in *)0,
ZCompareMultiUIDPred,