]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
hang the timeout event off state and thus we dont need to explicitely
authorRonnie Sahlberg <sahlberg@ronnie>
Sun, 6 May 2007 21:54:17 +0000 (07:54 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Sun, 6 May 2007 21:54:17 +0000 (07:54 +1000)
free it   and also we wont accidentally return from the function without
killing the event first

(This used to be ctdb commit e3d72d024ef7342a808e5c488fd646a39e5fac78)

ctdb/common/ctdb_client.c

index e51c31bc2d318586e51acf1287000941da6b51b7..02ad4c2d0e2e37fb1cf5cd6cc8e8698ee31bb3ed 100644 (file)
@@ -679,7 +679,6 @@ int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint64_t srvid,
        size_t len;
        int ret;
        uint32_t timed_out;
-       struct timed_event *te=NULL;
 
        /* if the domain socket is not yet open, open it */
        if (ctdb->daemon.sd==-1) {
@@ -723,7 +722,7 @@ int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint64_t srvid,
        /* semi-async operation */
        timed_out = 0;
        if (timeout) {
-               te=event_add_timed(ctdb->ev, mem_ctx, *timeout, timeout_func, &timed_out);
+               event_add_timed(ctdb->ev, state, *timeout, timeout_func, &timed_out);
        }
        while ((state->state == CTDB_CALL_WAIT)
        &&      (timed_out == 0) ){
@@ -734,10 +733,6 @@ int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint64_t srvid,
                return -1;
        }
 
-       if ((timed_out==0) && te) {
-               talloc_free(te);
-       }
-
        if (outdata) {
                *outdata = state->outdata;
                outdata->dptr = talloc_memdup(mem_ctx, outdata->dptr, outdata->dsize);