From 47873e781d219bd523d10ca449ac0efb72daed0e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 11 Jan 2003 02:29:23 +0000 Subject: [merge] make sure to updatre print queue cache during timeout_processing() to send notify events; CR 1491 (This used to be commit 142c5029c701e7a82074e301278846c02843f46f) --- source3/printing/printing.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/printing.c b/source3/printing/printing.c index be42664b56..5f2594f07a 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1907,6 +1907,7 @@ static int printjob_comp(print_queue_struct *j1, print_queue_struct *j2) /**************************************************************************** Get a printer queue listing. + set queue = NULL and status = NULL if you just want to update the cache ****************************************************************************/ int print_queue_status(int snum, @@ -1917,18 +1918,26 @@ int print_queue_status(int snum, struct traverse_count_struct tsc; fstring keystr; TDB_DATA data, key; - const char *printername = lp_const_servicename(snum); - struct tdb_print_db *pdb = get_print_db_byname(printername); - - *queue = NULL; - - if (!pdb) - return 0; + const char *printername; + struct tdb_print_db *pdb; /* make sure the database is up to date */ + if (print_cache_expired(snum)) print_queue_update(snum); + /* return if we are done */ + + if ( !queue || !status ) + return 0; + + *queue = NULL; + printername = lp_const_servicename(snum); + pdb = get_print_db_byname(printername); + + if (!pdb) + return 0; + /* * Fetch the queue status. We must do this first, as there may * be no jobs in the queue. -- cgit