Merge pull request #833 from david-cermak/fix/mosq_minor

[mosq]: Fix some recent bugs
This commit is contained in:
david-cermak
2025-07-01 12:41:01 +02:00
committed by GitHub
10 changed files with 39 additions and 8 deletions

View File

@ -13,7 +13,7 @@ jobs:
name: Mosquitto build
strategy:
matrix:
idf_ver: ["latest", "release-v5.3"]
idf_ver: ["latest", "release-v5.5", "release-v5.4", "release-v5.3", "release-v5.2", "release-v5.1"]
runs-on: ubuntu-22.04
container: espressif/idf:${{ matrix.idf_ver }}
env:

View File

@ -3,6 +3,6 @@ commitizen:
bump_message: 'bump(mosq): $current_version -> $new_version'
pre_bump_hooks: python ../../ci/changelog.py mosquitto
tag_format: mosq-v$version
version: 2.0.20~2
version: 2.0.20~3
version_files:
- idf_component.yml

View File

@ -1,5 +1,15 @@
# Changelog
## [2.0.20~3](https://github.com/espressif/esp-protocols/commits/mosq-v2.0.20_3)
### Bug Fixes
- Support build on older IDF branches ([13b90ad1](https://github.com/espressif/esp-protocols/commit/13b90ad1))
- Fix misleading error when accepting connection ([fd410061](https://github.com/espressif/esp-protocols/commit/fd410061), [#807](https://github.com/espressif/esp-protocols/issues/807))
- Make mosquitto component c++ compatible ([c4169765](https://github.com/espressif/esp-protocols/commit/c4169765), [#817](https://github.com/espressif/esp-protocols/issues/817))
- include config.h before any system header ([1b1ede43](https://github.com/espressif/esp-protocols/commit/1b1ede43))
## [2.0.20~2](https://github.com/espressif/esp-protocols/commits/mosq-v2.0.20_2)
### Features

View File

@ -1,5 +1,13 @@
menu "Mosquitto"
config MOSQ_IS_ENABLED
# Invisible option that is enabled if MOSQ is added to the IDF components.
# This is used to "select" CONFIG_ESP_TLS_SERVER option (needed for TLS connection)
# (these are optionally used in mosq)
bool
default "y"
select ESP_TLS_SERVER
config MOSQ_ENABLE_SYS
bool "Enable $SYS topics"
default n

View File

@ -37,7 +37,7 @@ Variables:
- void(\* handle_message_cb <br>On message callback. If configured, user function is called whenever mosquitto processes a message.
- char \* host <br>Address on which the broker is listening for connections
- const char \* host <br>Address on which the broker is listening for connections
- int port <br>Port number of the broker to listen to

View File

@ -3,6 +3,8 @@
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "nvs_flash.h"
#include "esp_event.h"
#include "esp_netif.h"

View File

@ -1,4 +1,4 @@
version: "2.0.20~2"
version: "2.0.20~3"
url: https://github.com/espressif/esp-protocols/tree/master/components/mosquitto
description: The component provides a simple ESP32 port of mosquitto broker
dependencies:

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -7,6 +7,10 @@
#include "mosquitto.h"
#include "esp_tls.h"
#ifdef __cplusplus
extern "C" {
#endif
struct mosquitto__config;
typedef void (*mosq_message_cb_t)(char *client, char *topic, char *data, int len, int qos, int retain);
@ -17,7 +21,7 @@ typedef void (*mosq_message_cb_t)(char *client, char *topic, char *data, int len
* structure.
*/
struct mosq_broker_config {
char *host; /*!< Address on which the broker is listening for connections */
const char *host; /*!< Address on which the broker is listening for connections */
int port; /*!< Port number of the broker to listen to */
esp_tls_cfg_server_t *tls_cfg; /*!< ESP-TLS configuration (if TLS transport used)
* Please refer to the ESP-TLS official documentation
@ -48,3 +52,7 @@ int mosq_broker_run(struct mosq_broker_config *config);
* @note After calling this API, function mosq_broker_run() unblocks and returns.
*/
void mosq_broker_stop(void);
#ifdef __cplusplus
}
#endif

View File

@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*
* SPDX-FileContributor: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2024-2025 Espressif Systems (Shanghai) CO LTD
*/
/*
@ -106,6 +106,9 @@ struct mosquitto *net__socket_accept(struct mosquitto__listener_sock *listensock
new_sock = accept(listensock->sock, NULL, 0);
if (new_sock == INVALID_SOCKET) {
if (errno == EAGAIN) { // mosquitto tries to accept() in a loop until EAGAIN is returned
return NULL;
}
log__printf(NULL, MOSQ_LOG_ERR,
"Unable to accept new connection, system socket count has been exceeded. Try increasing \"ulimit -n\" or equivalent.");
return NULL;

View File

@ -20,4 +20,4 @@
#undef isspace
#define isspace(__c) (__ctype_lookup((int)__c)&_S)
#define VERSION "v2.0.20~2"
#define VERSION "v2.0.20~3"