create_conn_struct_tos() and connection re-use

Jeremy Allison jra at samba.org
Sat Jun 23 04:32:30 UTC 2018


On Sat, Jun 23, 2018 at 02:55:02PM +1200, Andrew Bartlett via samba-technical wrote:
> 
> > But using talloc_tos() in the python wrappers
> > doesn't make this any harder than it already
> > was using the original create_conn_struct()
> > code. You could try using talloc_move() to
> > move off the frame onto a long-term context
> > that you have to return to python somehow,
> > and then explicitly free the object when
> > you're done.
> 
> OK.  I'm not sure that is entirely safe - isn't the point that we want
> the destructor definitively called pair-wise with the create?  That
> isn't really a great match for python objects, we could have two of
> them for example. 

Oh it should be safe, so long as the destructor gets called.
It's just really ugly, and not how it's meant to be done :-).

The whole point of those create_conn_struct_tos() (and original
code) was that this was a temporary context created within a
function in order to do something that needed VFS calls, then
deleted - not long lived.

That's why it was a perfect fit for independent python
create -> do some VFS call -> delete functions.

For long-lived contexts, not so much :-).



More information about the samba-technical mailing list