summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-15 03:00:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:27 -0500
commit2e11a2b60181cff1fd9fc9716563ae77e18db10c (patch)
tree2c4a99557b682a2033805df3f8be0c71c3279a49 /source4
parentbb84e0b5844e008a80e9707f52f84e4e5e9de571 (diff)
downloadsamba-2e11a2b60181cff1fd9fc9716563ae77e18db10c.tar.gz
samba-2e11a2b60181cff1fd9fc9716563ae77e18db10c.tar.bz2
samba-2e11a2b60181cff1fd9fc9716563ae77e18db10c.zip
r22876: - try to reconnect once per second, not continously
- patch from ronnie to fix the lock offset on reconnect (This used to be commit 77d7ca5590bfc416a2526bc8833158df4e9d7810)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/raw/lockbench.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index 705ab4d691..d399a4f3f2 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -88,7 +88,8 @@ static void lock_send(struct benchlock_state *state)
state->offset = (state->offset+1)%nprocs;
}
-static void reopen_connection(struct benchlock_state *state);
+static void reopen_connection(struct event_context *ev, struct timed_event *te,
+ struct timeval t, void *private_data);
static void reopen_file(struct event_context *ev, struct timed_event *te,
@@ -114,7 +115,6 @@ static void reopen_file(struct event_context *ev, struct timed_event *te,
}
state->req->async.private = state;
state->req->async.fn = lock_completion;
- state->offset = (state->offset+1)%nprocs;
}
/*
@@ -128,7 +128,9 @@ static void reopen_connection_complete(struct composite_context *ctx)
status = smb_composite_connect_recv(ctx, state->mem_ctx);
if (!NT_STATUS_IS_OK(status)) {
- reopen_connection(state);
+ event_add_timed(state->ev, state->mem_ctx,
+ timeval_current_ofs(1,0),
+ reopen_connection, state);
return;
}
@@ -142,10 +144,12 @@ static void reopen_connection_complete(struct composite_context *ctx)
/*
- reopen dead connections
+ reopen a connection
*/
-static void reopen_connection(struct benchlock_state *state)
+static void reopen_connection(struct event_context *ev, struct timed_event *te,
+ struct timeval t, void *private_data)
{
+ struct benchlock_state *state = (struct benchlock_state *)private_data;
struct composite_context *ctx;
struct smb_composite_connect *io = &state->reconnect;
char *host, *share;
@@ -191,7 +195,9 @@ static void lock_completion(struct smbcli_request *req)
state->req = NULL;
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
- reopen_connection(state);
+ event_add_timed(state->ev, state->mem_ctx,
+ timeval_current_ofs(1,0),
+ reopen_connection, state);
} else {
DEBUG(0,("Lock failed - %s\n", nt_errstr(status)));
lock_failed++;