summaryrefslogtreecommitdiff
path: root/source4/torture/raw
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
parent1aaea2d3a7bdafa5fab7c9fd2c1b00fd8cb000c7 (diff)
downloadsamba-a085d682e664ff76ec33d65c71bcbcdc99697e74.tar.gz
samba-a085d682e664ff76ec33d65c71bcbcdc99697e74.tar.bz2
samba-a085d682e664ff76ec33d65c71bcbcdc99697e74.zip
r23142: added error checking and reconnect on echo replies
(This used to be commit 0d47efe6d6d1738183c59942a077faaf1c77f004)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/lockbench.c29
-rw-r--r--source4/torture/raw/openbench.c29
2 files changed, 50 insertions, 8 deletions
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index 901b7dee7e..2197ccc010 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -244,6 +244,22 @@ static void lock_completion(struct smbcli_request *req)
}
+static void echo_completion(struct smbcli_request *req)
+{
+ struct benchlock_state *state = talloc_get_type(req->async.private,
+ struct benchlock_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)
{
@@ -258,16 +274,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;
}
}
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index 4ca7781754..b99259c618 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;
}
}