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.
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;
}
/* 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" );
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;
}
/* 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" );