When a secondary messaging context is initialized, we need to register
its tevent context with the lower level dgm context. Seen when using
smbstatus with clustering.
The TALLOC_FREE(r->tevent_handle) in the destructor might not be
necessary, but I want to free the tevent reference before
the context goes away.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
struct msg_dgm_ref {
struct msg_dgm_ref *prev, *next;
+ void *tevent_handle;
void (*recv_cb)(const uint8_t *msg, size_t msg_len,
int *fds, size_t num_fds, void *private_data);
void *recv_cb_private_data;
*err = ENOMEM;
return NULL;
}
+ result->tevent_handle = NULL;
tmp_refs = refs;
return NULL;
}
dgm_pid = getpid();
+ } else {
+ result->tevent_handle = messaging_dgm_register_tevent_context(
+ result, ev);
+ if (result->tevent_handle == NULL) {
+ TALLOC_FREE(result);
+ *err = ENOMEM;
+ return NULL;
+ }
}
refs = tmp_refs;
}
DLIST_REMOVE(refs, r);
+ TALLOC_FREE(r->tevent_handle);
+
if (refs == NULL) {
messaging_dgm_destroy();
}