s4:lib/tevent: rename structs
[ira/wip.git] / source4 / torture / raw / openbench.c
index a5b1434a47417e2a2f27771493ec982ee2ca4b9b..a9ce4aec0d994da152060077f4df6c018ccfa873 100644 (file)
@@ -41,12 +41,12 @@ static int open_failed;
 static int close_failed;
 static char **fnames;
 static int num_connected;
-static struct timed_event *report_te;
+static struct tevent_timer *report_te;
 
 struct benchopen_state {
        struct torture_context *tctx;
        TALLOC_CTX *mem_ctx;
-       struct event_context *ev;
+       struct tevent_context *ev;
        struct smbcli_state *cli;
        struct smbcli_tree *tree;
        int client_num;
@@ -64,7 +64,7 @@ struct benchopen_state {
        struct smbcli_request *req_open;
        struct smbcli_request *req_close;
        struct smb_composite_connect reconnect;
-       struct timed_event *te;
+       struct tevent_timer *te;
 
        /* these are used for reconnections */
        const char **dest_ports;
@@ -74,7 +74,7 @@ struct benchopen_state {
 };
 
 static void next_open(struct benchopen_state *state);
-static void reopen_connection(struct event_context *ev, struct timed_event *te, 
+static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te, 
                              struct timeval t, void *private_data);
 
 
@@ -113,7 +113,7 @@ static void reopen_connection_complete(struct composite_context *ctx)
 /*
   reopen a connection
  */
-static void reopen_connection(struct event_context *ev, struct timed_event *te, 
+static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te, 
                              struct timeval t, void *private_data)
 {
        struct benchopen_state *state = (struct benchopen_state *)private_data;
@@ -130,13 +130,16 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
 
        io->in.dest_host    = state->dest_host;
        io->in.dest_ports   = state->dest_ports;
+       io->in.socket_options = lp_socket_options(state->tctx->lp_ctx);
        io->in.called_name  = state->called_name;
        io->in.service      = share;
        io->in.service_type = state->service_type;
        io->in.credentials  = cmdline_credentials;
        io->in.fallback_to_anonymous = false;
        io->in.workgroup    = lp_workgroup(state->tctx->lp_ctx);
+       io->in.gensec_settings = lp_gensec_settings(state->mem_ctx, state->tctx->lp_ctx);
        lp_smbcli_options(state->tctx->lp_ctx, &io->in.options);
+       lp_smbcli_session_options(state->tctx->lp_ctx, &io->in.session_options);
 
        /* kill off the remnants of the old connection */
        talloc_free(state->tree);
@@ -325,7 +328,7 @@ static void echo_completion(struct smbcli_request *req)
        }
 }
 
-static void report_rate(struct event_context *ev, struct timed_event *te, 
+static void report_rate(struct tevent_context *ev, struct tevent_timer *te, 
                        struct timeval t, void *private_data)
 {
        struct benchopen_state *state = talloc_get_type(private_data, 
@@ -369,7 +372,6 @@ bool torture_bench_open(struct torture_context *torture)
        int i;
        int timelimit = torture_setting_int(torture, "timelimit", 10);
        struct timeval tv;
-       struct event_context *ev = event_context_find(mem_ctx);
        struct benchopen_state *state;
        int total = 0;
        int total_retries = 0;
@@ -387,8 +389,8 @@ bool torture_bench_open(struct torture_context *torture)
                state[i].tctx = torture;
                state[i].mem_ctx = talloc_new(state);
                state[i].client_num = i;
-               state[i].ev = ev;
-               if (!torture_open_connection_ev(&state[i].cli, i, torture, ev)) {
+               state[i].ev = torture->ev;
+               if (!torture_open_connection_ev(&state[i].cli, i, torture, torture->ev)) {
                        return false;
                }
                talloc_steal(mem_ctx, state);
@@ -428,13 +430,13 @@ bool torture_bench_open(struct torture_context *torture)
        tv = timeval_current(); 
 
        if (progress) {
-               report_te = event_add_timed(ev, state, timeval_current_ofs(1, 0), 
+               report_te = event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), 
                                            report_rate, state);
        }
 
        printf("Running for %d seconds\n", timelimit);
        while (timeval_elapsed(&tv) < timelimit) {
-               event_loop_once(ev);
+               event_loop_once(torture->ev);
 
                if (open_failed) {
                        DEBUG(0,("open failed\n"));