summaryrefslogtreecommitdiff
path: root/source3/printing/print_cups.c
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@suse.de>2010-12-30 14:32:29 +0100
committerAndreas Schneider <asn@samba.org>2011-03-04 15:46:20 +0100
commit624e33f8697a7c9215028d4d70edd70ee49ad005 (patch)
tree31868017702738fba5c111bda639c4b555b3373e /source3/printing/print_cups.c
parent61bf4699f0f8b353272c060b8309f339ed2a0f88 (diff)
downloadsamba-624e33f8697a7c9215028d4d70edd70ee49ad005.tar.gz
samba-624e33f8697a7c9215028d4d70edd70ee49ad005.tar.bz2
samba-624e33f8697a7c9215028d4d70edd70ee49ad005.zip
s3-printing: remove unneeded local_pcap_copy global
The cups local_pcap_copy global served as a temporary buffer during asynchronous cups printcap cache updates, as well as indicating when the printcap cache had not yet been filled and printcap cache update should block. As smbd printcap reads are now triggered by the parent smbd following printcap cache update, the variable and blocking mechanism are no longer needed. Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/printing/print_cups.c')
-rw-r--r--source3/printing/print_cups.c54
1 files changed, 18 insertions, 36 deletions
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 0e5dac5374..d2df2587e2 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -390,8 +390,7 @@ static bool cups_cache_reload_async(int fd)
return ret;
}
-static struct pcap_cache *local_pcap_copy;
-struct fd_event *cache_fd_event;
+static struct fd_event *cache_fd_event;
static bool cups_pcap_load_async(struct tevent_context *ev,
struct messaging_context *msg_ctx,
@@ -553,12 +552,8 @@ static void cups_async_callback(struct event_context *event_ctx,
TALLOC_FREE(frame);
if (tmp_pcap_cache) {
bool ret;
- /* We got a namelist, replace our local cache. */
- pcap_cache_destroy_specific(&local_pcap_copy);
- local_pcap_copy = tmp_pcap_cache;
-
- /* And the systemwide pcap cache. */
- ret = pcap_cache_replace(local_pcap_copy);
+ /* replace the systemwide pcap cache. */
+ ret = pcap_cache_replace(tmp_pcap_cache);
if (!ret)
DEBUG(0, ("failed to replace pcap cache\n"));
@@ -600,35 +595,22 @@ bool cups_cache_reload(struct tevent_context *ev,
talloc_free(cb_args);
return false;
}
- if (!local_pcap_copy) {
- /* We have no local cache, wait directly for
- * async refresh to complete.
- */
- DEBUG(10,("cups_cache_reload: sync read on fd %d\n",
- *p_pipe_fd ));
-
- cups_async_callback(ev, NULL,
- EVENT_FD_READ,
- (void *)cb_args);
- if (!local_pcap_copy) {
- return false;
- }
- } else {
- DEBUG(10,("cups_cache_reload: async read on fd %d\n",
- *p_pipe_fd ));
-
- /* Trigger an event when the pipe can be read. */
- cache_fd_event = event_add_fd(ev,
- NULL, *p_pipe_fd,
- EVENT_FD_READ,
- cups_async_callback,
- (void *)cb_args);
- if (!cache_fd_event) {
- close(*p_pipe_fd);
- TALLOC_FREE(cb_args);
- return false;
- }
+
+ DEBUG(10,("cups_cache_reload: async read on fd %d\n",
+ *p_pipe_fd ));
+
+ /* Trigger an event when the pipe can be read. */
+ cache_fd_event = event_add_fd(ev,
+ NULL, *p_pipe_fd,
+ EVENT_FD_READ,
+ cups_async_callback,
+ (void *)cb_args);
+ if (!cache_fd_event) {
+ close(*p_pipe_fd);
+ TALLOC_FREE(cb_args);
+ return false;
}
+
return true;
}