]> git.sur5r.net Git - openldap/commitdiff
ITS#5836 more for 1.432, writetimeout wasn't taking effect if
authorHoward Chu <hyc@openldap.org>
Mon, 6 Jul 2009 21:02:28 +0000 (21:02 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 6 Jul 2009 21:02:28 +0000 (21:02 +0000)
idletimeout wasn't also set. Also, timeout check would keep getting
pushed back if multiple writers were waiting.

servers/slapd/daemon.c

index 2350fdcd9ef46f06abcaa19c1e4b6dbbe4456395..8e4e853f2c2d3c977c8a2440f93ca440c7373f0b 100644 (file)
@@ -957,7 +957,7 @@ slapd_set_write( ber_socket_t s, int wake )
                SLAP_SOCK_SET_WRITE( s );
                slap_daemon.sd_nwriters++;
        }
-       if (( wake & 2 ) && global_writetimeout ) {
+       if (( wake & 2 ) && global_writetimeout && !chk_writetime ) {
                chk_writetime = slap_get_time();
        }
 
@@ -2177,7 +2177,7 @@ slapd_daemon_task(
                         */
                        if ( chk_writetime ) {
                                tv.tv_sec = global_writetimeout;
-                               tv.tv_usec = global_writetimeout;
+                               tv.tv_usec = 0;
                                if ( difftime( chk_writetime, now ) < 0 )
                                        check = 2;
                        } else {
@@ -2245,7 +2245,7 @@ slapd_daemon_task(
 
                nfds = SLAP_EVENT_MAX;
 
-               if ( global_idletimeout && slap_daemon.sd_nactives ) at = 1;
+               if (( chk_writetime || global_idletimeout ) && slap_daemon.sd_nactives ) at = 1;
 
                ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );