summaryrefslogtreecommitdiff
path: root/source4/torture/local/messaging.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-04-12 06:08:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:04:03 -0500
commitc8610144f73a6cbc26c58f57a527f7cbcb44b265 (patch)
treea2be53d1ba3d22e1be1c00981d912056fa00136e /source4/torture/local/messaging.c
parent289911bb4e7980bf42cc87305d3f94477c5f2b75 (diff)
downloadsamba-c8610144f73a6cbc26c58f57a527f7cbcb44b265.tar.gz
samba-c8610144f73a6cbc26c58f57a527f7cbcb44b265.tar.bz2
samba-c8610144f73a6cbc26c58f57a527f7cbcb44b265.zip
r15049: for really efficient oplock handling with thousands of open files we
will need a separate messaging endpoint per open file. To make this efficient extend the messaging layer to have a new registration function for temporary message types that maps via an idtree. I have updated the LOCAL-MESSAGING test to use the new function. (This used to be commit 4b976851d8b7ccd2c40010be095cef7fecf9e722)
Diffstat (limited to 'source4/torture/local/messaging.c')
-rw-r--r--source4/torture/local/messaging.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source4/torture/local/messaging.c b/source4/torture/local/messaging.c
index 77bce155bc..70bfd090f0 100644
--- a/source4/torture/local/messaging.c
+++ b/source4/torture/local/messaging.c
@@ -25,13 +25,14 @@
#include "lib/messaging/irpc.h"
#include "torture/torture.h"
-enum {MY_PING=1000, MY_PONG, MY_EXIT};
+
+static uint32_t msg_pong;
static void ping_message(struct messaging_context *msg, void *private,
uint32_t msg_type, uint32_t src, DATA_BLOB *data)
{
NTSTATUS status;
- status = messaging_send(msg, src, MY_PONG, data);
+ status = messaging_send(msg, src, msg_pong, data);
if (!NT_STATUS_IS_OK(status)) {
printf("pong failed - %s\n", nt_errstr(status));
}
@@ -64,6 +65,7 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx)
BOOL ret = True;
struct timeval tv;
int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
+ uint32_t msg_ping, msg_exit;
lp_set_cmdline("lock dir", "lockdir.tmp");
@@ -77,8 +79,8 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx)
return False;
}
- messaging_register(msg_server_ctx, NULL, MY_PING, ping_message);
- messaging_register(msg_server_ctx, mem_ctx, MY_EXIT, exit_message);
+ messaging_register_tmp(msg_server_ctx, NULL, ping_message, &msg_ping);
+ messaging_register_tmp(msg_server_ctx, mem_ctx, exit_message, &msg_exit);
msg_client_ctx = messaging_init(mem_ctx, 2, ev);
@@ -87,7 +89,7 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx)
return False;
}
- messaging_register(msg_client_ctx, &pong_count, MY_PONG, pong_message);
+ messaging_register_tmp(msg_client_ctx, &pong_count, pong_message, &msg_pong);
tv = timeval_current();
@@ -99,8 +101,8 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx)
data.data = discard_const_p(uint8_t, "testing");
data.length = strlen((const char *)data.data);
- status1 = messaging_send(msg_client_ctx, 1, MY_PING, &data);
- status2 = messaging_send(msg_client_ctx, 1, MY_PING, NULL);
+ status1 = messaging_send(msg_client_ctx, 1, msg_ping, &data);
+ status2 = messaging_send(msg_client_ctx, 1, msg_ping, NULL);
if (!NT_STATUS_IS_OK(status1)) {
printf("msg1 failed - %s\n", nt_errstr(status1));
@@ -126,7 +128,7 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx)
}
printf("sending exit\n");
- messaging_send(msg_client_ctx, 1, MY_EXIT, NULL);
+ messaging_send(msg_client_ctx, 1, msg_exit, NULL);
if (ping_count != pong_count) {
printf("ping test failed! received %d, sent %d\n",