summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-04-10 18:43:00 +0000
committerJeremy Allison <jra@samba.org>2003-04-10 18:43:00 +0000
commitac65d890703c85fe69e2c577061087b8da2a4a93 (patch)
tree0ed8e9e19001d512bda9e6d496dfba0b6970864f /source3
parent6ca7634a77de4dc5159e02ada13887129f27b25a (diff)
downloadsamba-ac65d890703c85fe69e2c577061087b8da2a4a93.tar.gz
samba-ac65d890703c85fe69e2c577061087b8da2a4a93.tar.bz2
samba-ac65d890703c85fe69e2c577061087b8da2a4a93.zip
Ensure we're not filtering our essential delete messages.
Added jobid debug when unpacking message. Jeremy. (This used to be commit 8bab6e32069e1636a52efa31ca55b49f1b3fa768)
Diffstat (limited to 'source3')
-rw-r--r--source3/printing/notify.c32
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c4
2 files changed, 23 insertions, 13 deletions
diff --git a/source3/printing/notify.c b/source3/printing/notify.c
index 641f951bdd..428eb54ce4 100644
--- a/source3/printing/notify.c
+++ b/source3/printing/notify.c
@@ -24,6 +24,8 @@
static TALLOC_CTX *send_ctx;
+static unsigned int num_messages;
+
static struct notify_queue {
struct notify_queue *next, *prev;
struct spoolss_notify_msg *msg;
@@ -128,6 +130,7 @@ static void print_notify_send_messages_to_printer(const char *printer, unsigned
if (!flatten_message(pq)) {
DEBUG(0,("print_notify_send_messages: Out of memory\n"));
talloc_destroy_pool(send_ctx);
+ num_messages = 0;
return;
}
offset += (pq->buflen + 4);
@@ -140,6 +143,7 @@ static void print_notify_send_messages_to_printer(const char *printer, unsigned
if (!buf) {
DEBUG(0,("print_notify_send_messages: Out of memory\n"));
talloc_destroy_pool(send_ctx);
+ num_messages = 0;
return;
}
@@ -190,6 +194,7 @@ void print_notify_send_messages(unsigned int timeout)
print_notify_send_messages_to_printer(notify_queue_head->msg->printer, timeout);
talloc_destroy_pool(send_ctx);
+ num_messages = 0;
}
/**********************************************************************
@@ -225,23 +230,27 @@ static void send_spoolss_notify2_msg(SPOOLSS_NOTIFY_MSG *msg)
struct notify_queue *pnqueue, *tmp_ptr;
/*
- * Ensure we only have one message unique to each name/type/field/id/flags
- * tuple. There is no point in sending multiple messages that match
+ * Ensure we only have one job total_bytes and job total_pages for
+ * each job. There is no point in sending multiple messages that match
* as they will just cause flickering updates in the client.
*/
- for (tmp_ptr = notify_queue_head; tmp_ptr; tmp_ptr = tmp_ptr->next) {
- if (tmp_ptr->msg->type == msg->type &&
- tmp_ptr->msg->field == msg->field &&
- tmp_ptr->msg->id == msg->id &&
- tmp_ptr->msg->flags == msg->flags &&
- strequal(tmp_ptr->msg->printer, msg->printer)) {
+ if ((num_messages < 100) && (msg->type == JOB_NOTIFY_TYPE) &&
+ (msg->field == JOB_NOTIFY_TOTAL_BYTES || msg->field == JOB_NOTIFY_TOTAL_PAGES)) {
+
+ for (tmp_ptr = notify_queue_head; tmp_ptr; tmp_ptr = tmp_ptr->next) {
+ if (tmp_ptr->msg->type == msg->type &&
+ tmp_ptr->msg->field == msg->field &&
+ tmp_ptr->msg->id == msg->id &&
+ tmp_ptr->msg->flags == msg->flags &&
+ strequal(tmp_ptr->msg->printer, msg->printer)) {
- DEBUG(5, ("send_spoolss_notify2_msg: replacing message 0x%02x/0x%02x for printer %s \
+ DEBUG(5, ("send_spoolss_notify2_msg: replacing message 0x%02x/0x%02x for printer %s \
in notify_queue\n", msg->type, msg->field, msg->printer));
- tmp_ptr->msg = msg;
- return;
+ tmp_ptr->msg = msg;
+ return;
+ }
}
}
@@ -274,6 +283,7 @@ to notify_queue_head\n", msg->type, msg->field, msg->printer));
*/
DLIST_ADD_END(notify_queue_head, pnqueue, tmp_ptr);
+ num_messages++;
}
static void send_notify_field_values(const char *printer_name, uint32 type,
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 9f943f036a..c4ae894296 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1053,8 +1053,8 @@ static BOOL notify2_unpack_msg( SPOOLSS_NOTIFY_MSG *msg, struct timeval *tv, voi
tdb_unpack((char *)buf + offset, len - offset, "B",
&msg->len, &msg->notify.data);
- DEBUG(3, ("notify2_unpack_msg: got NOTIFY2 message, type %d, field 0x%02x, flags 0x%04x\n",
- msg->type, msg->field, msg->flags));
+ DEBUG(3, ("notify2_unpack_msg: got NOTIFY2 message for printer %s, jobid %u type %d, field 0x%02x, flags 0x%04x\n",
+ msg->printer, (unsigned int)msg->id, msg->type, msg->field, msg->flags));
tv->tv_sec = tv_sec;
tv->tv_usec = tv_usec;