s3-printing: remove printer_list_need_refresh
authorDavid Disseldorp <ddiss@suse.de>
Tue, 28 Dec 2010 14:54:54 +0000 (15:54 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 7 Jan 2011 23:37:39 +0000 (15:37 -0800)
printer_list_need_refresh() was used previously to ensure one smbd
process did not attempt to update the printer_list tdb during or soon
after update by another smbd.

It is no longer needed, as pcap updates are now only performed by the
parent smbd process following startup, SIGHUP, config update or printcap
cache time expiry.

source3/printing/pcap.c
source3/printing/printer_list.c
source3/printing/printer_list.h

index 7a733b1c3cbbe6e0afd16cbc09aab21b711633ed..7208f4b7f8c5b6e4bee71ca09abb2f491023c366 100644 (file)
@@ -139,12 +139,6 @@ void pcap_cache_reload(struct tevent_context *ev,
                return;
        }
 
-       if (!printer_list_need_refresh()) {
-               /* has been just refeshed, skip */
-               DEBUG(5, ("Refresh just happend, skipping.\n"));
-               return;
-       }
-
        status = printer_list_mark_reload();
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("Failed to mark printer list for reload!\n"));
index f3f00f0c0f55b9b5dcc9a4e47b3329e5446889f4..d36a746e45219a3302b412be076c5c7595af12f5 100644 (file)
@@ -215,32 +215,6 @@ done:
        return status;
 }
 
-bool printer_list_need_refresh(void)
-{
-       NTSTATUS status;
-       time_t last_refresh;
-       int timediff;
-
-       status = printer_list_get_last_refresh(&last_refresh);
-       if (!NT_STATUS_IS_OK(status)) {
-               return true;
-       }
-       timediff = time_mono(NULL) - last_refresh;
-
-       if (timediff > 1 ) {
-               /* if refresh occurred more than 1s (TODO:use lp_printcap_cache_time) ago,
-                * then we need to refresh */
-               return true;
-       } else if (timediff < 0) {
-               /* last_refresh newer than now. Seems we have no monotonic
-                * clock and the clock was adjusted backwards.
-                * we need to refresh which also resets last_refresh */
-               return true;
-       }
-
-       return false;
-}
-
 NTSTATUS printer_list_mark_reload(void)
 {
        struct db_context *db;
index bdcf308098c51dcbc11be413f8f386b9ffdd5d7f..fce3e34248c38c6f864911510c52d94f893dc5cb 100644 (file)
@@ -96,13 +96,4 @@ NTSTATUS printer_list_clean_old(void);
 
 NTSTATUS printer_list_run_fn(void (*fn)(const char *, const char *, void *),
                             void *private_data);
-
-/**
- * @brief Check if the printer list needs to be refreshed.
- *
- * @return              True if the database needs to be refreshed, false if
- *                      not.
- */
-bool printer_list_need_refresh(void);
-
 #endif /* _PRINTER_LIST_H_ */