Commit Graph

661 Commits

Author SHA1 Message Date
Rocha Euripedes
e694d80b05 Merge branch 'refactor/mqtt_remove_heap_mock' into 'master'
refactor: replaced heap mock with Linux-compatible heap component

See merge request espressif/esp-mqtt!208
2024-05-23 13:56:10 +08:00
Rocha Euripedes
833870068d Merge branch 'fix/gcc-fanalyzer-warnings' into 'master'
fix: gcc -fanalyzer warnings

See merge request espressif/esp-mqtt!209
2024-05-23 13:55:21 +08:00
Jakob Hasse
8b0b43efa8 refactor: replaced heap mock with Linux-compatible heap component 2024-05-22 22:16:27 +08:00
Alexey Lapshin
8bc3bff757 fix: gcc -fanalyzer warnings 2024-05-22 22:15:48 +08:00
Rocha Euripedes
d27bd520b2 Merge branch 'fix_host_test' into 'master'
fix: Use catch from component manager

See merge request espressif/esp-mqtt!210
2024-05-22 22:15:21 +08:00
Euripedes Rocha
53e0cc75ee fix: Use catch from component manager
The version present on idf repo was failing to compile.
Simple fix is to update to latest supported provided by component manager.
2024-05-22 14:58:58 +02:00
Rocha Euripedes
ef12b615e1 Merge branch 'fix_host_test_github' into 'master'
fix: Fix host test for github ci.

Closes IDF-8883

See merge request espressif/esp-mqtt!206
2024-04-24 21:52:37 +08:00
Euripedes Rocha
b43d93c82d fix: Fix host test for github ci. 2024-04-17 14:35:34 +02:00
Rocha Euripedes
aa6f889fb4 Merge branch 'fix/error_codes' into 'master'
fix: regard reason codes greater than 0x80 as failures.

See merge request espressif/esp-mqtt!205
2024-04-05 17:09:50 +08:00
Rocha Euripedes
1edd167dcb Merge branch 'fix/calloc_failure' into 'master'
PR: Return on allocation failure

See merge request espressif/esp-mqtt!204
2024-04-03 15:29:51 +08:00
Ss Wang
c06f1540fe set last_retransmit to now when first connected
when published before connected, the msg will be always retransmitted immediately even it is  send right now
2024-04-02 10:48:45 +02:00
Ss Wang
37478a9c00 add return to faile_message, avoid segment fault
should not use response_topic when calloc failed
2024-04-02 10:48:45 +02:00
Rocha Euripedes
fd21b27a83 Merge branch 'fix/unused_variable_warning' into 'master'
Minor warning of unused variable

See merge request espressif/esp-mqtt!203
2024-04-02 14:41:47 +08:00
zhouzb
e7b9aa5e6a fix: regard reason codes greater than 0x80 as failures. 2024-04-01 10:37:42 +08:00
Euripedes Rocha
726e5f2fce fix: Minor warning of unused variable
In case of hardcoded id mac array was unused.
2024-03-28 14:16:34 +01:00
Rocha Euripedes
14f5fa079f Merge branch 'fix/cliend_id' into 'master'
Cover the case for SOC without MAC address

See merge request espressif/esp-mqtt!202
2024-03-28 20:37:54 +08:00
Euripedes Rocha
5e3abd4b8c fix: Cover the case for SOC without MAC address
We need to cover for the case where the available MAC isn't defined in
soc caps. E.g. A new target is being introduced but the support isn't
complete yet.
2024-03-28 12:40:07 +01:00
Rocha Euripedes
37cb056c5f Merge branch 'feature/atomic_state' into 'master'
Make state and size atomic

See merge request espressif/esp-mqtt!199
2024-03-22 15:26:15 +08:00
Rocha Euripedes
74481cbbf4 Merge branch 'fix/log_level_on_timeout' into 'master'
fix: Adjust the log level on few messages to avoid cluthering the logs

See merge request espressif/esp-mqtt!201
2024-03-22 15:05:49 +08:00
Rocha Euripedes
c33a0c8e44 Merge branch 'fix/detect_mac_type' into 'master'
fix: Make automatic client_id soc dependent

See merge request espressif/esp-mqtt!200
2024-03-22 15:05:21 +08:00
Euripedes Rocha
5c17fc4a1a fix: Adjust the log level on few messages to avoid cluthering the logs 2024-03-21 14:11:57 +01:00
Euripedes Rocha
657a2aea77 fix: Make automatic client_id soc dependent
When creating the client_id for user, the library uses the device MAC.
For some of our devices WIFI isn't available and the library needs to select
a different MAC to use.
2024-03-14 07:31:37 +01:00
Euripedes Rocha
891380bdf5 feat: Make state and size atomic
This makes the mqtt client state atomic to reduce the scope of locking in
some parts of the code.
2024-03-12 08:49:36 +01:00
Rocha Euripedes
fa88da5282 Merge branch 'lifetime_clarification' into 'master'
Clarify data that users need to take care of lifetime.

