summaryrefslogtreecommitdiff
path: root/source3/printing/spoolssd.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-10 09:20:24 -0400
committerAndreas Schneider <asn@samba.org>2011-08-10 18:14:05 +0200
commit54aaa5a58c91df4054c3cbaa238c6a83bbfb2eb7 (patch)
treefc83651a7f71296cbaf5b2a498416d78a1926e3a /source3/printing/spoolssd.c
parentdd4ff4bfdd3338bc5102fdcdcfea75dc9cf0be8a (diff)
downloadsamba-54aaa5a58c91df4054c3cbaa238c6a83bbfb2eb7.tar.gz
samba-54aaa5a58c91df4054c3cbaa238c6a83bbfb2eb7.tar.bz2
samba-54aaa5a58c91df4054c3cbaa238c6a83bbfb2eb7.zip
s3-spoolss: do not call pcap_cache_reload() directly
The background queue process is repsonsible for that. Just reload printers if necessary or wait for a message from bq to do that. Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/printing/spoolssd.c')
-rw-r--r--source3/printing/spoolssd.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index 77846c28ae..3d7494921c 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -25,6 +25,7 @@
#include "printing/nt_printing_migrate_internal.h"
#include "printing/queue_process.h"
#include "printing/pcap.h"
+#include "printing/load.h"
#include "ntdomain.h"
#include "librpc/gen_ndr/srv_winreg.h"
#include "librpc/gen_ndr/srv_spoolss.h"
@@ -359,6 +360,14 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
messaging_register(msg_ctx, ev_ctx, MSG_PRINTER_PCAP,
pcap_updated);
+ /* As soon as messaging is up check if pcap has been loaded already.
+ * If so then we probably missed a message and should load_printers()
+ * ourselves. If pcap has not been loaded yet, then ignore, we will get
+ * a message as soon as the bq process completes the reload. */
+ if (pcap_cache_loaded()) {
+ load_printers(ev_ctx, msg_ctx);
+ }
+
/* try to reinit rpc queues */
spoolss_cb.init = spoolss_init_cb;
spoolss_cb.shutdown = spoolss_shutdown_cb;
@@ -378,8 +387,6 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
return false;
}
- pcap_cache_reload(ev_ctx, msg_ctx, &update_pcap);
-
return true;
}
@@ -782,9 +789,6 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
BlockSignals(false, SIGTERM);
BlockSignals(false, SIGHUP);
- /* Publish nt printers, this requires a working winreg pipe */
- pcap_cache_reload(ev_ctx, msg_ctx, &reload_printers);
-
/* always start the backgroundqueue listner in spoolssd */
bq_logfile = get_bq_logfile();
pid = start_background_queue(ev_ctx, msg_ctx, bq_logfile);
@@ -834,6 +838,14 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
messaging_register(msg_ctx, ev_ctx, MSG_PRINTER_PCAP,
pcap_updated);
+ /* As soon as messaging is up check if pcap has been loaded already.
+ * If so then we probably missed a message and should load_printers()
+ * ourselves. If pcap has not been loaded yet, then ignore, we will get
+ * a message as soon as the bq process completes the reload. */
+ if (pcap_cache_loaded()) {
+ load_printers(ev_ctx, msg_ctx);
+ }
+
mem_ctx = talloc_new(NULL);
if (mem_ctx == NULL) {
exit(1);