Commit 70464443 authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Ondřej Kuzník
Browse files

Do not read on the last iteration.

When the pdu processing limit is hit, we still attempt to read another
PDU. If we succeed, the ber_get_next call in the read callback will
abort since a full PDU is already present.
parent 65def943
......@@ -130,8 +130,7 @@ handle_requests( void *ctx, void *arg )
int requests_handled = 0;
CONNECTION_LOCK_DECREF(c);
for ( ; requests_handled < slap_conn_max_pdus_per_cycle;
requests_handled++ ) {
for ( ;; ) {
BerElement *ber;
ber_tag_t tag;
ber_len_t len;
......@@ -145,6 +144,11 @@ handle_requests( void *ctx, void *arg )
}
/* Otherwise, handle_one_request leaves the connection locked */
if ( ++requests_handled >= slap_conn_max_pdus_per_cycle ) {
/* Do not read now, re-enable read event instead */
break;
}
if ( (ber = ber_alloc()) == NULL ) {
Debug( LDAP_DEBUG_ANY, "client_read_cb: "
"ber_alloc failed\n" );
......
......@@ -465,8 +465,7 @@ handle_responses( void *ctx, void *arg )
int responses_handled = 0;
CONNECTION_LOCK_DECREF(c);
for ( ; responses_handled < slap_conn_max_pdus_per_cycle;
responses_handled++ ) {
for ( ;; ) {
BerElement *ber;
ber_tag_t tag;
ber_len_t len;
......@@ -480,6 +479,11 @@ handle_responses( void *ctx, void *arg )
}
/* Otherwise, handle_one_response leaves the connection locked */
if ( ++responses_handled >= slap_conn_max_pdus_per_cycle ) {
/* Do not read now, re-enable read event instead */
break;
}
if ( (ber = ber_alloc()) == NULL ) {
Debug( LDAP_DEBUG_ANY, "handle_responses: "
"ber_alloc failed\n" );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment