X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-sharp%2FRecordBrowser.cs;h=f65f8ac17b0f89fa14f45bedf501cc811b5feefe;hb=7862fd0cb20eed204be336d050dd9c4e72528d62;hp=5a736bd3d13b284198e8b08cd693369b716da603;hpb=84a9392791c574c56ca148157b8b951851208398;p=catta diff --git a/avahi-sharp/RecordBrowser.cs b/avahi-sharp/RecordBrowser.cs index 5a736bd..f65f8ac 100644 --- a/avahi-sharp/RecordBrowser.cs +++ b/avahi-sharp/RecordBrowser.cs @@ -23,6 +23,7 @@ using System; using System.Net; using System.Collections; using System.Runtime.InteropServices; +using System.Text; namespace Avahi { @@ -93,7 +94,7 @@ namespace Avahi [DllImport ("avahi-client")] private static extern IntPtr avahi_record_browser_new (IntPtr client, int iface, Protocol proto, - IntPtr name, ushort clazz, ushort type, + byte[] name, ushort clazz, ushort type, LookupFlags flags, RecordBrowserCallback cb, IntPtr userdata); @@ -164,14 +165,13 @@ namespace Avahi (addListeners.Count == 0 && removeListeners.Count == 0)) return; - IntPtr namePtr = Utility.StringToPtr (name); - lock (client) { - handle = avahi_record_browser_new (client.Handle, iface, proto, namePtr, (ushort) clazz, (ushort) type, - flags, cb, IntPtr.Zero); - } + handle = avahi_record_browser_new (client.Handle, iface, proto, Utility.StringToBytes (name), + (ushort) clazz, (ushort) type, flags, cb, IntPtr.Zero); - Utility.Free (namePtr); + if (handle == IntPtr.Zero) + client.ThrowError (); + } } private void Stop (bool force)