Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Fixes for IPv6 and multiple address records #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,24 @@ private void OnResolveReply(ServiceRef sdRef, ServiceFlags flags, uint interface

sd_ref.Process();
}

if (hostentry.AddressList != null)
{
ServiceResolvedEventHandler handler = Resolved;
if (handler != null)
{
handler(this, new ServiceResolvedEventArgs(this));
}
}
}

private void OnQueryRecordReply(ServiceRef sdRef, ServiceFlags flags, uint interfaceIndex,
ServiceError errorCode, string fullname, ServiceType rrtype, ServiceClass rrclass, ushort rdlen,
IntPtr rdata, uint ttl, IntPtr context)
{
switch(rrtype) {
case ServiceType.A:
case ServiceType.AAAA:
IPAddress address;

if(rdlen == 4) {
Expand Down Expand Up @@ -181,11 +191,6 @@ private void OnQueryRecordReply(ServiceRef sdRef, ServiceFlags flags, uint inter
hostentry.AddressList = new IPAddress [] { address };
}

ServiceResolvedEventHandler handler = Resolved;
if(handler != null) {
handler(this, new ServiceResolvedEventArgs(this));
}

break;
case ServiceType.TXT:
if(TxtRecord != null) {
Expand All @@ -197,8 +202,11 @@ private void OnQueryRecordReply(ServiceRef sdRef, ServiceFlags flags, uint inter
default:
break;
}

sdRef.Deallocate();

if ((flags & ServiceFlags.MoreComing) != ServiceFlags.MoreComing)
{
sdRef.Deallocate();
}
}

public bool IsResolved {
Expand Down