[cups-devel] [UNKN] STR #4373: When restarting avahi-daemon while CUPS is running, CUPS looses connection

till.kamppeter at gmail.com till.kamppeter at gmail.com
Sun Feb 23 03:53:36 PST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

This is a follow-up to STR #4300 and STR #4370

Original issue:

I use CUPS with shared printers and the shared printers are broadcasted by
Avahi. This works well when avahi-daemon is started before cups and both
keep running. But if I restart avahi-daemon while CUPS is running, CUPS
looses connection to avahi-daemon and so stops broadcasting. What I expect
is that CUPS reconnects after the restart of avahi-daemon. This can easily
happen if for example the avahi-daemon package gets updated or the admin
changes the configuration of avahi-daemon.

Solution (patch for CUPS 1.7.1 attached):

Unfortunately, your one-line fix of STR #4370 does not work. First, the
printer registration has to be done only when avahi-daemon actually appears
and if avahi-daemon disappears, the Avahi client has to be freed and
renewed to be ready for the next time of avahi-daemon appearing. This is
done withing the client callback function of the avahi client, which is
called whenever avahi-daemon changes state. See the section

How to Write a Client That Can Deal with Daemon Restarts

on

http://avahi.sourcearchive.com/documentation/0.6.17/main.html

The patch does exactly this when built with HAVE_AVAHI and it does exactly
tghe same as before with HAVE_DNSSD or without DNS-SD support. Also the
cupsd-internal API (for the other files of cupsd) is unchanged to make the
patch as minimum-invasive as possible.

I have tested the patch with starting and stopping the local avahi-daemon
and starting and stopping cupsd on remote CUPS servers in different orders,
also both with and without presence of cups-browsed and everything works as
expected now.

Link: https://www.cups.org/str.php?L4373
Version: 1.7.1
Attachment: https://www.cups.org/strfiles/4373/cupsd-support-avahi-daemon-restarting.patch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJTCeFAAAoJENujp6sI12IjHfAP/3ll4ey6jQooRM5I5Iww3nNl
SQs3/9utuvnsxyj5pbUv8+G7qZ3qyqlkbjlbYcmkZhZxDIKU0DIaim4GClW2we73
H5vFVNDsGfI/NRyTbb41cvKs0e/h0blCWu3OmgBaruGU+rj2VO7Oe9qvHcqkN6D8
VhkzVomBzhoTF19NvlDdtCcTMxMwYJzkbUzW+K9xco/gCO1W1gq2aGoUQkXLcoEb
RCdgRiI9atbxz3zbLzibzAPvqvYDomXJchUOZtxDvdhlVfH1O0qOJC6zeaJl51ET
J1FGMNzKiwJyLO7zW8yvlSoxSWQlRrh3CvfAJUXYz13CtiIGczNZJrP9CTQJ77W8
kzwlbVRUPKQ7Zt/KoWe1tpoWUNVRzyVV7+w7QqNTQenBi5LrcTSU9rg/ZxfUKC6e
a07FkG1iJ0VYybFPG9HDF1Znte9GEERULyTUHswn3GOD4k4zCu7geGCKFEVz8da+
56P+pkSr8PCH0LdD/CBrw1VZOFWkevKDPqCCScNi4bH5BAU+l5b2bLt9XKNTDe4q
/TYgSt+LzfAZWXRHKV63HU+HBwjSRyZfDOfiTQ6dacPL8X1gLlLgIOItyj8GrrsD
/1ialb8V2VlXiOHUpzYos5Wl0Y4J3d2NnaCN0rNCuFkOTf9aEEJdoY7QjwcZYiu3
GY5phW1poQBuI4iYAKjq
=LFX/
-----END PGP SIGNATURE-----




More information about the cups mailing list