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();
}
* create/unlink the socket; likely need exec perms to access
* the socket (ITS#4709) */
{
- mode_t old_umask;
+ mode_t old_umask = 0;
if ( (*sal)->sa_family == AF_LOCAL ) {
old_umask = umask( 0 );
#endif /* LDAP_PF_LOCAL */
rc = bind( s, *sal, addrlen );
#ifdef LDAP_PF_LOCAL
- if ( (*sal)->sa_family == AF_LOCAL ) {
+ if ( old_umask != 0 ) {
umask( old_umask );
}
}
*/
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 {
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 );
#ifdef HAVE_EPOLL
/* Don't keep reporting the hangup
*/
- SLAP_EPOLL_SOCK_SET( fd, EPOLLET );
+ if ( SLAP_SOCK_IS_ACTIVE( fd )) {
+ SLAP_EPOLL_SOCK_SET( fd, EPOLLET );
+ }
#endif
}
connection_read_activate( fd );