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.
This commit is contained in:
Ondřej Kuzník 2017-06-30 10:10:29 +01:00 committed by Ondřej Kuzník
parent 65def94380
commit 7046444327
2 changed files with 12 additions and 4 deletions

View file

@ -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" );

View file

@ -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" );