s3: Eliminate sys_select from do_smb_resolve() -- untested
authorVolker Lendecke <vl@samba.org>
Mon, 7 Feb 2011 16:19:03 +0000 (17:19 +0100)
committerVolker Lendecke <vlendec@samba.org>
Mon, 28 Feb 2011 15:40:20 +0000 (16:40 +0100)
source3/client/dnsbrowse.c

index c62f27beeaa622da6461ee592e0257996a9a1bb4..c252b25343806a99eab3501437398a201a56b2f2 100644 (file)
@@ -61,7 +61,6 @@ static void do_smb_resolve(struct mdns_smbsrv_result *browsesrv)
        int mdnsfd;
        int fdsetsz;
        int ret;
        int mdnsfd;
        int fdsetsz;
        int ret;
-       fd_set *fdset = NULL;
        struct timeval tv;
        DNSServiceErrorType err;
 
        struct timeval tv;
        DNSServiceErrorType err;
 
@@ -78,24 +77,14 @@ static void do_smb_resolve(struct mdns_smbsrv_result *browsesrv)
 
        mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref);
        for (;;)  {
 
        mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref);
        for (;;)  {
-               if (fdset != NULL) {
-                       TALLOC_FREE(fdset);
-               }
-
-               fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask);
-               fdset = TALLOC_ZERO(ctx, fdsetsz);
-               FD_SET(mdnsfd, fdset);
-
-               tv.tv_sec = 1;
-               tv.tv_usec = 0;
+               int revents;
 
 
-               /* Wait until response received from mDNS daemon */
-               ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv);
+               ret = poll_one_fd(mdnsfd, POLLIN|POLLHUP, 1000, &revents);
                if (ret <= 0 && errno != EINTR) {
                        break;
                }
 
                if (ret <= 0 && errno != EINTR) {
                        break;
                }
 
-               if (FD_ISSET(mdnsfd, fdset)) {
+               if (revents & (POLLIN|POLLHUP|POLLERR)) {
                        /* Invoke callback function */
                        DNSServiceProcessResult(mdns_conn_sdref);
                        break;
                        /* Invoke callback function */
                        DNSServiceProcessResult(mdns_conn_sdref);
                        break;