mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-02-06 02:52:07 +08:00
Fix max_connections not being honoured on libwebsockets listeners.
Closes #3455. Thanks to FelixPopp.
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
- Fix inconsistent disconnect log message format, and add address:port.
|
||||
- Fix `plugin`/`global_plugin` option not allowing space characters.
|
||||
- Fix $SYS load values not being published initially. Closes #3459.
|
||||
- Fix max_connections not being honoured on libwebsockets listeners. This does
|
||||
not affect the built-in websockets support. Closes #3455.
|
||||
|
||||
# Plugins
|
||||
- Fix incorrect linking of libmosquitto_common.so for the acl and password
|
||||
|
||||
@@ -170,12 +170,14 @@ static int callback_mqtt(
|
||||
u->mosq = NULL;
|
||||
return -1;
|
||||
}
|
||||
mosq->listener->client_count++;
|
||||
if((mosq->listener->max_connections > 0 && mosq->listener->client_count > mosq->listener->max_connections)
|
||||
|| (db.config->global_max_connections > 0 && HASH_CNT(hh_sock, db.contexts_by_sock) > (unsigned int)db.config->global_max_connections)){
|
||||
|
||||
if(db.config->connection_messages == true){
|
||||
log__printf(NULL, MOSQ_LOG_NOTICE, "Client connection from %s denied: max_connections exceeded.", mosq->address);
|
||||
}
|
||||
mosq->listener->client_count--;
|
||||
mosquitto_FREE(mosq->address);
|
||||
mosquitto_FREE(mosq);
|
||||
u->mosq = NULL;
|
||||
@@ -196,6 +198,7 @@ static int callback_mqtt(
|
||||
HASH_DELETE(hh_sock, db.contexts_by_sock, mosq);
|
||||
mosq->sock = INVALID_SOCKET;
|
||||
mux__delete(mosq);
|
||||
mosq->listener->client_count--;
|
||||
}
|
||||
mosq->wsi = NULL;
|
||||
#ifdef WITH_TLS
|
||||
|
||||
Reference in New Issue
Block a user