summaryrefslogtreecommitdiff
path: root/source4/torture/raw/openbench.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-29 08:22:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:53:01 -0500
commitaeac4f48001bbca61b9f94ecb1bdfa336ff27ad7 (patch)
tree04112b63650e698e7c960afd074fe1275fb1e8b4 /source4/torture/raw/openbench.c
parent9b95f57530c1f2c8b1d952f6035fcae8dde74b85 (diff)
downloadsamba-aeac4f48001bbca61b9f94ecb1bdfa336ff27ad7.tar.gz
samba-aeac4f48001bbca61b9f94ecb1bdfa336ff27ad7.tar.bz2
samba-aeac4f48001bbca61b9f94ecb1bdfa336ff27ad7.zip
r23181: prevent attempts to reopen the connection twice at the same time
(This used to be commit a25c27dbae4534f2125001c16ac9ae0b67c519cb)
Diffstat (limited to 'source4/torture/raw/openbench.c')
-rw-r--r--source4/torture/raw/openbench.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index fe01f1f5e2..f956d84234 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -57,6 +57,7 @@ struct benchopen_state {
struct smbcli_request *req_open;
struct smbcli_request *req_close;
struct smb_composite_connect reconnect;
+ struct timed_event *te;
/* these are used for reconnections */
int dest_port;
@@ -81,9 +82,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;
}
@@ -210,9 +212,10 @@ static void open_completed(struct smbcli_request *req)
state->cli = 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);
return;
}
@@ -262,9 +265,10 @@ static void close_completed(struct smbcli_request *req)
state->cli = 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);
return;
}
@@ -289,9 +293,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);
}
}