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/utils/msgtest.c | 29 +++++++++++++++++++++++++++-- source3/utils/smbcontrol.c | 20 ++++++++++---------- 2 files changed, 37 insertions(+), 12 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/msgtest.c b/source3/utils/msgtest.c index 858166e697..3fbf95af8f 100644 --- a/source3/utils/msgtest.c +++ b/source3/utils/msgtest.c @@ -36,12 +36,12 @@ void pong_message(int msg_type, pid_t src, void *buf, size_t len) pong_count++; } - int main(int argc, char *argv[]) { pid_t pid; int i, n; static pstring servicesf = CONFIGFILE; + char buf[12]; TimeInit(); setup_logging(argv[0],True); @@ -52,13 +52,18 @@ void pong_message(int msg_type, pid_t src, void *buf, size_t len) message_init(); + if (argc != 3) { + fprintf(stderr, "%s: Usage - %s pid count\n", argv[0], argv[0]); + exit(1); + } + pid = atoi(argv[1]); n = atoi(argv[2]); message_register(MSG_PONG, pong_message); for (i=0;i