[avahi] [PATCH] Avahi support for gnome-games

Lennart Poettering lennart at poettering.net
Wed Feb 15 14:50:05 PST 2006


On Wed, 15.02.06 22:04, Daniel S. Haischt (me at daniel.stefan.haischt.name) wrote:

> Hello,
> 
> I just did finish a patch which adds Avahi support to
> gnome-games. Can someone be so kind to review the patch.
> 
> The following games are Zeroconf capable:
> 
>  * Iagno (Reversi)
>  * Gnibbles
> 
> The code is using the glib integration stuff. At the
> time it seems that I am having some threading issues,
> because the network game dialog won't be displayed.
> 
> It was once working today, but right now I don't see
> what I did change which may cause a threading issue...

Threads? The gnome games use thread? Why's that?

Some issues:

When the entry group enters AVAHI_ENTRY_GROUP_FAILURE state you free
the glib main loop adapater, but don't free the AvahiClient
object. Thus, AvahiClient stills has a reference to the no longer
existant AvahiGlibPoll object. This is a memory corruption bug. Same
is true when when entering the fail label in create_services() and
similarly in client_callback(), ganmes_browse().

What is this?
     
     mtype = g_strdup_printf ("_%s%s", game_port,  NETWORK_ZEROCONF_TYPE);

The service type is a concatination of the port number and a string?
This looks very suspicous to me!

It's a good idea to inform the user about the exact cause why an
operation failed. Use avahi_strerror(avahi_client_errno(client)) to
get a human readable string.

The last NULL in your avahi_entry_group_add_service() call is
superfluous and passing "test=blah" as TXT record is probably not a
good idea in real world apps.

You start your on main loop, and after it terminated you call
games_start_server()? That doesn't look right to me! The GLIB main
loop is run by the app itself, there shouldn't be a need to create
your own!

Lennart

-- 
Lennart Poettering; lennart [at] poettering [dot] net
ICQ# 11060553; GPG 0x1A015CC4; http://0pointer.net/lennart/


More information about the avahi mailing list