Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When restarting avahi-daemon while CUPS is running, CUPS looses connection #4370

Closed
michaelrsweet opened this issue Feb 19, 2014 · 2 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.7.1
CUPS.org User: till.kamppeter

This is a follow-up to STR #4300

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.

Suggestion for a solution:

While making cups-browsed runnable on-demand on mobile devices I have found a way to allow avahi-daemon to restart and reconnect. See the section

How to Write a Client That Can Deal with Daemon Restarts

on

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

It is simply passing AVAHI_CLIENT_NO_FAIL to avahi_client_new(). With this I can run cups-browsed independent of avahi-daemon (not even important in which order avahi-daemon and cups-browsed are started), and whenever avahi-daemon is running, remote CUPS printers are detected and the appropriate local raw queues created and whenever avahi-daemon disappears, the local queues are taken down. The (re)connection with avahi-daemon (registering services in case of cupsd has to be done in the client callback function and so it happens automatically when avahi-daemon appears.

Perhaps one can use this also for cupsd.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"str4370.patch":

Index: scheduler/dirsvc.c

--- scheduler/dirsvc.c (revision 11597)
+++ scheduler/dirsvc.c (working copy)
@@ -193,8 +193,7 @@
{
int error; /* Error code, if any */

  •  DNSSDClient = avahi_client_new(avahi_threaded_poll_get(DNSSDMaster), 0,
    
  •                                 NULL, NULL, &error);
    
  •  DNSSDClient = avahi_client_new(avahi_threaded_poll_get(DNSSDMaster), AVAHI_CLIENT_NO_FAIL, NULL, NULL, &error);
    

    if (DNSSDClient == NULL)
    {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant