mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
s3: Eliminate sys_select from do_smb_resolve() -- untested
This commit is contained in:
parent
b28a2e519a
commit
5b26cfe143
@ -61,7 +61,6 @@ static void do_smb_resolve(struct mdns_smbsrv_result *browsesrv)
|
|||||||
int mdnsfd;
|
int mdnsfd;
|
||||||
int fdsetsz;
|
int fdsetsz;
|
||||||
int ret;
|
int ret;
|
||||||
fd_set *fdset = NULL;
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
DNSServiceErrorType err;
|
DNSServiceErrorType err;
|
||||||
|
|
||||||
@ -78,24 +77,14 @@ static void do_smb_resolve(struct mdns_smbsrv_result *browsesrv)
|
|||||||
|
|
||||||
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, 1000, &revents);
|
||||||
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 */
|
||||||
DNSServiceProcessResult(mdns_conn_sdref);
|
DNSServiceProcessResult(mdns_conn_sdref);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user