mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-27 18:19:52 -05:00
ITS#3549 allow one op to progress when a socket with writewaiters
becomes ready to write.
This commit is contained in:
parent
beaeb5ed5c
commit
6cbe778c81
1 changed files with 21 additions and 0 deletions
|
|
@ -1635,6 +1635,7 @@ static int connection_op_activate( Operation *op )
|
|||
int connection_write(ber_socket_t s)
|
||||
{
|
||||
Connection *c;
|
||||
Operation *op;
|
||||
|
||||
assert( connections != NULL );
|
||||
|
||||
|
|
@ -1666,6 +1667,26 @@ int connection_write(ber_socket_t s)
|
|||
if ( ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_NEEDS_WRITE, NULL ) ) {
|
||||
slapd_set_write( s, 1 );
|
||||
}
|
||||
/* If there are ops pending because of a writewaiter, start
|
||||
* one up.
|
||||
*/
|
||||
while ((op = LDAP_STAILQ_FIRST( &c->c_pending_ops )) != NULL) {
|
||||
if ( !c->c_writewaiter ) break;
|
||||
if ( c->c_n_ops_executing > connection_pool_max/2 ) {
|
||||
break;
|
||||
}
|
||||
LDAP_STAILQ_REMOVE_HEAD( &c->c_pending_ops, o_next );
|
||||
LDAP_STAILQ_NEXT(op, o_next) = NULL;
|
||||
/* pending operations should not be marked for abandonment */
|
||||
assert(!op->o_abandon);
|
||||
|
||||
c->c_n_ops_pending--;
|
||||
c->c_n_ops_executing++;
|
||||
|
||||
connection_op_activate( op );
|
||||
|
||||
break;
|
||||
}
|
||||
connection_return( c );
|
||||
ldap_pvt_thread_mutex_unlock( &connections_mutex );
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue