Changeset 740 for vendor/current/source3/client/dnsbrowse.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/client/dnsbrowse.c
r591 r740 24 24 25 25 #include <dns_sd.h> 26 #include "system/select.h" 26 27 27 28 /* Holds service instances found during DNS browse */ … … 61 62 int fdsetsz; 62 63 int ret; 63 fd_set *fdset = NULL;64 64 struct timeval tv; 65 65 DNSServiceErrorType err; … … 78 78 mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref); 79 79 for (;;) { 80 if (fdset != NULL) { 81 TALLOC_FREE(fdset); 82 } 83 84 if (mdnsfd < 0 || mdnsfd >= FD_SETSIZE) { 85 errno = EBADF; 86 break; 87 } 88 89 fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask); 90 fdset = TALLOC_ZERO(ctx, fdsetsz); 91 FD_SET(mdnsfd, fdset); 92 93 tv.tv_sec = 1; 94 tv.tv_usec = 0; 95 96 /* Wait until response received from mDNS daemon */ 97 ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv); 80 int revents; 81 82 ret = poll_one_fd(mdnsfd, POLLIN|POLLHUP, 1000, &revents); 98 83 if (ret <= 0 && errno != EINTR) { 99 84 break; 100 85 } 101 86 102 if ( FD_ISSET(mdnsfd, fdset)) {87 if (revents & (POLLIN|POLLHUP|POLLERR)) { 103 88 /* Invoke callback function */ 104 89 DNSServiceProcessResult(mdns_conn_sdref); … … 161 146 int fdsetsz; 162 147 int ret; 163 fd_set *fdset = NULL;164 148 struct mdns_browse_state bstate; 165 149 struct mdns_smbsrv_result *resptr; … … 183 167 mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref); 184 168 for (;;) { 185 if (fdset != NULL) { 186 TALLOC_FREE(fdset); 187 } 188 189 if (mdnsfd < 0 || mdnsfd >= FD_SETSIZE) { 190 errno = EBADF; 191 TALLOC_FREE(ctx); 192 return 1; 193 } 194 195 fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask); 196 fdset = TALLOC_ZERO(ctx, fdsetsz); 197 FD_SET(mdnsfd, fdset); 198 199 tv.tv_sec = 1; 200 tv.tv_usec = 0; 201 202 /* Wait until response received from mDNS daemon */ 203 ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv); 169 int revents; 170 171 ret = poll_one_fd(mdnsfd, POLLIN|POLLHUP, &revents, 1000); 204 172 if (ret <= 0 && errno != EINTR) { 205 173 break; 206 174 } 207 175 208 if ( FD_ISSET(mdnsfd, fdset)) {176 if (revents & (POLLIN|POLLHUP|POLLERR)) { 209 177 /* Invoke callback function */ 210 178 if (DNSServiceProcessResult(mdns_conn_sdref)) {
Note:
See TracChangeset
for help on using the changeset viewer.