svn commit: samba r23181 - in
branches/SAMBA_4_0/source/torture/raw: .
tridge at samba.org
tridge at samba.org
Tue May 29 08:22:45 GMT 2007
Author: tridge
Date: 2007-05-29 08:22:45 +0000 (Tue, 29 May 2007)
New Revision: 23181
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23181
Log:
prevent attempts to reopen the connection twice at the same time
Modified:
branches/SAMBA_4_0/source/torture/raw/lockbench.c
branches/SAMBA_4_0/source/torture/raw/openbench.c
Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-29 07:32:28 UTC (rev 23180)
+++ branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-29 08:22:45 UTC (rev 23181)
@@ -54,6 +54,7 @@
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 @@
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 @@
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 @@
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);
}
}
Modified: branches/SAMBA_4_0/source/torture/raw/openbench.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/openbench.c 2007-05-29 07:32:28 UTC (rev 23180)
+++ branches/SAMBA_4_0/source/torture/raw/openbench.c 2007-05-29 08:22:45 UTC (rev 23181)
@@ -57,6 +57,7 @@
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 @@
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 @@
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 @@
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 @@
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);
}
}
More information about the samba-cvs
mailing list