diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-10-04 13:56:20 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2008-10-04 13:56:20 -0700 |
commit | e44369989c54e908e3481fb76444df6bcf4e228b (patch) | |
tree | d03f0f366118977a272f099588d91b3985e0281c /source3/printing/notify.c | |
parent | ba5ef49f831dbbfec1a360cd4644999de822e2bc (diff) | |
parent | 80665a0b5abbdd8df735e1ccdab3206399beba0b (diff) | |
download | samba-e44369989c54e908e3481fb76444df6bcf4e228b.tar.gz samba-e44369989c54e908e3481fb76444df6bcf4e228b.tar.bz2 samba-e44369989c54e908e3481fb76444df6bcf4e228b.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source3/printing/notify.c')
-rw-r--r-- | source3/printing/notify.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source3/printing/notify.c b/source3/printing/notify.c index 23df17c389..f6599c413d 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -34,6 +34,7 @@ static struct notify_queue { size_t buflen; } *notify_queue_head = NULL; +static struct timed_event *notify_event; static bool create_send_ctx(void) { @@ -214,6 +215,22 @@ void print_notify_send_messages(struct messaging_context *msg_ctx, num_messages = 0; } +/******************************************************************* + Event handler to send the messages. +*******************************************************************/ + +static void print_notify_event_send_messages(struct event_context *event_ctx, + struct timed_event *te, + const struct timeval *now, + void *private_data) +{ + /* Remove this timed event handler. */ + TALLOC_FREE(notify_event); + + change_to_root_user(); + print_notify_send_messages(smbd_messaging_context(), 0); +} + /********************************************************************** deep copy a SPOOLSS_NOTIFY_MSG structure using a TALLOC_CTX *********************************************************************/ @@ -304,6 +321,15 @@ to notify_queue_head\n", msg->type, msg->field, msg->printer)); DLIST_ADD_END(notify_queue_head, pnqueue, struct notify_queue *); num_messages++; + + if (smbd_event_context()) { + /* Add an event for 1 second's time to send this queue. */ + notify_event = event_add_timed(smbd_event_context(), NULL, + timeval_current_ofs(1,0), + "print_notify", + print_notify_event_send_messages, NULL); + } + } static void send_notify_field_values(const char *sharename, uint32 type, |