diff options
Diffstat (limited to 'scheduler/sysman.c')
-rw-r--r-- | scheduler/sysman.c | 75 |
1 files changed, 21 insertions, 54 deletions
diff --git a/scheduler/sysman.c b/scheduler/sysman.c index 0bab71727..c57d6e4fb 100644 --- a/scheduler/sysman.c +++ b/scheduler/sysman.c @@ -87,9 +87,6 @@ cupsdCleanDirty(void) if (DirtyFiles & CUPSD_DIRTY_CLASSES) cupsdSaveAllClasses(); - if (DirtyFiles & CUPSD_DIRTY_REMOTE) - cupsdSaveRemoteCache(); - if (DirtyFiles & CUPSD_DIRTY_PRINTCAP) cupsdWritePrintcap(); @@ -123,10 +120,9 @@ cupsdCleanDirty(void) void cupsdMarkDirty(int what) /* I - What file(s) are dirty? */ { - cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdMarkDirty(%c%c%c%c%c%c)", + cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdMarkDirty(%c%c%c%c%c)", (what & CUPSD_DIRTY_PRINTERS) ? 'P' : '-', (what & CUPSD_DIRTY_CLASSES) ? 'C' : '-', - (what & CUPSD_DIRTY_REMOTE) ? 'R' : '-', (what & CUPSD_DIRTY_PRINTCAP) ? 'p' : '-', (what & CUPSD_DIRTY_JOBS) ? 'J' : '-', (what & CUPSD_DIRTY_SUBSCRIPTIONS) ? 'S' : '-'); @@ -266,8 +262,8 @@ cupsdSetBusyState(void) # define SYSEVENT_NAMECHANGED 0x10 /* Computer name changed */ -/* - * Structures... +/* + * Structures... */ typedef struct cupsd_sysevent_s /*** System event data ****/ @@ -286,14 +282,14 @@ typedef struct cupsd_thread_data_s /*** Thread context data ****/ } cupsd_thread_data_t; -/* - * Local globals... +/* + * Local globals... */ static pthread_t SysEventThread = NULL; /* Thread to host a runloop */ static pthread_mutex_t SysEventThreadMutex = { 0 }; - /* Coordinates access to shared gloabals */ + /* Coordinates access to shared gloabals */ static pthread_cond_t SysEventThreadCond = { 0 }; /* Thread initialization complete condition */ static CFRunLoopRef SysEventRunloop = NULL; @@ -316,8 +312,8 @@ static CFStringRef ComputerNameKey = NULL, static cupsd_sysevent_t LastSysEvent; /* Last system event (for delayed sleep) */ -/* - * Local functions... +/* + * Local functions... */ static void *sysEventThreadEntry(void); @@ -499,8 +495,8 @@ sysEventThreadEntry(void) kSCEntNetIPv6); if (!NetworkGlobalKeyDNS) - NetworkGlobalKeyDNS = - SCDynamicStoreKeyCreateNetworkGlobalEntity(kCFAllocatorDefault, + NetworkGlobalKeyDNS = + SCDynamicStoreKeyCreateNetworkGlobalEntity(kCFAllocatorDefault, kSCDynamicStoreDomainState, kSCEntNetDNS); @@ -582,7 +578,7 @@ sysEventThreadEntry(void) threadData.timerRef = CFRunLoopTimerCreate(kCFAllocatorDefault, - CFAbsoluteTimeGetCurrent() + (86400L * 365L * 10L), + CFAbsoluteTimeGetCurrent() + (86400L * 365L * 10L), 86400L * 365L * 10L, 0, 0, sysEventTimerNotifier, &timerContext); CFRunLoopAddTimer(CFRunLoopGetCurrent(), threadData.timerRef, @@ -674,7 +670,7 @@ sysEventPowerNotifier( break; case kIOMessageSystemHasPoweredOn: - /* + /* * Because powered on is followed by a net-changed event, delay * before sending it. */ @@ -702,7 +698,7 @@ sysEventPowerNotifier( if (sendit == 1) { - /* + /* * Send the event to the main thread now. */ @@ -712,7 +708,7 @@ sysEventPowerNotifier( } else { - /* + /* * Send the event to the main thread after 1 to 2 seconds. */ @@ -738,7 +734,7 @@ sysEventConfigurationNotifier( threadData = (cupsd_thread_data_t *)context; - + (void)store; /* anti-compiler-warning-code */ CFRange range = CFRangeMake(0, CFArrayGetCount(changedKeys)); @@ -758,12 +754,12 @@ sysEventConfigurationNotifier( } /* - * Because we registered for several different kinds of change notifications - * this callback usually gets called several times in a row. We use a timer to + * Because we registered for several different kinds of change notifications + * this callback usually gets called several times in a row. We use a timer to * de-bounce these so we only end up generating one event for the main thread. */ - CFRunLoopTimerSetNextFireDate(threadData->timerRef, + CFRunLoopTimerSetNextFireDate(threadData->timerRef, CFAbsoluteTimeGetCurrent() + 5); } @@ -865,20 +861,9 @@ sysUpdate(void) p; p = (cupsd_printer_t *)cupsArrayNext(Printers)) { - if (p->type & CUPS_PRINTER_DISCOVERED) - { - cupsdLogMessage(CUPSD_LOG_DEBUG, - "Deleting remote destination \"%s\"", p->name); - cupsArraySave(Printers); - cupsdDeletePrinter(p, 0); - cupsArrayRestore(Printers); - } - else - { - cupsdLogMessage(CUPSD_LOG_DEBUG, - "Deregistering local printer \"%s\"", p->name); - cupsdDeregisterPrinter(p, 0); - } + cupsdLogMessage(CUPSD_LOG_DEBUG, + "Deregistering local printer \"%s\"", p->name); + cupsdDeregisterPrinter(p, 0); } cupsdCleanDirty(); @@ -950,23 +935,8 @@ sysUpdate(void) if (sysevent.event & SYSEVENT_NETCHANGED) { if (!Sleeping) - { cupsdLogMessage(CUPSD_LOG_DEBUG, "System network configuration changed"); - - /* - * Resetting browse_time before calling cupsdSendBrowseList causes - * browse packets to be sent for local shared printers. - */ - - for (p = (cupsd_printer_t *)cupsArrayFirst(Printers); - p; - p = (cupsd_printer_t *)cupsArrayNext(Printers)) - p->browse_time = 0; - - cupsdSendBrowseList(); - cupsdRestartPolling(); - } else cupsdLogMessage(CUPSD_LOG_DEBUG, "System network configuration changed; " @@ -1002,10 +972,7 @@ sysUpdate(void) for (p = (cupsd_printer_t *)cupsArrayFirst(Printers); p; p = (cupsd_printer_t *)cupsArrayNext(Printers)) - { - p->browse_time = 0; cupsdRegisterPrinter(p); - } } else cupsdLogMessage(CUPSD_LOG_DEBUG, |