namespace Avahi
{
internal delegate void ServiceBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
namespace Avahi
{
internal delegate void ServiceBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, IntPtr type, IntPtr domain, IntPtr userdata);
+ IntPtr name, IntPtr type, IntPtr domain, LookupResultFlags flags,
+ IntPtr userdata);
public static ServiceInfo Zero = new ServiceInfo ();
}
public delegate void ServiceInfoHandler (object o, ServiceInfo info);
public static ServiceInfo Zero = new ServiceInfo ();
}
public delegate void ServiceInfoHandler (object o, ServiceInfo info);
[DllImport ("avahi-client")]
private static extern IntPtr avahi_service_browser_new (IntPtr client, int iface, int proto, IntPtr type,
[DllImport ("avahi-client")]
private static extern IntPtr avahi_service_browser_new (IntPtr client, int iface, int proto, IntPtr type,
- IntPtr domain, ServiceBrowserCallback cb,
+ IntPtr domain, LookupFlags flags,
+ ServiceBrowserCallback cb,
}
public ServiceBrowser (Client client, string type, string domain) : this (client, -1, Protocol.Unspecified,
}
public ServiceBrowser (Client client, string type, string domain) : this (client, -1, Protocol.Unspecified,
- public ServiceBrowser (Client client, int iface, Protocol proto, string type, string domain)
+ public ServiceBrowser (Client client, int iface, Protocol proto, string type, string domain, LookupFlags flags)
- handle = avahi_service_browser_new (client.Handle, iface, (int) proto, typePtr, domainPtr,
- cb, IntPtr.Zero);
+
+ lock (client) {
+ handle = avahi_service_browser_new (client.Handle, iface, (int) proto, typePtr, domainPtr, flags,
+ cb, IntPtr.Zero);
+ }
- if (handle != IntPtr.Zero && (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
- avahi_service_browser_free (handle);
- handle = IntPtr.Zero;
+ if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
+ (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
+
+ lock (client) {
+ avahi_service_browser_free (handle);
+ handle = IntPtr.Zero;
+ }
}
}
private void OnServiceBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
}
}
private void OnServiceBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, IntPtr type, IntPtr domain, IntPtr userdata)
+ IntPtr name, IntPtr type, IntPtr domain, LookupResultFlags flags,
+ IntPtr userdata)