Author: tridge
Date: 2007-05-15 03:00:58 +0000 (Tue, 15 May 2007)
New Revision: 22876

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22876

Log:

- try to reconnect once per second, not continously
- patch from ronnie to fix the lock offset on reconnect

Modified:
   branches/SAMBA_4_0/source/torture/raw/lockbench.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/lockbench.c   2007-05-15 01:57:21 UTC 
(rev 22875)
+++ branches/SAMBA_4_0/source/torture/raw/lockbench.c   2007-05-15 03:00:58 UTC 
(rev 22876)
@@ -88,7 +88,8 @@
        state->offset = (state->offset+1)%nprocs;
 }
 
-static void reopen_connection(struct benchlock_state *state);
+static void reopen_connection(struct event_context *ev, struct timed_event 
*te, 
+                             struct timeval t, void *private_data);
 
 
 static void reopen_file(struct event_context *ev, struct timed_event *te, 
@@ -114,7 +115,6 @@
        }
        state->req->async.private = state;
        state->req->async.fn      = lock_completion;
-       state->offset = (state->offset+1)%nprocs;
 }
 
 /*
@@ -128,7 +128,9 @@
 
        status = smb_composite_connect_recv(ctx, state->mem_ctx);
        if (!NT_STATUS_IS_OK(status)) {
-               reopen_connection(state);
+               event_add_timed(state->ev, state->mem_ctx, 
+                               timeval_current_ofs(1,0), 
+                               reopen_connection, state);
                return;
        }
 
@@ -142,10 +144,12 @@
        
 
 /*
-  reopen dead connections
+  reopen a connection
  */
-static void reopen_connection(struct benchlock_state *state)
+static void reopen_connection(struct event_context *ev, struct timed_event 
*te, 
+                             struct timeval t, void *private_data)
 {
+       struct benchlock_state *state = (struct benchlock_state *)private_data;
        struct composite_context *ctx;
        struct smb_composite_connect *io = &state->reconnect;
        char *host, *share;
@@ -191,7 +195,9 @@
        state->req = NULL;
        if (!NT_STATUS_IS_OK(status)) {
                if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
-                       reopen_connection(state);
+                       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++;

Reply via email to