mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-14 00:03:56 -05:00
Logging improvements
This commit is contained in:
parent
f37e7757b1
commit
4ad8ecd45e
3 changed files with 39 additions and 22 deletions
|
|
@ -42,7 +42,8 @@ client_read_cb( evutil_socket_t s, short what, void *arg )
|
|||
|
||||
ber = c->c_currentber;
|
||||
if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "client_read_cb: "
|
||||
"ber_alloc failed\n" );
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -52,8 +53,9 @@ client_read_cb( evutil_socket_t s, short what, void *arg )
|
|||
|
||||
if ( err != EWOULDBLOCK && err != EAGAIN ) {
|
||||
char ebuf[128];
|
||||
Debug( LDAP_DEBUG_ANY, "ber_get_next on fd %d failed errno=%d (%s)\n", c->c_fd,
|
||||
err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
|
||||
Debug( LDAP_DEBUG_ANY, "client_read_cb: "
|
||||
"ber_get_next on fd %d failed errno=%d (%s)\n",
|
||||
c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
|
||||
|
||||
c->c_currentber = NULL;
|
||||
goto fail;
|
||||
|
|
@ -67,7 +69,8 @@ client_read_cb( evutil_socket_t s, short what, void *arg )
|
|||
|
||||
op = operation_init( c, ber );
|
||||
if ( !op ) {
|
||||
Debug( LDAP_DEBUG_ANY, "operation_init failed\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "client_read_cb: "
|
||||
"operation_init failed\n" );
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +137,8 @@ client_init(
|
|||
|
||||
event = event_new( base, s, EV_READ|EV_PERSIST, client_read_cb, c );
|
||||
if ( !event ) {
|
||||
Debug( LDAP_DEBUG_ANY, "Read event could not be allocated\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "client_init: "
|
||||
"Read event could not be allocated\n" );
|
||||
goto fail;
|
||||
}
|
||||
event_add( event, NULL );
|
||||
|
|
@ -142,7 +146,8 @@ client_init(
|
|||
|
||||
event = event_new( base, s, EV_WRITE, client_write_cb, c );
|
||||
if ( !event ) {
|
||||
Debug( LDAP_DEBUG_ANY, "Write event could not be allocated\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "client_init: "
|
||||
"Write event could not be allocated\n" );
|
||||
goto fail;
|
||||
}
|
||||
/* We only register the write event when we have data pending */
|
||||
|
|
|
|||
|
|
@ -168,6 +168,10 @@ operation_init( Connection *c, BerElement *ber )
|
|||
ber_skip_element( ber, &op->o_ctrls );
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "operation_init: "
|
||||
"set up a new operation, %s with msgid=%d for client %lu\n",
|
||||
slap_msgtype2str( op->o_tag ), op->o_client_msgid, c->c_connid );
|
||||
|
||||
return op;
|
||||
|
||||
fail:
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ upstream_read_cb( evutil_socket_t s, short what, void *arg )
|
|||
|
||||
ber = c->c_currentber;
|
||||
if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_read_cb: "
|
||||
"ber_alloc failed\n" );
|
||||
ldap_pvt_thread_mutex_unlock( &c->c_mutex );
|
||||
return;
|
||||
}
|
||||
|
|
@ -54,8 +55,9 @@ upstream_read_cb( evutil_socket_t s, short what, void *arg )
|
|||
|
||||
if ( err != EWOULDBLOCK && err != EAGAIN ) {
|
||||
char ebuf[128];
|
||||
Debug( LDAP_DEBUG_ANY, "ber_get_next on fd %d failed errno=%d (%s)\n", c->c_fd,
|
||||
err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_read_cb: "
|
||||
"ber_get_next on fd %d failed errno=%d (%s)\n",
|
||||
c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
|
||||
|
||||
c->c_currentber = NULL;
|
||||
goto fail;
|
||||
|
|
@ -146,13 +148,15 @@ upstream_finish( Connection *c )
|
|||
evutil_socket_t s = c->c_fd;
|
||||
|
||||
Debug( LDAP_DEBUG_CONNS, "upstream_finish: "
|
||||
"connection %lu is ready for use\n", c->c_connid );
|
||||
"connection %lu is ready for use\n",
|
||||
c->c_connid );
|
||||
|
||||
base = slap_get_base( s );
|
||||
|
||||
event = event_new( base, s, EV_READ|EV_PERSIST, upstream_read_cb, c );
|
||||
if ( !event ) {
|
||||
Debug( LDAP_DEBUG_ANY, "Read event could not be allocated\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_finish: "
|
||||
"Read event could not be allocated\n" );
|
||||
goto fail;
|
||||
}
|
||||
event_add( event, NULL );
|
||||
|
|
@ -196,7 +200,8 @@ upstream_bind_cb( evutil_socket_t s, short what, void *arg )
|
|||
|
||||
ber = c->c_currentber;
|
||||
if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
|
||||
"ber_alloc failed\n" );
|
||||
ldap_pvt_thread_mutex_unlock( &c->c_mutex );
|
||||
return;
|
||||
}
|
||||
|
|
@ -207,8 +212,9 @@ upstream_bind_cb( evutil_socket_t s, short what, void *arg )
|
|||
|
||||
if ( err != EWOULDBLOCK && err != EAGAIN ) {
|
||||
char ebuf[128];
|
||||
Debug( LDAP_DEBUG_ANY, "ber_get_next on fd %d failed errno=%d (%s)\n", c->c_fd,
|
||||
err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
|
||||
"ber_get_next on fd %d failed errno=%d (%s)\n",
|
||||
c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
|
||||
|
||||
c->c_currentber = NULL;
|
||||
goto fail;
|
||||
|
|
@ -220,22 +226,22 @@ upstream_bind_cb( evutil_socket_t s, short what, void *arg )
|
|||
c->c_currentber = NULL;
|
||||
|
||||
if ( ber_scanf( ber, "it", &msgid, &tag ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb:"
|
||||
" protocol violation from server\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
|
||||
"protocol violation from server\n" );
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ( msgid != ( c->c_next_msgid - 1 ) || tag != LDAP_RES_BIND ) {
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb:"
|
||||
" unexpected %s from server, msgid=%d\n",
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
|
||||
"unexpected %s from server, msgid=%d\n",
|
||||
slap_msgtype2str( tag ), msgid );
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ( ber_scanf( ber, "{eAA" /* "}" */, &result, &matcheddn, &message ) ==
|
||||
LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb:"
|
||||
" response does not conform with a bind response\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
|
||||
"response does not conform with a bind response\n" );
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -315,7 +321,8 @@ upstream_bind( void *ctx, void *arg )
|
|||
|
||||
event = event_new( base, s, EV_READ|EV_PERSIST, upstream_bind_cb, c );
|
||||
if ( !event ) {
|
||||
Debug( LDAP_DEBUG_ANY, "Read event could not be allocated\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_bind: "
|
||||
"Read event could not be allocated\n" );
|
||||
upstream_destroy( c );
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -373,7 +380,8 @@ upstream_init( ber_socket_t s, Backend *b )
|
|||
|
||||
event = event_new( base, s, EV_WRITE, upstream_write_cb, c );
|
||||
if ( !event ) {
|
||||
Debug( LDAP_DEBUG_ANY, "Write event could not be allocated\n" );
|
||||
Debug( LDAP_DEBUG_ANY, "upstream_init: "
|
||||
"Write event could not be allocated\n" );
|
||||
goto fail;
|
||||
}
|
||||
/* We only register the write event when we have data pending */
|
||||
|
|
|
|||
Loading…
Reference in a new issue