By the way, I checked with wireshark and [NSHost currentHost] sends 3 pairs
(IPv4 and IPv6) MDNS (multicast DNS used by Bonjour) PTR queries for the
IPv6 address and waits for response until it times out. This really isn't a
good method to be called by gdk_display_get_name() which could actually
return arbitrary string because unlike X11 there will never be more
displays.

By the way I noticed there's also g_get_host_name() which is a more
user-friendly way to call gethostname().

Jiri

On Wed, Feb 15, 2017 at 10:33 PM, Jiří Techet <tec...@gmail.com> wrote:

> Hi,
>
> after switching to macOS Sierra I (and another user) noticed that Geany
> whose OS X port I maintain starts significantly slower:
>
> https://github.com/geany/geany/issues/1277
>
> After some debugging it turns out it's the gdk_display_get_name() call
> which takes several seconds to complete. This function just returns [NSHost
> currentHost]; according to Apple documentation
>
> https://developer.apple.com/reference/foundation/nshost/
> 1408946-currenthost
>
> the function can block for several seconds, depending on user's
> configuration. I found some more mentions of this behaviour, e.g.
>
> http://secure.macscripter.net/viewtopic.php?id=45309
>
> Interestingly, simple unix gethostname() as used in Apple's implementation
> of the hostname command
>
> https://opensource.apple.com/source/shell_cmds/shell_cmds-
> 81.1/hostname/hostname.c
>
> returns immediately (at least for me). Would it be OK to use gethostname()
> in gdk_display_get_name()? Is there some specific reason why [NSHost
> currentHost] is used?
>
> Cheers,
>
> Jiri
>
_______________________________________________
Gtk-osx-users-list mailing list
Gtk-osx-users-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-osx-users-list

Reply via email to