Change $SYS/broker/clients/[in]active -> $SYS/broker/clients/[dis]connected

pull/211/merge
Roger A. Light 12 years ago
parent e4ddc31295
commit fd7d5ebbb9

@ -10,6 +10,8 @@ Broker:
messages in rare circumstances.
- Add support for "session present" in CONNACK messages for MQTT v3.1.1.
- Remove strict protocol #ifdefs.
- Change $SYS/broker/clients/active -> $SYS/broker/clients/connected
- Change $SYS/broker/clients/inactive -> $SYS/broker/clients/disconnected
Clients:
- Both clients can now load default configuration options from a file.

@ -110,7 +110,8 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>$SYS/broker/clients/active</option></term>
<term><option>$SYS/broker/clients/connected</option></term>
<term><option>$SYS/broker/clients/active</option> (deprecated)</term>
<listitem>
<para>The number of currently connected clients</para>
</listitem>
@ -124,7 +125,8 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>$SYS/broker/clients/inactive</option></term>
<term><option>$SYS/broker/clients/disconnected</option></term>
<term><option>$SYS/broker/clients/inactive</option> (deprecated)</term>
<listitem>
<para>The total number of persistent clients (with clean
session disabled) that are registered at the broker but are

@ -45,28 +45,30 @@ static void _sys_update_clients(struct mosquitto_db *db, char *buf)
static unsigned int client_count = -1;
static int clients_expired = -1;
static unsigned int client_max = -1;
static unsigned int inactive_count = -1;
static unsigned int active_count = -1;
static unsigned int disconnected_count = -1;
static unsigned int connected_count = -1;
unsigned int value;
unsigned int inactive;
unsigned int active;
unsigned int disconnected;
unsigned int connected;
if(!mqtt3_db_client_count(db, &value, &inactive)){
if(!mqtt3_db_client_count(db, &value, &disconnected)){
if(client_count != value){
client_count = value;
snprintf(buf, BUFLEN, "%d", client_count);
mqtt3_db_messages_easy_queue(db, NULL, "$SYS/broker/clients/total", 2, strlen(buf), buf, 1);
}
if(inactive_count != inactive){
inactive_count = inactive;
snprintf(buf, BUFLEN, "%d", inactive_count);
if(disconnected_count != disconnected){
disconnected_count = disconnected;
snprintf(buf, BUFLEN, "%d", disconnected_count);
mqtt3_db_messages_easy_queue(db, NULL, "$SYS/broker/clients/inactive", 2, strlen(buf), buf, 1);
mqtt3_db_messages_easy_queue(db, NULL, "$SYS/broker/clients/disconnected", 2, strlen(buf), buf, 1);
}
active = client_count - inactive;
if(active_count != active){
active_count = active;
snprintf(buf, BUFLEN, "%d", active_count);
connected = client_count - disconnected;
if(connected_count != connected){
connected_count = connected;
snprintf(buf, BUFLEN, "%d", connected_count);
mqtt3_db_messages_easy_queue(db, NULL, "$SYS/broker/clients/active", 2, strlen(buf), buf, 1);
mqtt3_db_messages_easy_queue(db, NULL, "$SYS/broker/clients/connected", 2, strlen(buf), buf, 1);
}
if(value != client_max){
client_max = value;

Loading…
Cancel
Save