s3: Open gencache_notrans with TDB_NOSYNC
[kai/samba.git] / source3 / lib / msg_channel.c
index 9a174c0ed65fae8582faf19f994271ccf2ae01c8..c68c11ec2f0c8210895dc511ebc17e418728993b 100644 (file)
@@ -44,7 +44,7 @@ static void msg_channel_init_got_msg(struct messaging_context *msg,
 static void msg_channel_trigger(struct tevent_context *ev,
                                struct tevent_immediate *im,
                                void *priv);
-static int msg_channel_init_destructor(struct msg_channel *s);
+static int msg_channel_destructor(struct msg_channel *s);
 
 struct tevent_req *msg_channel_init_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev,
@@ -105,11 +105,11 @@ static void msg_channel_init_got_ctdb(struct tevent_req *subreq)
                tevent_req_error(req, map_errno_from_nt_status(status));
                return;
        }
-       talloc_set_destructor(s, msg_channel_init_destructor);
+       talloc_set_destructor(s, msg_channel_destructor);
        tevent_req_done(req);
 }
 
-static int msg_channel_init_destructor(struct msg_channel *s)
+static int msg_channel_destructor(struct msg_channel *s)
 {
        messaging_deregister(s->msg, s->msg_type, s);
        return 0;
@@ -196,7 +196,7 @@ static void msg_channel_init_got_msg(struct messaging_context *msg,
                return;
        }
 
-       im = tevent_create_immediate(s->ev);
+       im = tevent_create_immediate(s);
        if (im == NULL) {
                goto fail;
        }
@@ -300,7 +300,7 @@ static void msg_channel_trigger(struct tevent_context *ev,
        state->rec = talloc_move(state, &channel->msgs[0]);
 
        memmove(channel->msgs, channel->msgs+1,
-               sizeof(struct messaging_rec) * (num_msgs-1));
+               sizeof(struct messaging_rec *) * (num_msgs-1));
        channel->msgs = talloc_realloc(
                channel, channel->msgs, struct messaging_rec *, num_msgs - 1);
 
@@ -329,16 +329,19 @@ static void msg_read_got_ctdb(struct tevent_req *subreq)
                return;
        }
 
-       ndr_err = ndr_push_struct_blob(
+       ndr_err = ndr_pull_struct_blob(
                &blob, state->rec, state->rec,
-               (ndr_push_flags_fn_t)ndr_push_messaging_rec);
+               (ndr_pull_flags_fn_t)ndr_pull_messaging_rec);
 
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-               DEBUG(0, ("ndr_push_struct_blob failed: %s\n",
+               DEBUG(1, ("ndr_pull_struct_blob failed: %s\n",
                          ndr_errstr(ndr_err)));
                tevent_req_error(req, ndr_map_error2errno(ndr_err));
                return;
        }
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_DEBUG(messaging_rec, state->rec);
+       }
        if (state->rec->msg_type == state->channel->msg_type) {
                tevent_req_done(req);
                return;