diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-01-11 16:53:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:43 -0500 |
commit | fae215266b6711b24f4893653b146751885e4e5f (patch) | |
tree | af13886f2431e1aa8a55a6da473e950dd3d5a053 /source4/torture/rpc | |
parent | 90d65c2e85c8042391b8219eeaedd780e6eb3c7c (diff) | |
download | samba-fae215266b6711b24f4893653b146751885e4e5f.tar.gz samba-fae215266b6711b24f4893653b146751885e4e5f.tar.bz2 samba-fae215266b6711b24f4893653b146751885e4e5f.zip |
r4690: - add support for async rpc server replies
the backend should check for
(dce_call->state_flags & DCESRV_CALL_STATE_FLAG_MAY_ASYNC)
then it's allowed to reply async
then the backend should mark that call as async with
dce_call->state_flags |= DCESRV_CALL_STATE_FLAG_ASYNC;
later it has to manualy set r->out.result
and then send the reply by calling
status = dcesrv_reply(p->dce_call);
NOTE: that ncacn_np doesn't support async replies yet
- implement an async version of echo_TestSleep
- reenable the echo_TestSleep torture test
(this need to be more strict when we have support for async ncacn_np)
metze
(This used to be commit f0a0dbeb25b034b1333078ca085999359f5f6209)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/echo.c | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index c547c71a83..13731383ee 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -3,6 +3,7 @@ test suite for echo rpc operations Copyright (C) Andrew Tridgell 2003 + Copyright (C) Stefan (metze) Metzmacher 2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -208,7 +209,6 @@ static BOOL test_testcall2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return ret; } -#if 0 /* test the TestSleep interface */ @@ -216,10 +216,13 @@ static BOOL test_sleep(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { int i; NTSTATUS status; -#define ASYNC_COUNT 5 +#define ASYNC_COUNT 3 struct rpc_request *req[ASYNC_COUNT]; struct echo_TestSleep r[ASYNC_COUNT]; - int done[ASYNC_COUNT]; + BOOL done[ASYNC_COUNT]; + struct timeval snd[ASYNC_COUNT]; + struct timeval rcv[ASYNC_COUNT]; + struct timeval diff[ASYNC_COUNT]; struct event_context *ctx; int total_done = 0; BOOL ret = True; @@ -227,7 +230,9 @@ static BOOL test_sleep(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) printf("\nTesting TestSleep\n"); for (i=0;i<ASYNC_COUNT;i++) { - done[i] = 0; + done[i] = False; + snd[i] = timeval_current(); + rcv[i] = timeval_zero(); r[i].in.seconds = ASYNC_COUNT-i; req[i] = dcerpc_echo_TestSleep_send(p, mem_ctx, &r[i]); if (!req[i]) { @@ -242,17 +247,37 @@ static BOOL test_sleep(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } for (i=0;i<ASYNC_COUNT;i++) { - if (done[i] == 0 && req[i]->state == RPC_REQUEST_DONE) { + if (done[i] == False && req[i]->state == RPC_REQUEST_DONE) { total_done++; - done[i] = 1; - status = dcerpc_ndr_request_recv(req[i]); + done[i] = True; + rcv[i] = timeval_current(); + diff[i] = timeval_diff(&rcv[i], &snd[i]); + status = dcerpc_ndr_request_recv(req[i]); if (!NT_STATUS_IS_OK(status)) { printf("TestSleep(%d) failed - %s\n", i, nt_errstr(status)); ret = False; + } else if (r[i].out.result != r[i].in.seconds) { + printf("Failed - Sleeped for %u seconds (but we said %u seconds and the reply takes only %u seconds)\n", + r[i].out.result, r[i].in.seconds, (uint_t)diff[i].tv_sec); + ret = False; } else { - printf("Sleep for %d seconds\n", - r[i].out.result); + if (r[i].out.result > diff[i].tv_sec) { + printf("Failed - Sleeped for %u seconds (but reply takes only %u seconds)\n", + r[i].out.result, (uint_t)diff[i].tv_sec); + ret = False; + } else if (r[i].out.result+1 == diff[i].tv_sec) { + printf("Sleeped for %u seconds (but reply takes %u seconds - busy server?)\n", + r[i].out.result, (uint_t)diff[i].tv_sec); + } else if (r[i].out.result == diff[i].tv_sec) { + printf("Sleeped for %u seconds (reply takes %u seconds - ok)\n", + r[i].out.result, (uint_t)diff[i].tv_sec); + } else { + printf("(Failed) - Not async - Sleeped for %u seconds (but reply takes %u seconds)\n", + r[i].out.result, (uint_t)diff[i].tv_sec); + /* TODO: let the test fail here, when we support async rpc on ncacn_np + ret = False;*/ + } } } } @@ -260,8 +285,6 @@ static BOOL test_sleep(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return ret; } -#endif - /* test enum handling @@ -296,7 +319,6 @@ static BOOL test_enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return ret; } - BOOL torture_rpc_echo(void) { NTSTATUS status; @@ -342,11 +364,10 @@ BOOL torture_rpc_echo(void) ret = False; } -/* if (!test_sleep(p, mem_ctx)) { ret = False; } -*/ + printf("\n"); talloc_free(mem_ctx); |