diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-12-18 07:57:19 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-12-18 07:57:19 +0000 |
commit | 4fb4ce12d90abf43f96af67dd308124742b59961 (patch) | |
tree | 00e619d26e38e41cb8f48d93dced3bd7061c6c2e /multi.c | |
parent | Added MultiFileExtract capability to Windows Installer. (diff) | |
download | openvpn-4fb4ce12d90abf43f96af67dd308124742b59961.tar.xz |
Added "nclients" command to management interface to
display the current number of authenticated clients
connected to the server.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3717 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to '')
-rw-r--r-- | multi.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -503,6 +503,10 @@ multi_close_instance (struct multi_context *m, dmsg (D_MULTI_DEBUG, "MULTI: multi_close_instance called"); + /* adjust current client connection count */ + m->n_clients += mi->n_clients_delta; + mi->n_clients_delta = 0; + /* prevent dangling pointers */ if (m->pending == mi) multi_set_pending (m, NULL); @@ -1688,6 +1692,10 @@ multi_connection_established (struct multi_context *m, struct multi_instance *mi /* set flag so we don't get called again */ mi->connection_established_flag = true; + /* increment number of current authenticated clients */ + ++m->n_clients; + --mi->n_clients_delta; + #ifdef MANAGEMENT_DEF_AUTH if (management) management_connection_established (management, &mi->context.c2.mda_context); @@ -2437,6 +2445,13 @@ management_callback_status (void *arg, const int version, struct status_output * } static int +management_callback_n_clients (void *arg) +{ + struct multi_context *m = (struct multi_context *) arg; + return m->n_clients; +} + +static int management_callback_kill_by_cn (void *arg, const char *del_cn) { struct multi_context *m = (struct multi_context *) arg; @@ -2598,6 +2613,7 @@ init_management_callback_multi (struct multi_context *m) cb.kill_by_cn = management_callback_kill_by_cn; cb.kill_by_addr = management_callback_kill_by_addr; cb.delete_event = management_delete_event; + cb.n_clients = management_callback_n_clients; #ifdef MANAGEMENT_DEF_AUTH cb.kill_by_cid = management_kill_by_cid; cb.client_auth = management_client_auth; |