See merge request espressif/esp-mqtt!197
2024-01-26 19:10:50 +08:00
Rocha Euripedes
5a35782272 Merge branch 'fix/subscribe_macro_type' into 'master'
Update mqtt_client.h

See merge request espressif/esp-mqtt!198
2024-01-26 18:54:42 +08:00
faceleft
acdb66d5c6 add const char * to esp_mqtt_client_subscribe() generic macros 2024-01-25 15:35:32 +07:00
Rocha Euripedes
d3e3c4e7ad Merge branch 'bugfix/consolidate_err_messages' into 'master'
client: Report failure on timeout in mid-message timeout (GitHub PR)

See merge request espressif/esp-mqtt!165
2024-01-24 22:23:04 +08:00
Euripedes Rocha
371f594cce docs: Clarify data that users need to take care of lifetime.
- Adds to field that the mqtt client doesn't copy a note about it.
2024-01-24 09:38:37 +01:00
David Cermak
ddde502782 client: Report failure on timeout in mid-message timeout
Fixes error processing on network reads:

1) Treat EOF as an error, since the connection is closed (FIN) from the
server side. If we didn't we would try to read (in the next iteration)
from the same socket that has been already closed and get an error
ENOTCONN.
Before the fix:
D (13760) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read(): EOF
E (13800) transport_base: tcp_read error, errno=Socket is not connected
E (13800) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read() error: errno=128
D (13810) esp_mqtt_demo: Event dispatched from event loop base=MQTT_EVENTS, event_id=0
I (13820) esp_mqtt_demo: MQTT_EVENT_ERROR
E (13830) esp_mqtt_demo: Last error reported from esp-tls: 0x8008
E (13830) esp_mqtt_demo: Last error captured as transport's socket errno: 0x80
I (13840) esp_mqtt_demo: Last errno string (Socket is not connected)
E (13850) mqtt_client: mqtt_process_receive: mqtt_message_receive() returned -1
D (13860) mqtt_client: Reconnect after 10000 ms
D (13860) esp_mqtt_demo: Event dispatched from event loop base=MQTT_EVENTS, event_id=2
I (13870) esp_mqtt_demo: MQTT_EVENT_DISCONNECTED
After the fix:
E (12420) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read(): EOF
E (12420) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read() error: errno=128
D (12430) esp_mqtt_demo: Event dispatched from event loop base=MQTT_EVENTS, event_id=0
I (12440) esp_mqtt_demo: MQTT_EVENT_ERROR
E (12450) esp_mqtt_demo: Last error reported from esp-tls: 0x8008
I (12450) esp_mqtt_demo: Last errno string (Success)
E (12460) mqtt_client: mqtt_process_receive: mqtt_message_receive() returned -1
D (12470) mqtt_client: Reconnect after 10000 ms
D (12470) esp_mqtt_demo: Event dispatched from event loop base=MQTT_EVENTS, event_id=2
I (12480) esp_mqtt_demo: MQTT_EVENT_DISCONNECTED

