1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00

r23181: prevent attempts to reopen the connection twice at the same time

This commit is contained in:
Andrew Tridgell 2007-05-29 08:22:45 +00:00 committed by Gerald (Jerry) Carter
parent 32a6c268a7
commit a25c27dbae
2 changed files with 30 additions and 21 deletions

View File

@ -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,7 +149,8 @@ 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,
talloc_free(state->te);
state->te = event_add_timed(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
reopen_connection, state);
return;
@ -218,7 +220,8 @@ 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,
talloc_free(state->te);
state->te = event_add_timed(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
reopen_connection, state);
} else {
@ -256,7 +259,8 @@ 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,
talloc_free(state->te);
state->te = event_add_timed(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
reopen_connection, state);
}

View File

@ -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,7 +82,8 @@ 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,
talloc_free(state->te);
state->te = event_add_timed(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
reopen_connection, state);
return;
@ -210,7 +212,8 @@ 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,
talloc_free(state->te);
state->te = event_add_timed(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
reopen_connection, state);
return;
@ -262,7 +265,8 @@ 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,
talloc_free(state->te);
state->te = event_add_timed(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
reopen_connection, state);
return;
@ -289,7 +293,8 @@ 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,
talloc_free(state->te);
state->te = event_add_timed(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
reopen_connection, state);
}