dovecot-2.2: auth ldap: If ldap debug_level>0, log how long init...
dovecot at dovecot.org
dovecot at dovecot.org
Tue May 28 18:19:21 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/c6165b5d6cce
changeset: 16409:c6165b5d6cce
user: Timo Sirainen <tss at iki.fi>
date: Tue May 28 18:18:45 2013 +0300
description:
auth ldap: If ldap debug_level>0, log how long initialization took.
diffstat:
src/auth/db-ldap.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diffs (42 lines):
diff -r 5a223c6d833f -r c6165b5d6cce src/auth/db-ldap.c
--- a/src/auth/db-ldap.c Tue May 28 17:30:42 2013 +0300
+++ b/src/auth/db-ldap.c Tue May 28 18:18:45 2013 +0300
@@ -10,6 +10,7 @@
#include "hash.h"
#include "aqueue.h"
#include "str.h"
+#include "time-util.h"
#include "env-util.h"
#include "var-expand.h"
#include "settings.h"
@@ -1099,11 +1100,17 @@
int db_ldap_connect(struct ldap_connection *conn)
{
+ bool debug = atoi(conn->set.debug_level) > 0;
+ struct timeval start, end;
int ret;
if (conn->conn_state != LDAP_CONN_STATE_DISCONNECTED)
return 0;
+ if (debug) {
+ if (gettimeofday(&start, NULL) < 0)
+ memset(&start, 0, sizeof(start));
+ }
i_assert(conn->pending_count == 0);
if (conn->ld == NULL) {
if (conn->set.uris != NULL) {
@@ -1170,6 +1177,12 @@
if (db_ldap_bind(conn) < 0)
return -1;
}
+ if (debug) {
+ if (gettimeofday(&end, NULL) == 0) {
+ int msecs = timeval_diff_msecs(&end, &start);
+ i_debug("LDAP initialization took %d msecs", msecs);
+ }
+ }
db_ldap_get_fd(conn);
conn->io = io_add(conn->fd, IO_READ, ldap_input, conn);
More information about the dovecot-cvs
mailing list