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

Re: init, open, and close



At 05:33 PM 8/21/00 -0400, Michael Rothwell wrote:
>I'm writing a Gnome panel applet to do address-book (mainly phone
>extensions) lookups from an Exchange server using LDAP. The problem I'm
>having is with closed connections. Is there a way to tell if a
>connection returned from ldap_init() and/or ldap_open is now invalid?

Do any API call which generates a request and example the
result code returned.

> If
>I re-run ldap_init() on each request, it works, but piles up open
>connections.

Use ldap_unbind() to close the connection when done.

>If I don't, with inactivity (over lunch, say), then the
>connection times out.

Raise your idle timers.

>How do I close a connection?

ldap_unbind()

>How do I test a connection?

Try any API call which generates a protocol request, like ldap_search().


>Protocol and other errors seem to cause segfaults.

You are mostly likely not using the API as directed.

>Should I catch
>SIGSEGV?

In general, no.

>Or is there a better way? For instance, ldap_search_s()
>segfaults far too often when talking to Exchange.

You are likely not using the API as directed.