a little change in _send functions of libnet
Stefan (metze) Metzmacher
metze at samba.org
Sun Dec 17 22:32:34 GMT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Rafal,
> I'm thinking about changing _send functions so that they don't
> take TALLOC_CTX argument. This means the composite context would
> be based on libnet_context from the very beginning (right in
> composite_create call). TALLOC_CTX would in such case be used
> in _recv calls, for transferring the libnet function results.
yes, it should be used in the _recv call for transferring the results,
but also in the _send() call passed to composite_create()
> This could simplify the code a bit, and make all memory allocation
> depend on single libnet_context.
I don't see how this will simply the code, if we pass libnet_ctx to
composite_create()
I think the rule should be to pass the callers mem_ctx to
composite_create() then allocate the calls private state under the
composite_context and then all subrequests on the private_state.
then the recv() call transferrs results to the given mem_ctx
and calls talloc_free(composite_context)
then only the results are left on the callers mem_ctx and the rest is
free'ed.
> Thoughts ?
I don't think that's a good idea, because if the composite_context
is a child of a given memory then the request will be removed with a
talloc_free() on the parent context too, with out an explicit
talloc_free() on the request composite_context.
I know we do current what you propose in some other client libs,
but I'm not sure if that's good there too...
metze
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFFhcWBm70gjA5TCD8RApY/AKDSXIe3UNKSbBbkS/RTEob4zo2/DgCgiZmS
UypV9srFXR4g6XOckR/v674=
=5J+P
-----END PGP SIGNATURE-----
More information about the samba-technical
mailing list