1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

s3: Eliminate sys_select from do_smb_browse() -- untested

This commit is contained in:
Volker Lendecke 2011-02-07 17:17:26 +01:00 committed by Volker Lendecke
parent 89d81b310e
commit b28a2e519a

View File

@ -23,6 +23,7 @@
#ifdef WITH_DNSSD_SUPPORT #ifdef WITH_DNSSD_SUPPORT
#include <dns_sd.h> #include <dns_sd.h>
#include "system/select.h"
/* Holds service instances found during DNS browse */ /* Holds service instances found during DNS browse */
struct mdns_smbsrv_result struct mdns_smbsrv_result
@ -155,7 +156,6 @@ int do_smb_browse(void)
int mdnsfd; int mdnsfd;
int fdsetsz; int fdsetsz;
int ret; int ret;
fd_set *fdset = NULL;
struct mdns_browse_state bstate; struct mdns_browse_state bstate;
struct mdns_smbsrv_result *resptr; struct mdns_smbsrv_result *resptr;
struct timeval tv; struct timeval tv;
@ -177,24 +177,14 @@ int do_smb_browse(void)
mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref); mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref);
for (;;) { for (;;) {
if (fdset != NULL) { int revents;
TALLOC_FREE(fdset);
}
fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask); ret = poll_one_fd(mdnsfd, POLLIN|POLLHUP, &revents, 1000);
fdset = TALLOC_ZERO(ctx, fdsetsz);
FD_SET(mdnsfd, fdset);
tv.tv_sec = 1;
tv.tv_usec = 0;
/* Wait until response received from mDNS daemon */
ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv);
if (ret <= 0 && errno != EINTR) { if (ret <= 0 && errno != EINTR) {
break; break;
} }
if (FD_ISSET(mdnsfd, fdset)) { if (revents & (POLLIN|POLLHUP|POLLERR)) {
/* Invoke callback function */ /* Invoke callback function */
if (DNSServiceProcessResult(mdns_conn_sdref)) { if (DNSServiceProcessResult(mdns_conn_sdref)) {
break; break;