Debug( LDAP_DEBUG_TRACE, "read1msg: msgid %d, all %d\n", msgid, all, 0 );
#endif
+retry:
if ( lc->lconn_ber == NULL ) {
lc->lconn_ber = ldap_alloc_ber_with_options(ld);
ber = lc->lconn_ber;
assert( LBER_VALID (ber) );
+retry2:
/* get the next message */
errno = 0;
#ifdef LDAP_CONNECTIONLESS
/* if it's been abandoned, toss it */
if ( ldap_abandoned( ld, id ) ) {
- ber_free( ber, 1 );
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, DETAIL1, "read1msg: abandoned\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "abandoned\n", 0, 0, 0);
#endif
+retry_ber:
+ if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
+ ber_init2( ber, NULL, ld->ld_lberoptions );
+ goto retry2;
+ }
+ ber_free( ber, 1 );
return( -2 ); /* continue looking */
}
"no request for response with msgid %ld (tossing)\n",
(long) id, 0, 0 );
#endif
- ber_free( ber, 1 );
- return( -2 ); /* continue looking */
+ goto retry_ber;
}
#ifdef LDAP_CONNECTIONLESS
if (LDAP_IS_UDP(ld) && ld->ld_options.ldo_version == LDAP_VERSION2) {
new->lm_next = ld->ld_responses;
ld->ld_responses = new;
- return( -2 ); /* continue looking */
+ goto leave;
}
#ifdef NEW_LOGGING
#endif /* !LDAP_WORLD_P16 */
}
+leave:
+ if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
+ goto retry;
+ }
return( -2 ); /* continue looking */
}