Skip to content

Commit e9b21ea

Browse files
authored
Merge pull request #833 from david-cermak/fix/mosq_minor
[mosq]: Fix some recent bugs
2 parents e71926f + ac1b2b7 commit e9b21ea

File tree

10 files changed

+39
-8
lines changed

10 files changed

+39
-8
lines changed

.github/workflows/mosq__build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: Mosquitto build
1414
strategy:
1515
matrix:
16-
idf_ver: ["latest", "release-v5.3"]
16+
idf_ver: ["latest", "release-v5.5", "release-v5.4", "release-v5.3", "release-v5.2", "release-v5.1"]
1717
runs-on: ubuntu-22.04
1818
container: espressif/idf:${{ matrix.idf_ver }}
1919
env:

components/mosquitto/.cz.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ commitizen:
33
bump_message: 'bump(mosq): $current_version -> $new_version'
44
pre_bump_hooks: python ../../ci/changelog.py mosquitto
55
tag_format: mosq-v$version
6-
version: 2.0.20~2
6+
version: 2.0.20~3
77
version_files:
88
- idf_component.yml

components/mosquitto/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

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

515
### Features

components/mosquitto/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
menu "Mosquitto"
22

3+
config MOSQ_IS_ENABLED
4+
# Invisible option that is enabled if MOSQ is added to the IDF components.
5+
# This is used to "select" CONFIG_ESP_TLS_SERVER option (needed for TLS connection)
6+
# (these are optionally used in mosq)
7+
bool
8+
default "y"
9+
select ESP_TLS_SERVER
10+
311
config MOSQ_ENABLE_SYS
412
bool "Enable $SYS topics"
513
default n

components/mosquitto/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Variables:
3737

3838
- void(\* handle_message_cb <br>On message callback. If configured, user function is called whenever mosquitto processes a message.
3939

40-
- char \* host <br>Address on which the broker is listening for connections
40+
- const char \* host <br>Address on which the broker is listening for connections
4141

4242
- int port <br>Port number of the broker to listen to
4343

components/mosquitto/examples/serverless_mqtt/main/wifi_connect.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
6+
#include "freertos/FreeRTOS.h"
7+
#include "freertos/event_groups.h"
68
#include "nvs_flash.h"
79
#include "esp_event.h"
810
#include "esp_netif.h"

components/mosquitto/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2.0.20~2"
1+
version: "2.0.20~3"
22
url: https://github.com/espressif/esp-protocols/tree/master/components/mosquitto
33
description: The component provides a simple ESP32 port of mosquitto broker
44
dependencies:

components/mosquitto/port/include/mosq_broker.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
#pragma once
77
#include "mosquitto.h"
88
#include "esp_tls.h"
99

10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
1014
struct mosquitto__config;
1115

1216
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
1721
* structure.
1822
*/
1923
struct mosq_broker_config {
20-
char *host; /*!< Address on which the broker is listening for connections */
24+
const char *host; /*!< Address on which the broker is listening for connections */
2125
int port; /*!< Port number of the broker to listen to */
2226
esp_tls_cfg_server_t *tls_cfg; /*!< ESP-TLS configuration (if TLS transport used)
2327
* Please refer to the ESP-TLS official documentation
@@ -48,3 +52,7 @@ int mosq_broker_run(struct mosq_broker_config *config);
4852
* @note After calling this API, function mosq_broker_run() unblocks and returns.
4953
*/
5054
void mosq_broker_stop(void);
55+
56+
#ifdef __cplusplus
57+
}
58+
#endif

components/mosquitto/port/net__esp_tls.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
55
*
6-
* SPDX-FileContributor: 2024 Espressif Systems (Shanghai) CO LTD
6+
* SPDX-FileContributor: 2024-2025 Espressif Systems (Shanghai) CO LTD
77
*/
88

99
/*
@@ -106,6 +106,9 @@ struct mosquitto *net__socket_accept(struct mosquitto__listener_sock *listensock
106106

107107
new_sock = accept(listensock->sock, NULL, 0);
108108
if (new_sock == INVALID_SOCKET) {
109+
if (errno == EAGAIN) { // mosquitto tries to accept() in a loop until EAGAIN is returned
110+
return NULL;
111+
}
109112
log__printf(NULL, MOSQ_LOG_ERR,
110113
"Unable to accept new connection, system socket count has been exceeded. Try increasing \"ulimit -n\" or equivalent.");
111114
return NULL;

components/mosquitto/port/priv_include/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
#undef isspace
2121
#define isspace(__c) (__ctype_lookup((int)__c)&_S)
2222

23-
#define VERSION "v2.0.20~2"
23+
#define VERSION "v2.0.20~3"

0 commit comments

Comments
 (0)