diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-11-21 21:13:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:46:37 -0500 |
commit | d159c643a6a053bba2199da7d02ce0e57eb98b87 (patch) | |
tree | b718b98900e429ad597a127e974eed1f0230fe1a | |
parent | 81a941fc099b5ca9fbce6bf9cfb6dbe6f6238905 (diff) | |
download | samba-d159c643a6a053bba2199da7d02ce0e57eb98b87.tar.gz samba-d159c643a6a053bba2199da7d02ce0e57eb98b87.tar.bz2 samba-d159c643a6a053bba2199da7d02ce0e57eb98b87.zip |
r11837: Add a timeout before starting a torture test. It's really fun to watch 50
simulated logins doing stuff simultaneously. This is where the async
architecture *really* pays off.
Volker
(This used to be commit 4cca813dff1194546e85efb9aabd36f0139e5be2)
-rw-r--r-- | source4/torture/rpc/xplogin.c | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/source4/torture/rpc/xplogin.c b/source4/torture/rpc/xplogin.c index d90e1534ef..5e3a4dfd8e 100644 --- a/source4/torture/rpc/xplogin.c +++ b/source4/torture/rpc/xplogin.c @@ -1373,6 +1373,8 @@ static NTSTATUS memberships_recv(struct composite_context *creq) } struct xp_login_state { + struct timeval timeout; + const char *dc_name; const char *dc_ip; const char *wks_domain; @@ -1404,6 +1406,8 @@ struct xp_login_state { }; static void xp_login_recv_conn(struct composite_context *ctx); +static void xp_login_start(struct event_context *ev, struct timed_event *te, + struct timeval tv, void *p); static void xp_login_recv_auth2(struct composite_context *ctx); static void xp_login_recv_trusts(struct composite_context *creq); static void xp_login_recv_schannel(struct composite_context *creq); @@ -1413,6 +1417,7 @@ static void xp_login_recv_domadmins(struct composite_context *creq); static void xp_login_recv_memberships(struct composite_context *creq); static struct composite_context *xp_login_send(TALLOC_CTX *mem_ctx, + struct timeval timeout, struct event_context *event_ctx, const char *dc_name, const char *dc_ip, @@ -1423,7 +1428,7 @@ static struct composite_context *xp_login_send(TALLOC_CTX *mem_ctx, const char *user_name, const char *user_pwd) { - struct composite_context *c, *creq; + struct composite_context *c; struct xp_login_state *state; c = talloc_zero(mem_ctx, struct composite_context); @@ -1439,6 +1444,7 @@ static struct composite_context *xp_login_send(TALLOC_CTX *mem_ctx, c->private_data = state; c->event_ctx = event_ctx; + state->timeout = timeout; state->dc_name = dc_name; state->dc_ip = dc_ip; state->wks_domain = wks_domain; @@ -1474,8 +1480,10 @@ static struct composite_context *xp_login_send(TALLOC_CTX *mem_ctx, state->conn.in.fallback_to_anonymous = False; state->conn.in.workgroup = wks_domain; - creq = smb_composite_connect_send(&state->conn, state, event_ctx); - composite_continue(c, creq, xp_login_recv_conn, c); + event_add_timed(c->event_ctx, state, + timeval_current_ofs(state->timeout.tv_sec, + state->timeout.tv_usec), + xp_login_start, c); return c; failed: @@ -1483,6 +1491,19 @@ static struct composite_context *xp_login_send(TALLOC_CTX *mem_ctx, return c; } +static void xp_login_start(struct event_context *ev, struct timed_event *te, + struct timeval tv, void *p) +{ + struct composite_context *c = + talloc_get_type(p, struct composite_context); + struct xp_login_state *state = + talloc_get_type(c->private_data, struct xp_login_state); + struct composite_context *creq; + + creq = smb_composite_connect_send(&state->conn, state, c->event_ctx); + composite_continue(c, creq, xp_login_recv_conn, c); +} + static void xp_login_recv_conn(struct composite_context *creq) { struct composite_context *c = @@ -1768,12 +1789,15 @@ BOOL torture_rpc_login(void) } for (i=0; i<torture_numops; i++) { - ctx[i] = xp_login_send(mem_ctx, event_ctx, - lp_parm_string(-1, "torture", "host"), - lp_parm_string(-1, "torture", "host"), - lp_workgroup(), - lp_netbios_name(), "5,eEp_D2", - lp_workgroup(), "vl", "asdf"); + ctx[i] = xp_login_send( + mem_ctx, timeval_set(0, i*lp_parm_int(-1, "torture", + "timeout", 0)), + event_ctx, + lp_parm_string(-1, "torture", "host"), + lp_parm_string(-1, "torture", "host"), + lp_workgroup(), + lp_netbios_name(), "5,eEp_D2", + lp_workgroup(), "vl", "asdf"); if (ctx[i] == NULL) { DEBUG(0, ("xp_login_send failed\n")); goto done; |