]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/result.c
ITS#8329 finish prev commit
[openldap] / servers / slapd / result.c
index 0f1336a17fcbba43cabb0f60259cf2ec89cd7778..d589b73afbb5838add96b0f1afa45da443b28287 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2014 The OpenLDAP Foundation.
+ * Copyright 1998-2015 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -279,6 +279,22 @@ rs_entry2modifiable( Operation *op, SlapReply *rs, slap_overinst *on )
        return 1;
 }
 
+/* Check for any callbacks that want to be informed about being blocked
+ * on output. These callbacks are expected to leave the callback list
+ * unmodified. Their result is ignored.
+ */
+static void
+slap_writewait_play(
+       Operation *op )
+{
+       slap_callback   *sc = op->o_callback;
+
+       for ( ; sc; sc = sc->sc_next ) {
+               if ( sc->sc_writewait )
+                       sc->sc_writewait( op, sc );
+       }
+}
+
 static long send_ldap_ber(
        Operation *op,
        BerElement *ber )
@@ -348,6 +364,7 @@ static long send_ldap_ber(
                }
 
                /* wait for socket to be write-ready */
+               slap_writewait_play( op );
                ldap_pvt_thread_mutex_lock( &conn->c_write2_mutex );
                conn->c_writewaiter = 1;
                slapd_set_write( conn->c_sd, 2 );