From cdac09614ef426092ed1b1de480fe90c3c4cdd83 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 16 Nov 2000 21:38:24 +0000 Subject: Fix for a problem with the new messaging system. If a sender is using the messaging system as a notification mechanism, and the speed of notification greatly exceeds the speed of message recovery, then you get a massively (>75Mb) growing tdb. If the message is a simple notification, then the message is static, and you only need one of them in transit to a target process at any one time. This patch adds a BOOL "allow_duplicates" to the message_send_XX primitives. If set to False, then before sending a message the sender checks the existing message queue for a target pid for a duplicate of this message, and doesn't add to it if one already exists. Also added code into msgtest.c to test this. Jeremy. (This used to be commit 3aa7995660395ecb85c8e35b638fa9fbbb952558) --- source3/printing/printing.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 2d98aa9974..1eb6c27555 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -576,8 +576,7 @@ BOOL print_job_delete(struct current_user *user, int jobid, int *errcode) printer_name = PRINTERNAME(snum); - message_send_all(MSG_PRINTER_NOTIFY, printer_name, - strlen(printer_name) + 1); + message_send_all(MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False); return !print_job_exists(jobid); } @@ -627,8 +626,7 @@ BOOL print_job_pause(struct current_user *user, int jobid, int *errcode) printer_name = PRINTERNAME(snum); - message_send_all(MSG_PRINTER_NOTIFY, printer_name, - strlen(printer_name) + 1); + message_send_all(MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False); /* how do we tell if this succeeded? */ @@ -678,8 +676,7 @@ BOOL print_job_resume(struct current_user *user, int jobid, int *errcode) printer_name = PRINTERNAME(snum); - message_send_all(MSG_PRINTER_NOTIFY, printer_name, - strlen(printer_name) + 1); + message_send_all(MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False); return True; } @@ -942,8 +939,7 @@ BOOL print_job_end(int jobid) printer_name = PRINTERNAME(snum); - message_send_all(MSG_PRINTER_NOTIFY, printer_name, - strlen(printer_name) + 1); + message_send_all(MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False); return True; } @@ -1125,8 +1121,7 @@ BOOL print_queue_pause(struct current_user *user, int snum, int *errcode) printer_name = PRINTERNAME(snum); - message_send_all(MSG_PRINTER_NOTIFY, printer_name, - strlen(printer_name) + 1); + message_send_all(MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False); return True; } @@ -1159,8 +1154,7 @@ BOOL print_queue_resume(struct current_user *user, int snum, int *errcode) printer_name = PRINTERNAME(snum); - message_send_all(MSG_PRINTER_NOTIFY, printer_name, - strlen(printer_name) + 1); + message_send_all(MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False); return True; } @@ -1189,8 +1183,7 @@ BOOL print_queue_purge(struct current_user *user, int snum, int *errcode) printer_name = PRINTERNAME(snum); - message_send_all(MSG_PRINTER_NOTIFY, printer_name, - strlen(printer_name) + 1); + message_send_all(MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False); return True; } -- cgit