diff options
author | jlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2006-07-20 22:59:35 +0000 |
---|---|---|
committer | jlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2006-07-20 22:59:35 +0000 |
commit | 8ca02f3c0539293422509d03219786fb6d7db48b (patch) | |
tree | 20bd0e2739f7c6cadc7c70be3831505d59466e08 /scheduler/subscriptions.c | |
parent | f7faf1f5c3235dfa4f883522da7dc6446f028247 (diff) | |
download | cups-8ca02f3c0539293422509d03219786fb6d7db48b.tar.gz |
Load cups into easysw/current.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@194 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'scheduler/subscriptions.c')
-rw-r--r-- | scheduler/subscriptions.c | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/scheduler/subscriptions.c b/scheduler/subscriptions.c index 428841306..f27c48ff4 100644 --- a/scheduler/subscriptions.c +++ b/scheduler/subscriptions.c @@ -1,5 +1,5 @@ /* - * "$Id: subscriptions.c 5673 2006-06-16 21:04:45Z mike $" + * "$Id: subscriptions.c 5716 2006-07-11 17:56:57Z mike $" * * Subscription routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -89,6 +89,11 @@ cupsdAddEvent( cupsd_subscription_t *sub; /* Current subscription */ + cupsdLogMessage(CUPSD_LOG_DEBUG2, + "cupsdAddEvent(event=%s, dest=%p(%s), job=%p(%d), text=\"%s\", ...)", + cupsdEventName(event), dest, dest ? dest->name : "", + job, job ? job->id : 0, text); + /* * Keep track of events with any OS-supplied notification mechanisms... */ @@ -284,13 +289,13 @@ cupsdAddEvent( ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER, "job-impressions-completed", job->sheets ? job->sheets->values[0].integer : 0); + } - /* - * Send the notification for this subscription... - */ + /* + * Send the notification for this subscription... + */ - cupsd_send_notification(sub, temp); - } + cupsd_send_notification(sub, temp); } } @@ -1379,7 +1384,7 @@ cupsd_send_notification( ipp_state_t state; /* IPP event state */ - cupsdLogMessage(CUPSD_LOG_DEBUG, + cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsd_send_notification(sub=%p(%d), event=%p(%s))\n", sub, sub->id, event, cupsdEventName(event->event)); @@ -1435,13 +1440,16 @@ cupsd_send_notification( if (sub->recipient) { - if (sub->pipe < 0) - cupsd_start_notifier(sub); + for (;;) + { + if (sub->pipe < 0) + cupsd_start_notifier(sub); - cupsdLogMessage(CUPSD_LOG_DEBUG, "sub->pipe=%d", sub->pipe); + cupsdLogMessage(CUPSD_LOG_DEBUG2, "sub->pipe=%d", sub->pipe); + + if (sub->pipe < 0) + break; - if (sub->pipe >= 0) - { event->attrs->state = IPP_IDLE; while ((state = ippWriteFile(sub->pipe, event->attrs)) != IPP_DATA) @@ -1449,9 +1457,34 @@ cupsd_send_notification( break; if (state == IPP_ERROR) + { + if (errno == EPIPE) + { + /* + * Notifier died, try restarting it... + */ + + cupsdLogMessage(CUPSD_LOG_WARN, + "Notifier for subscription %d (%s) went away, " + "retrying!", + sub->id, sub->recipient); + cupsdEndProcess(sub->pid, 0); + + close(sub->pipe); + sub->pipe = -1; + continue; + } + cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to send event for subscription %d (%s)!", sub->id, sub->recipient); + } + + /* + * If we get this far, break out of the loop... + */ + + break; } } @@ -1591,5 +1624,5 @@ cupsd_start_notifier( /* - * End of "$Id: subscriptions.c 5673 2006-06-16 21:04:45Z mike $". + * End of "$Id: subscriptions.c 5716 2006-07-11 17:56:57Z mike $". */ |