Commit e78ecead authored by Ondřej Kuzník's avatar Ondřej Kuzník
Browse files

ITS#9600 Support closing connections on request

parent e9dfb7d2
......@@ -263,6 +263,35 @@ client traffic does not propagate to the
.B lloadd
backend servers in any way.
.SH CN=MONITOR INTERFACE
As part of
.BR lloadd 's
.B cn=monitor
interface it is possible to close a client connection it manages by writing to
the corresponding entry,
.B replacing
the
.B olmConnectionState
attribute with the value
.BR closing .
This is subject to ACLs configured on the monitor database. The server will
send a
.B Notice of Disconnection
to the client, refuse any new operations and once all pending operations have
finished, close the connection.
For example, to close connection number 42:
.LP
.nf
.ft tt
dn: cn=connection 42,cn=incoming connections,cn=load balancer,cn=backends,cn=monitor
changetype: modify
replace: olmConnectionState
olmConnectionState: closing
.ft
.fi
.SH EXAMPLES
To start
.I lloadd
......
......@@ -531,6 +531,31 @@ done:
return rc;
}
static int
lload_monitor_conn_modify( Operation *op, SlapReply *rs, Entry *e, void *priv )
{
Modifications *m;
LloadConnection *c = priv;
for ( m = op->orm_modlist; m; m = m->sml_next ) {
struct berval closing = BER_BVC("closing");
int gentle = 1;
if ( m->sml_flags & SLAP_MOD_INTERNAL ) continue;
if ( m->sml_desc != ad_olmConnectionState ||
m->sml_op != LDAP_MOD_REPLACE || m->sml_numvals != 1 ||
ber_bvcmp( &m->sml_nvalues[0], &closing ) ) {
return LDAP_OTHER;
}
if ( lload_connection_close( c, &gentle ) ) {
return LDAP_OTHER;
}
}
return SLAP_CB_CONTINUE;
}
/*
* Monitor cache is locked, the connection cannot be unlinked and freed under us.
* That also means we need to unlock and finish as soon as possible.
......@@ -701,6 +726,7 @@ lload_monitor_conn_entry_create( LloadConnection *c, monitor_subsys_t *ms )
cb = ch_calloc( sizeof(monitor_callback_t), 1 );
cb->mc_update = lload_monitor_conn_update;
cb->mc_modify = lload_monitor_conn_modify;
cb->mc_private = c;
attr_merge_one( e, ad_olmConnectionType, &value, NULL );
......
......@@ -38,4 +38,6 @@ database config
include @TESTDIR@/configpw.conf
database monitor
access to * by * read
access to *
by users write
by * read
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment