ldap/servers/slapd/daemon.c | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 2335995140903582672d9191ef014f9a6fc00702
Author: Mark Reynolds <mareynol(a)redhat.com>
Date: Tue Mar 6 11:28:59 2012 -0500
Ticket #191 - Implement SO_KEEPALIVE in network calls
Bug Description: Need to set the KeepAlive socket option on DS connections
Fix Description: Set PR_SockOpt_Keepalive on DS connections
Reviewed by: richm (Thanks Rich!)
https://fedorahosted.org/389/ticket/191
`
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 922802c..85daa28 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -3033,6 +3033,17 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int
local )
}
#endif /* !_WIN32 */
+ /* Set keep_alive to keep old connections from lingering */
+ pr_socketoption.option = PR_SockOpt_Keepalive;
+ pr_socketoption.value.keep_alive = 1;
+ if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE ) {
+ PRErrorCode prerr = PR_GetError();
+ LDAPDebug( LDAP_DEBUG_ANY,
+ "PR_SetSocketOption(PR_SockOpt_Keepalive failed, "
+ SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+ prerr, slapd_pr_strerror(prerr), 0 );
+ }
+
if ( secure ) {
pr_socketoption.option = PR_SockOpt_Nonblocking;