summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7bab45b)
raw | patch | inline | side by side (parent: 7bab45b)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Wed, 14 Oct 2015 15:44:04 +0000 (17:44 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Fri, 16 Oct 2015 09:53:41 +0000 (11:53 +0200) |
Removes the overhead of connection setup/teardown at each read interval.
src/openldap.c | patch | blob | history |
diff --git a/src/openldap.c b/src/openldap.c
index ffcdb94e8049000961cd19bc65a167387532f9c0..1ef9f7b9aa8b43736ce4aa4e7ea60d96813d02e7 100644 (file)
--- a/src/openldap.c
+++ b/src/openldap.c
{
LDAP *ld;
int rc;
+
+ if (st->state && st->ld)
+ {
+ DEBUG ("openldap plugin: Already connected to %s", st->url);
+ return (0);
+ }
+
rc = ldap_initialize (&ld, st->url);
if (rc != LDAP_SUCCESS)
{
ERROR ("openldap plugin: Failed to execute search: %s",
ldap_err2string (rc));
ldap_msgfree (result);
+ st->state = 0;
ldap_unbind_ext_s (st->ld, NULL, NULL);
return (-1);
}
}
ldap_msgfree (result);
- ldap_unbind_ext_s (st->ld, NULL, NULL);
return (0);
} /* }}} int cldap_read_host */