more cleanup in handling timeouts in ldap_result()

This commit is contained in:
Pierangelo Masarati 2005-04-26 21:48:43 +00:00
parent bb21f09d1f
commit 58a358e7b2
2 changed files with 33 additions and 5 deletions

View File

@ -181,7 +181,8 @@ meta_back_single_bind(
struct berval mdn = BER_BVNULL;
dncookie dc;
metasingleconn_t *msc = &mc->mc_conns[ candidate ];
int msgid;
int msgid,
rebinding = 0;
/*
* Rewrite the bind dn if needed
@ -230,12 +231,27 @@ retry:;
goto retry;
}
rs->sr_err = LDAP_BUSY;
break;
if ( rebinding ) {
ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
break;
}
/* FIXME: some times the request times out
* while the other party is not willing to
* send a response any more. Give it a second
* chance with a freshly bound connection */
rebinding = 1;
nretries = mt->mt_nretries;
/* fallthru */
case -1:
ldap_get_option( msc->msc_ld, LDAP_OPT_ERROR_NUMBER,
&rs->sr_err );
if ( rebinding ) {
ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
}
Debug( LDAP_DEBUG_ANY, "### %s meta_back_single_bind: err=%d nretries=%d\n",
op->o_log_prefix, rs->sr_err, nretries );
@ -365,6 +381,7 @@ retry:;
rc = LDAP_BUSY;
if ( rebinding ) {
ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
break;
}
@ -380,6 +397,10 @@ retry:;
ldap_get_option( msc->msc_ld,
LDAP_OPT_ERROR_NUMBER, &rs->sr_err );
if ( rebinding ) {
ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
}
Debug( LDAP_DEBUG_ANY, "### %s meta_back_single_dobind: err=%d nretries=%d\n",
op->o_log_prefix, rs->sr_err, nretries );

View File

@ -388,6 +388,7 @@ really_bad:;
gotit = 1;
#if 0
/*
* If scope is BASE, we need to jump out
* as soon as one entry is found; if
@ -395,6 +396,10 @@ really_bad:;
* this should correspond to the sole
* entry that has the base DN
*/
/* FIXME: this defeats the purpose of
* doing a search with scope == base and
* sizelimit = 1 to determine if a
* candidate is actually unique */
if ( op->ors_scope == LDAP_SCOPE_BASE
&& rs->sr_nentries > 0 )
{
@ -403,6 +408,7 @@ really_bad:;
sres = LDAP_SUCCESS;
break;
}
#endif
} else if ( rc == LDAP_RES_SEARCH_REFERENCE ) {
char **references = NULL;
@ -843,12 +849,13 @@ meta_send_entry(
}
if ( ber_scanf( &ber, "[W]", &attr->a_vals ) == LBER_ERROR
|| attr->a_vals == NULL ) {
|| attr->a_vals == NULL )
{
attr->a_vals = (struct berval *)&slap_dummy_bv;
} else if ( attr->a_desc == slap_schema.si_ad_objectClass
|| attr->a_desc == slap_schema.si_ad_structuralObjectClass ) {
|| attr->a_desc == slap_schema.si_ad_structuralObjectClass )
{
for ( last = 0; !BER_BVISNULL( &attr->a_vals[ last ] ); ++last );
for ( bv = attr->a_vals; !BER_BVISNULL( bv ); bv++ ) {