diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-01-09 22:12:53 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:49:57 -0500 |
commit | f55ea8bb3dca868e21663cd90eaea7a35cd7886c (patch) | |
tree | 80aab2a3f10310e1946821603752cd407e435214 /source4/torture/local/messaging.c | |
parent | 806b3fdbc12b3284ab9872a4ecae3a7ee34ea171 (diff) | |
download | samba-f55ea8bb3dca868e21663cd90eaea7a35cd7886c.tar.gz samba-f55ea8bb3dca868e21663cd90eaea7a35cd7886c.tar.bz2 samba-f55ea8bb3dca868e21663cd90eaea7a35cd7886c.zip |
r12804: This patch reworks the Samba4 sockets layer to use a socket_address
structure that is more generic than just 'IP/port'.
It now passes make test, and has been reviewed and updated by
metze. (Thankyou *very* much).
This passes 'make test' as well as kerberos use (not currently in the
testsuite).
The original purpose of this patch was to have Samba able to pass a
socket address stucture from the BSD layer into the kerberos routines
and back again. It also removes nbt_peer_addr, which was being used
for a similar purpose.
It is a large change, but worthwhile I feel.
Andrew Bartlett
(This used to be commit 88198c4881d8620a37086f80e4da5a5b71c5bbb2)
Diffstat (limited to 'source4/torture/local/messaging.c')
-rw-r--r-- | source4/torture/local/messaging.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/source4/torture/local/messaging.c b/source4/torture/local/messaging.c index faba8304d7..0d4dfc49a8 100644 --- a/source4/torture/local/messaging.c +++ b/source4/torture/local/messaging.c @@ -56,8 +56,8 @@ static void exit_message(struct messaging_context *msg, void *private, static BOOL test_ping_speed(TALLOC_CTX *mem_ctx) { struct event_context *ev; - struct messaging_context *msg_ctx; - struct messaging_context *msg_ctx2; + struct messaging_context *msg_client_ctx; + struct messaging_context *msg_server_ctx; int ping_count = 0; int pong_count = 0; BOOL ret = True; @@ -68,23 +68,25 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx) ev = event_context_init(mem_ctx); - msg_ctx2 = messaging_init(mem_ctx, 1, ev); + msg_server_ctx = messaging_init(mem_ctx, 1, ev); - if (!msg_ctx2) { - exit(1); + if (!msg_server_ctx) { + printf("Failed to init ping messaging context\n"); + talloc_free(mem_ctx); + return False; } - messaging_register(msg_ctx2, NULL, MY_PING, ping_message); - messaging_register(msg_ctx2, mem_ctx, MY_EXIT, exit_message); + messaging_register(msg_server_ctx, NULL, MY_PING, ping_message); + messaging_register(msg_server_ctx, mem_ctx, MY_EXIT, exit_message); - msg_ctx = messaging_init(mem_ctx, 2, ev); + msg_client_ctx = messaging_init(mem_ctx, 2, ev); - if (!msg_ctx) { - printf("messaging_init() failed\n"); + if (!msg_client_ctx) { + printf("msg_client_ctx messaging_init() failed\n"); return False; } - messaging_register(msg_ctx, &pong_count, MY_PONG, pong_message); + messaging_register(msg_client_ctx, &pong_count, MY_PONG, pong_message); tv = timeval_current(); @@ -96,8 +98,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_ctx, 1, MY_PING, &data); - status2 = messaging_send(msg_ctx, 1, MY_PING, NULL); + status1 = messaging_send(msg_client_ctx, 1, MY_PING, &data); + status2 = messaging_send(msg_client_ctx, 1, MY_PING, NULL); if (!NT_STATUS_IS_OK(status1)) { printf("msg1 failed - %s\n", nt_errstr(status1)); @@ -123,7 +125,7 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx) } printf("sending exit\n"); - messaging_send(msg_ctx, 1, MY_EXIT, NULL); + messaging_send(msg_client_ctx, 1, MY_EXIT, NULL); if (ping_count != pong_count) { printf("ping test failed! received %d, sent %d\n", @@ -134,7 +136,8 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx) printf("ping rate of %.0f messages/sec\n", (ping_count+pong_count)/timeval_elapsed(&tv)); - talloc_free(msg_ctx); + talloc_free(msg_client_ctx); + talloc_free(msg_server_ctx); talloc_free(ev); |