summaryrefslogtreecommitdiff
path: root/source4/torture/raw/openbench.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-25 12:21:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:56 -0500
commita085d682e664ff76ec33d65c71bcbcdc99697e74 (patch)
tree6b7766dc100295a60c89469a29b30b1c93dcabd0 /source4/torture/raw/openbench.c
parent1aaea2d3a7bdafa5fab7c9fd2c1b00fd8cb000c7 (diff)
downloadsamba-a085d682e664ff76ec33d65c71bcbcdc99697e74.tar.gz
r23142: added error checking and reconnect on echo replies
(This used to be commit 0d47efe6d6d1738183c59942a077faaf1c77f004)
Diffstat (limited to 'source4/torture/raw/openbench.c')
-rw-r--r--source4/torture/raw/openbench.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index 4ca77817547..b99259c618a 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -284,6 +284,22 @@ static void next_operation(struct benchopen_state *state)
}
}
+static void echo_completion(struct smbcli_request *req)
+{
+ struct benchopen_state *state = talloc_get_type(req->async.private,
+ struct benchopen_state);
+ NTSTATUS status = smbcli_request_simple_recv(req);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
+ talloc_free(state->tree);
+ 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);
+ }
+}
+
static void report_rate(struct event_context *ev, struct timed_event *te,
struct timeval t, void *private_data)
{
@@ -298,16 +314,21 @@ static void report_rate(struct event_context *ev, struct timed_event *te,
fflush(stdout);
event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state);
+ if (!state[i].tree) {
+ return;
+ }
+
/* send an echo on each interface to ensure it stays alive - this helps
with IP takeover */
for (i=0;i<nprocs;i++) {
struct smb_echo p;
- p.in.repeat_count = 0;
+ struct smbcli_request *req;
+ p.in.repeat_count = 1;
p.in.size = 0;
p.in.data = NULL;
- if (state[i].tree) {
- smb_raw_echo_send(state[i].tree->session->transport, &p);
- }
+ req = smb_raw_echo_send(state[i].tree->session->transport, &p);
+ req->async.private = state;
+ req->async.fn = echo_completion;
}
}