[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: library questions: LDAPMessage, msgid, ...

Hallvard B Furuseth <h.b.furuseth@usit.uio.no> wrote:
> msgid is just a 32-bit integer.

So is a file descriptor, yet it identifies a resource that should be
destroyed at the appropriate time.  I figured msgid is similar: any
particular integer value is not meaningful as a msgid until is it
returned by some asynchronous operation; after that, it refers to some
LDAPMessage that can can be retrieved by ldap_result().

Suppose I do an asynchronous search.  The server's response is
received on the client socket, but before I call ldap_result() to get
the LDAPMessage object, I unbind the LDAP object.  Then is there
anything related to the msgid that I have to destroy?  (I imagine this
situation would probably be a programming error, but my library won't
be able to ensure that it won't happen, and garbage collection makes
it hard to predict what order things will happen in.)

> You are responsible for destroying them, but I don't think you need to
> destroy them _before_ the LDAP* if you don't want to.  Though I prefer
> to do it that way myself, it seems cleaner.

Ok.  I'll keep a reference to the corresponding LDAP object along with
each object created from it, and I'll check that the LDAP object is
still valid before using the LDAPMessage or whatever.  I won't destroy
anything until the Scheme object containing it is garbage collected.