for (i=0; i<dtblsize; i++) slap_daemon.sd_index[i] = -1; \
} while (0)
+#define SLAP_SOCK_SET_DESTROY do { \
+ if ( slap_daemon.sd_epolls != NULL ) { \
+ ch_free( slap_daemon.sd_epolls ); \
+ slap_daemon.sd_epolls = NULL; \
+ ch_free( slap_daemon.sd_index ); \
+ slap_daemon.sd_index = NULL; \
+ close( slap_daemon.sd_epfd ); \
+ } \
+} while ( 0 )
+
# define SLAP_EVENT_DECL struct epoll_event *revents
# define SLAP_EVENT_INIT do { \
FD_ZERO(&slap_daemon.sd_writers); \
} while (0)
+#define SLAP_SOCK_SET_DESTROY
+
# define SLAP_SOCK_IS_ACTIVE(fd) FD_ISSET((fd), &slap_daemon.sd_actives)
# define SLAP_SOCK_IS_READ(fd) FD_ISSET((fd), &slap_daemon.sd_readers)
# define SLAP_SOCK_IS_WRITE(fd) FD_ISSET((fd), &slap_daemon.sd_writers)
static char** slapd_srvurls = NULL;
static SLPHandle slapd_hslp = 0;
int slapd_register_slp = 0;
-char *slapd_slp_attrs = NULL;
+const char *slapd_slp_attrs = NULL;
static SLPError slapd_slp_cookie;
*/
void slapd_remove(
ber_socket_t s,
+ Sockbuf *sb,
int wasactive,
int wake,
int locked )
SLAP_DEL_SOCK(s);
+ if ( sb )
+ ber_sockbuf_free(sb);
+
/* If we ran out of file descriptors, we dropped a listener from
* the select() loop. Now that we're removing a session from our
* control, we can try to resume a dropped listener to use.
Listener *lr = slap_listeners[l];
if ( lr->sl_sd != AC_SOCKET_INVALID ) {
- if ( remove ) slapd_remove( lr->sl_sd, 0, 0, 0 );
+ if ( remove ) slapd_remove( lr->sl_sd, NULL, 0, 0, 0 );
#ifdef LDAP_PF_LOCAL
if ( lr->sl_sa.sa_addr.sa_family == AF_LOCAL ) {
#if defined( HAVE_WINSOCK2 ) || defined( HAVE_WINSOCK )
WSACleanup();
#endif
+ SLAP_SOCK_SET_DESTROY;
+
return 0;
}