diff options
Diffstat (limited to 'avahi-sharp/AddressResolver.cs')
-rw-r--r-- | avahi-sharp/AddressResolver.cs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/avahi-sharp/AddressResolver.cs b/avahi-sharp/AddressResolver.cs index 038b0c9..01211ae 100644 --- a/avahi-sharp/AddressResolver.cs +++ b/avahi-sharp/AddressResolver.cs @@ -34,7 +34,7 @@ namespace Avahi public delegate void HostAddressHandler (object o, string host, IPAddress address); - public class AddressResolver : IDisposable + public class AddressResolver : ResolverBase, IDisposable { private IntPtr handle; private Client client; @@ -150,18 +150,24 @@ namespace Avahi ResolverEvent revent, Protocol aproto, IntPtr address, IntPtr hostname, LookupResultFlags flags, IntPtr userdata) { - if (revent == ResolverEvent.Found) { + switch (revent) { + case ResolverEvent.Found: currentAddress = Utility.PtrToAddress (address); currentHost = Utility.PtrToString (hostname); foreach (HostAddressHandler handler in foundListeners) handler (this, currentHost, currentAddress); - } else { + break; + case ResolverEvent.Timeout: currentAddress = null; currentHost = null; foreach (EventHandler handler in timeoutListeners) handler (this, new EventArgs ()); + break; + default: + EmitResolverEvent (revent); + break; } } } |