summaryrefslogtreecommitdiff
path: root/source4/torture/raw/lockbench.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/raw/lockbench.c')
-rw-r--r--source4/torture/raw/lockbench.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index e929218ead..af0c65b6a4 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -54,6 +54,7 @@ struct benchlock_state {
int lastcount;
struct smbcli_request *req;
struct smb_composite_connect reconnect;
+ struct timed_event *te;
/* these are used for reconnections */
int dest_port;
@@ -148,9 +149,10 @@ static void reopen_connection_complete(struct composite_context *ctx)
status = smb_composite_connect_recv(ctx, state->mem_ctx);
if (!NT_STATUS_IS_OK(status)) {
- event_add_timed(state->ev, state->mem_ctx,
- timeval_current_ofs(1,0),
- reopen_connection, state);
+ talloc_free(state->te);
+ state->te = event_add_timed(state->ev, state->mem_ctx,
+ timeval_current_ofs(1,0),
+ reopen_connection, state);
return;
}
@@ -218,9 +220,10 @@ static void lock_completion(struct smbcli_request *req)
state->tree = NULL;
num_connected--;
DEBUG(0,("reopening connection to %s\n", state->dest_host));
- event_add_timed(state->ev, state->mem_ctx,
- timeval_current_ofs(1,0),
- reopen_connection, state);
+ talloc_free(state->te);
+ state->te = 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++;
@@ -256,9 +259,10 @@ static void echo_completion(struct smbcli_request *req)
state->tree = NULL;
num_connected--;
DEBUG(0,("reopening connection to %s\n", state->dest_host));
- event_add_timed(state->ev, state->mem_ctx,
- timeval_current_ofs(1,0),
- reopen_connection, state);
+ talloc_free(state->te);
+ state->te = event_add_timed(state->ev, state->mem_ctx,
+ timeval_current_ofs(1,0),
+ reopen_connection, state);
}
}