From 577bfc477e02695fa6b33b5d59ff5e03aaf22cda Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 14 Oct 2005 22:04:03 +0000 Subject: [PATCH] More cleanup --- servers/slapd/connection.c | 12 ++++++------ servers/slapd/daemon.c | 13 +++++++------ servers/slapd/proto-slap.h | 7 +++++++ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index f4ce8f1d83..ec8a14c343 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -1498,14 +1498,14 @@ int connection_read(ber_socket_t s) ldap_pvt_thread_mutex_unlock( MCA_GET_CONN_MUTEX(s) ); #ifdef SLAP_LIGHTWEIGHT_LISTENER - slapd_resume( s ); + slapd_resume( s, 1 ); #endif return 0; } if ( c->c_conn_state == SLAP_C_CLIENT ) { #ifdef SLAP_LIGHTWEIGHT_LISTENER - slapd_resume( s ); + slapd_resume( s, 1 ); #endif slapd_clr_read( s, 0 ); ldap_pvt_thread_pool_submit( &connection_pool, @@ -1589,7 +1589,7 @@ int connection_read(ber_socket_t s) ldap_pvt_thread_mutex_unlock( MCA_GET_CONN_MUTEX(s) ); #ifdef SLAP_LIGHTWEIGHT_LISTENER - slapd_resume( s ); + slapd_resume( s, 1 ); #endif return 0; } @@ -1604,7 +1604,7 @@ int connection_read(ber_socket_t s) ldap_pvt_thread_mutex_unlock( MCA_GET_CONN_MUTEX(s) ); #ifdef SLAP_LIGHTWEIGHT_LISTENER - slapd_resume( s ); + slapd_resume( s, 1 ); #endif return 0; } @@ -1621,7 +1621,7 @@ int connection_read(ber_socket_t s) /* connections_mutex and c_mutex are locked */ #ifdef SLAP_LIGHTWEIGHT_LISTENER - slapd_resume( s ); + slapd_resume( s, 1 ); #endif connection_closing( c, "SASL layer install failure" ); connection_close( c ); @@ -1676,7 +1676,7 @@ int connection_read(ber_socket_t s) } #ifdef SLAP_LIGHTWEIGHT_LISTENER - if ( need_resume ) slapd_resume( s ); + if ( need_resume ) slapd_resume( s, 1 ); #endif if ( ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_NEEDS_READ, NULL ) ) { diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 4c4334c5ed..ddaa0aebaa 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -584,7 +584,7 @@ int slapd_suspend(ber_socket_t s) { return rc; } -void slapd_resume ( ber_socket_t s ) { +void slapd_resume ( ber_socket_t s, int wake ) { ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex ); SLAP_SOCK_SET_READ( s ); @@ -595,7 +595,7 @@ void slapd_resume ( ber_socket_t s ) { ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); - WAKE_LISTENER(1); + WAKE_LISTENER(wake); } #endif @@ -1364,13 +1364,14 @@ connection_accept( # endif /* LDAP_PF_LOCAL */ s = accept( sl->sl_sd, (struct sockaddr *) &from, &len ); + #ifdef SLAP_LIGHTWEIGHT_LISTENER - /* - * As soon as a TCP connection is accepted, the listener FD is resumed - * for concurrent-processing of incoming TCP connections. + /* Resume the listener FD to allow concurrent-processing of + * additional incoming connections. */ - slapd_resume( sl->sl_sd ); + slapd_resume( sl->sl_sd, 1 ); #endif + if ( s == AC_SOCKET_INVALID ) { int err = sock_errno(); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index f6812d5c9e..b23245fea4 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -652,7 +652,9 @@ LDAP_SLAPD_F (const char *) connection_state2str LDAP_P(( int state )) LDAP_GCCATTR((const)); LDAP_SLAPD_F (int) connection_write LDAP_P((ber_socket_t s)); + #ifdef SLAP_LIGHTWEIGHT_LISTENER +LDAP_SLAPD_F (int) connection_read_activate LDAP_P((ber_socket_t s)); LDAP_SLAPD_F (int) connection_read LDAP_P((ber_socket_t, Operation **)); #else LDAP_SLAPD_F (int) connection_read LDAP_P((ber_socket_t s)); @@ -720,6 +722,11 @@ LDAP_SLAPD_F (RETSIGTYPE) slap_sig_shutdown LDAP_P((int sig)); LDAP_SLAPD_F (RETSIGTYPE) slap_sig_wake LDAP_P((int sig)); LDAP_SLAPD_F (void) slap_wake_listener LDAP_P((void)); +#ifdef SLAP_LIGHTWEIGHT_LISTENER +LDAP_SLAPD_F (int) slapd_suspend LDAP_P((ber_socket_t s)); +LDAP_SLAPD_F (void) slapd_resume LDAP_P((ber_socket_t s, int wake )); +#endif + LDAP_SLAPD_F (void) slapd_set_write LDAP_P((ber_socket_t s, int wake)); LDAP_SLAPD_F (void) slapd_clr_write LDAP_P((ber_socket_t s, int wake)); LDAP_SLAPD_F (void) slapd_set_read LDAP_P((ber_socket_t s, int wake)); -- 2.39.5