/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2012 The OpenLDAP Foundation.
+ * Copyright 1998-2013 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
int connections_timeout_idle(time_t now)
{
int i = 0, writers = 0;
- int connindex;
+ ber_socket_t connindex;
Connection* c;
time_t old;
void connections_drop()
{
Connection* c;
- int connindex;
+ ber_socket_t connindex;
for( c = connection_first( &connindex );
c != NULL;
return id;
}
+/*
+ * Loop through the connections:
+ *
+ * for (c = connection_first(&i); c; c = connection_next(c, &i)) ...;
+ * connection_done(c);
+ *
+ * 'i' is the cursor, initialized by connection_first().
+ * 'c_mutex' is locked in the returned connection. The functions must
+ * be passed the previous return value so they can unlock it again.
+ */
+
Connection* connection_first( ber_socket_t *index )
{
assert( connections != NULL );
return connection_next(NULL, index);
}
+/* Next connection in loop, see connection_first() */
Connection* connection_next( Connection *c, ber_socket_t *index )
{
assert( connections != NULL );
return c;
}
+/* End connection loop, see connection_first() */
void connection_done( Connection *c )
{
assert( connections != NULL );