/// <summary> /// Stops the currently running search or resolution. /// </summary> public void Stop() { TeardownWatchSocket(serviceHandle); if (serviceHandle != IntPtr.Zero) { mDNSImports.DNSServiceRefDeallocate(serviceHandle); serviceHandle = IntPtr.Zero; } browseReplyCb = null; domainSearchReplyCb = null; }
private void SearchForDomains(DNSServiceFlags flags) { Stop(); domainSearchReplyCb = new mDNSImports.DNSServiceDomainEnumReply(DomainSearchReply); DNSServiceErrorType err = mDNSImports.DNSServiceEnumerateDomains(out serviceHandle, flags, 0, domainSearchReplyCb, IntPtr.Zero); if (err != DNSServiceErrorType.NoError) { throw new DNSServiceException("DNSServiceEnumerateDomains", err); } SetupWatchSocket(serviceHandle); }
private void SearchForDomains(DNSServiceFlags flags) { Stop(); domainSearchReplyCb = new mDNSImports.DNSServiceDomainEnumReply(DomainSearchReply); gchSelf = GCHandle.Alloc(this); DNSServiceErrorType err; err = mDNSImports.DNSServiceEnumerateDomains(out sdRef, flags, 0, domainSearchReplyCb, (IntPtr)gchSelf); if (err != DNSServiceErrorType.kDNSServiceErr_NoError) { throw new DNSServiceException("DNSServiceEnumerateDomains", err); } SetupWatchSocket(); }
/// <summary> /// Stops the currently running search or resolution. /// </summary> public void Stop() { /* FIXME: do i need to stop the poll? ... */ if (sdRef != IntPtr.Zero) { mDNSImports.DNSServiceRefDeallocate(sdRef); sdRef = IntPtr.Zero; } WaitStop(); browseReplyCb = null; /* garbage collected */ domainSearchReplyCb = null; if (gchSelf.IsAllocated) { gchSelf.Free(); } }