2) Treat timeouts in the middle of MQTT message reading as errors (if
timeouted for the second time and didn't read a byte)
Before the fix:
D (9160) mqtt_client: mqtt_message_receive: read "remaining length" byte: 0x2
D (9170) mqtt_client: mqtt_message_receive: total message length: 4 (already read: 2)
D (19190) mqtt_client: mqtt_message_receive: read_len=0
D (19190) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read(): call timed out before data was ready!
E (19200) mqtt_client: esp_mqtt_connect: mqtt_message_receive() returned 0
E (19210) mqtt_client: MQTT connect failed
D (19220) mqtt_client: Reconnect after 10000 ms
D (19220) esp_mqtt_demo: Event dispatched from event loop base=MQTT_EVENTS, event_id=2
I (19230) esp_mqtt_demo: MQTT_EVENT_DISCONNECTED
After the fix:
D (19190) mqtt_client: mqtt_message_receive: read_len=0
E (19190) mqtt_client: Network timeout while reading MQTT message
E (19200) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read() error: errno=119
D (19210) esp_mqtt_demo: Event dispatched from event loop base=MQTT_EVENTS, event_id=0
I (19220) esp_mqtt_demo: MQTT_EVENT_ERROR
I (19220) esp_mqtt_demo: Last errno string (Success)
E (19230) mqtt_client: esp_mqtt_connect: mqtt_message_receive() returned -1
E (19240) mqtt_client: MQTT connect failed
D (19240) mqtt_client: Reconnect after 10000 ms
D (19240) esp_mqtt_demo: Event dispatched from event loop base=MQTT_EVENTS, event_id=2
I (19250) esp_mqtt_demo: MQTT_EVENT_DISCONNECTED
(Note that the above log is from mid-message timeout of CONNECT message,
which was hadled before the fix. If the mid-message timeout ocurs with
for example SUBACK, the current version would repeatably resend
susbscribe message)

Merges https://github.com/espressif/esp-mqtt/pull/232
2023-11-10 15:40:44 +01:00
Rocha Euripedes
7894dd0ace Merge branch 'fix/buffer_creation_in_set_config' into 'master'
fix: Move buffer initialization to set config

See merge request espressif/esp-mqtt!194
2023-10-25 16:16:35 +08:00
Euripedes Rocha
ea0df31e00 fix: Move buffer initialization to set config
When calling set config message buffers were not affected because the
creation was handled on init.

Closes https://github.com/espressif/esp-mqtt/issues/267
2023-10-25 07:47:05 +00:00
Rocha Euripedes
abd8b6cadc Merge branch 'fix/qos0publishdispatch' into 'master'
Fix check for message creation when processing publish

See merge request espressif/esp-mqtt!195
2023-10-10 16:25:20 +08:00
Euripedes Rocha
67800569de fix: Deliver publish verifies if message was created only for QoS >0
The previous version depends on a sucessful message being created prior
to that check. The check only makes sense for the case where puback or
pubrec messages should be created.
2023-10-10 06:47:07 +00:00
Rocha Euripedes
e6afdb4025 Merge branch 'fix/check_asprintf_return_value' into 'master'
fix: using return value of asprintf now

See merge request espressif/esp-mqtt!192
2023-09-14 19:46:26 +08:00
Jakob Hasse
c0b40b1293 fix: using return value of asprintf now 2023-09-14 19:46:26 +08:00
Rocha Euripedes
dc93367bd5 Merge branch 'fix/outbox_memory_destination' into 'master'
fix: Uses caps allocation for data buffer instead of item struct

See merge request espressif/esp-mqtt!193
2023-09-14 13:47:33 +08:00
Euripedes Rocha
00ee059bf8 fix: Uses caps allocation for data buffer instead of item struct
Once introduced the memory destination for outbox was incorrectly
allocating the outbox data structuture instead of data buffer to the
selected memory.
2023-09-13 08:04:38 +02:00
Rocha Euripedes
05b347643f Merge branch 'bugfix/mock_tests_include_idf_additions' into 'master'
Fix: Mock test should include idf_additions.h

See merge request espressif/esp-mqtt!191
2023-09-04 20:01:22 +08:00
Darian Leung
f35aaa1577 fix: Mock tests include idf_additions.h
A number of IDF specific FreeRTOS API additions will be moved to
`#include "freertos/idf_additions.h". Mock tests need to include these to
properly use them as mock functions.
2023-09-04 15:05:03 +08:00
Rocha Euripedes
4b28192d00 Merge branch 'docs/outbox_doxygen' into 'master'
Adds missing documentation to outbox configuration.

See merge request espressif/esp-mqtt!190
2023-08-31 22:22:04 +08:00
Rocha Euripedes
c355e0b5ae docs: Adds missing documentation to outbox configuration. 2023-08-31 22:22:04 +08:00
Rocha Euripedes
301bd9e028 Merge branch 'fix/big_messages' into 'master'
fix: Added missing update to message data

See merge request espressif/esp-mqtt!189
2023-08-25 15:38:48 +08:00
Euripedes Rocha
cc41d1b852 fix: Added missing update to message data
When handling big messages the refactoring introduced a regression when
handling big messages, messages larger than the message buffer.
2023-08-24 09:52:00 +02:00
Rocha Euripedes
1ca73479cb Merge branch 'mqtt5_fixing_typo' into 'master'
PR: fixing typos in `mqtt5_error_reason_code`

See merge request espressif/esp-mqtt!188
2023-08-18 14:43:10 +08:00
Euripedes Rocha
90b4a4538e feat: Add enum definition with typo to keep backwards compatibility
Added initial enum definitions with deprecated attribute.
Should be removed with a new version that can introduce a breaking
change.
2023-08-17 14:58:49 +02:00
Wang Kai
dc775bb52e fixing typos in mqtt5_error_reason_code 2023-07-24 23:23:32 +08:00
Rocha Euripedes
fe32d8f224 Merge branch 'docs/clarify_keepalive_timeout' into 'master'
docs: Clarify keepalive timeout

See merge request espressif/esp-mqtt!186
2023-07-11 05:34:46 +08:00
Rocha Euripedes
cb1e6cf218 docs: Clarify keepalive timeout
Adds information on the behavior of the PINGREQ message timeout and some
reasoning behind the choice.
2023-07-11 05:34:46 +08:00
Rocha Euripedes
cd81773bd1 Merge branch 'fix/format_log_messages' into 'master'
fix: LOG format strings

See merge request espressif/esp-mqtt!187
2023-07-10 17:28:55 +08:00
Rocha Euripedes
395aa141c8 Merge branch 'fix/stop_only_if_started' into 'master'
Fix: Stop client only if it's running.

See merge request espressif/esp-mqtt!183
2023-07-10 15:55:33 +08:00