Commit Graph

223 Commits

Author SHA1 Message Date
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
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
Euripedes Rocha
a3b04f2d0a fix: LOG format strings
Fix log format strings and remove no-format warning configuration.
2023-06-30 10:17:32 +02:00
Euripedes Rocha
585e3ba2e0 fix: Error on publish message creation was ignored.
In the case of make_publish failure the client would just continue and
the error was ignored and not propagated to caller.
2023-06-27 15:13:54 +02:00
Euripedes Rocha
36eec6f625 Fix: Stop client only if it's running.
Check for client run instead of lock to call esp_mqtt_client_stop
when destroying the client.
2023-06-21 09:39:42 +02:00
Euripedes Rocha
4050df4caf Adds mqtt host tests to Ci
- New job to run host tests
- Fix leak in case of usage of interface name
- Fix host tests to expect a call to `transport_destroy` and add an
  extra case
2023-06-19 10:34:18 +02:00
Euripedes Rocha
363fbf7dab feat: Add option to bind interface of use
Enable user to set which interface should be used for client network,
allowing client to be binded to the interface selected by user forcing
it to go through the selected interface.

Closes https://github.com/espressif/esp-mqtt/issues/253
2023-06-14 14:48:44 +02:00
Euripedes Rocha
372ab7b374 feat: Introduces outbox limit
A memory limit for the outbox can be configured.
User will not be able to publish or enqueue if the new message goes
beyond the configured limit.
2023-06-13 15:59:55 +02:00
Euripedes Rocha
122875bf8a refactor: Group access to output buffer in mqtt_connection_t
- Moves mqtt_connect_info to mqtt_connection_t.
  - Removes outbound_message in favor of accessing it trough connection.
2023-06-13 11:56:05 +02:00
Rocha Euripedes
ed628098a1 Merge branch 'feature/custom_transport' into 'master'
Add custom transport configuration

See merge request espressif/esp-mqtt!169
2023-06-13 14:30:24 +08:00
Euripedes Rocha
a492935951 Removes leftover calls to event_handler
The possibility to add a callback as custom handler was removed from
the client in favor of esp_event. These removes the older alternative
that wasn't possible to use.
2023-06-09 10:44:50 +02:00
Niklas Gürtler
6195762d28 Added support to set server common name. 2023-06-08 08:46:41 +02:00
Euripedes Rocha
a5c1b441dc feat: Add custom transport configuration
Today there is no way to add a new transport without applying
modifications to the transport list. This impose limitations on the
client usage. Adding the custom configuration we enable user defined
transports.
2023-06-08 06:38:53 +00:00
Rocha Euripedes
5bd9724c69 Merge branch 'bugfix/return_on_qos0_disconnected' into 'master'
bug: Incorrect return on disconnect qos0 publish

See merge request espressif/esp-mqtt!172

(cherry picked from commit fa40f44695fc4a0cde14a31a01b8a03da14dd702)

58c25577 bug: Incorrect return on disconnect qos0 publish
2023-06-01 17:03:03 +08:00
Euripedes Rocha
da6d38a17e Removes pending message count
The information was used only to log remaining messages on debug log.
It was checked on writing but updated prior to every call making the
verification meaningless.
2023-04-21 08:40:12 +02:00
Euripedes Rocha
5729048683 Bugfix: Dispatch transport error on all write operations
- During connect the error wasn't dispatched.
- Merged esp_mqtt_write with mqtt_write_data since the only difference
  was the error dispatched.
2023-04-20 09:29:33 +02:00
Euripedes Rocha
72833c7f8a Merge enqueue functions
- enqueue and oversized enqueue did the same work with small differences
  this clean up the extra unnecessary function
2023-04-20 09:29:33 +02:00
yuanjianmin
5cce2c4f35 mqtt5: Fix flow control will increase count when send fragmented packet
Closes https://github.com/espressif/esp-mqtt/issues/255
2023-03-17 16:55:25 +08:00
Euripedes Rocha
32102558d3 Feature: Enable SUBSCRIBE to multiple topics
- Adds an api for multiple topics on SUBSCRIBE message.

Apply 2 suggestion(s) to 1 file(s)

Removing headers

y
2023-02-03 14:19:24 +01:00
Rocha Euripedes
e9b865eb9d Fix formatting when using printf nano 2023-02-02 20:24:24 +08:00
yuanjianmin
ed76036744 mqtt5: Fix flow control will regard the DUP packet and not consider PUBCOMP packet
Closes https://github.com/espressif/esp-mqtt/issues/243
2023-01-18 14:16:28 +08:00
Rocha Euripedes
c96f6f804c Merge branch 'bugfix/coverity_fix' into 'master'
Remove possible null pointer dereferences

See merge request espressif/esp-mqtt!157
2023-01-04 20:26:27 +08:00
Euripedes Rocha
159b1638b2 Reorganize mqtt build structure
- Integrate build definitions from idf
- Changes CMakeLists to allow import
- Added host test from idf
- Added test code from idf
2022-12-16 08:52:54 +01:00
Euripedes Rocha
f80772b8d7 Bugfix: Remove Remove possible null pointer dereferences
- Removed a possible derefrence on data in case of MQTT5 SUBACK with
  MQTT5 disabled.
- Covered a case of NULL data on message with negative size.
- Use correct type on calloc for alpn_protos
- Changed strcasecmp to strncasecmp.
2022-12-15 13:02:46 +01:00
Euripedes Rocha
d1f6ad23b7 Fix error code verification on SUBSCRIBE error
- Return codes other than 0x1, 0x2, 0x3 and 0x80 are reserved and
  forbidden by the specification.
2022-12-05 15:22:48 +01:00
Euripedes Rocha
8a6005781d Adds missing header.
- esp_heap_caps is directly needed and wasn't included.
- For target it's indirecly included but for host test it's needed.
2022-11-03 15:26:43 +01:00
Euripedes Rocha
3738fcd196 Moves state change when stopping the client
- In some situations client could be left in a state where it's
  impossible to restart due to a state change while waiting for the
  stop. This guarantee that it's possible to start after calling stop.

Closes https://github.com/espressif/esp-mqtt/issues/239
2022-10-26 14:37:28 +02:00
Euripedes Rocha
9af5c26045 Adds error code to MQTT_EVENT_SUBSCRIBED in case of failure
- Payload data parsed for error codes. Check only for first filter
  because our subscribe function only handle one topic filter in each
  call.

- Closes https://github.com/espressif/esp-mqtt/issues/233
2022-10-20 13:29:16 +02:00
Euripedes Rocha
47b3f9b899 Adds debug information on sending dup messages
- To support debug of resending dup messages QoS 1 and 2 a debug
  log was added.
2022-10-03 07:43:01 +00:00
David Cermak
97503cceb3 client: Add support for user events
Also supporting configurable queue size for the internal event loop.

Closes https://github.com/espressif/esp-mqtt/issues/230
2022-07-29 09:08:52 +02:00
Euripedes Rocha
a9a9fe76bf Adds unregister event API
- Added to enable users to unregister event handler.

 Closes https://github.com/espressif/esp-idf/issues/9194
2022-07-28 10:36:24 +00:00
Euripedes Rocha
ae53d799da Restructure the client configuration struct
- Groups configuration fields by context.
- Removes user_context in favor of the event loop.
2022-07-13 08:37:20 -03:00
Euripedes Rocha
89e5c6014f fix: MQTT tick not starting on connect and switch to esp_timer
- Tick should be updated on connect
- Dependency of system timer removed to avoid issues when updating via
  SNTP

Closes https://github.com/espressif/esp-mqtt/issues/225
2022-06-23 12:43:58 -03:00
yuanjm
fdf2aeb36f Seperate MQTT5 from MQTT 3.1.1 2022-06-14 09:37:46 +00:00
yuanjm
3d275f42b9 mqtt: Support MQTT5 protocol 2022-06-14 09:37:46 +00:00
Laukik Hase
7253211a45 mqtt_tcp: Fix build issue when MQTT_SSL is disabled 2022-06-14 13:43:45 +05:30
David Čermák
a21c387d62 Merge branch 'refactor/tcp_transport' into 'master'
mqtt_client: Added checks for cleanly-closed connection and timeout

See merge request espressif/esp-mqtt!118
2022-06-09 15:20:24 +08:00
David Čermák
7a31a555e9 Merge branch 'bugfix/fix_esp_mqtt_client_enqueue' into 'master'
mqtt_client: fix esp_mqtt_client_enqueue for len=0 (GitHub PR)

See merge request espressif/esp-mqtt!135
2022-06-08 19:33:38 +08:00
Laukik Hase
e05d873aa2 Added checks for cleanly-closed connection and timeout
- Related MR: https://gitlab.espressif.cn:6688/espressif/esp-idf/-/merge_requests/16394
2022-06-08 16:12:11 +05:30
David Cermak
9299f5400f Fix implicit malloc/free inclusion
This fails when building on host
2022-06-08 05:16:29 +00:00
Craig Kewley
69b6493423 mqtt_client: fix esp_mqtt_client_enqueue for len=0
Commit 372b323 (mqtt_client: Fix mqtt send long data error, 2021-12-21)
removed the length calculation from esp_mqtt_client_enqueue_priv and
added it to esp_mqtt_client_publish. However, esp_mqtt_client_enqueue
was missed. Currently calls to esp_mqtt_client_enqueue appear to send no
data, fix this by adding the length calculation to esp_mqtt_client_enqueue.
2022-05-30 21:56:33 +01:00
Yuan Jian Min
647e0eff32 feat(mqtt): Optimize mqtt transport list and remove unused transport 2022-05-23 22:19:24 +08:00
David Čermák
59b48a4d49 Merge branch 'bugfix/keep_alive_ping_periodic' into 'master'
Changes the moment we update keepalive_tick.

See merge request espressif/esp-mqtt!127
2022-04-19 22:16:19 +08:00
gabsuren
6b794e4708 MQTT: Fix signature matching for integer values
Closes https://github.com/espressif/esp-idf/issues/8482
2022-04-08 19:56:56 +04:00
Euripedes Rocha
2c2e6f38b5 Changes the moment we update keepalive_tick.
In order to keep sending keep alive messages in the scenario were client
publish too often with QoS0 the keepalive is updated when the response
is received.
2022-04-07 09:14:03 -03:00
AndriiFilippov
fb3184cc14 Make the mqtt submodule logging tags lower case 2022-04-04 10:33:06 +02:00
Darian Leung
6ef98d6510 Client: Remove usage of legacy FreeRTOS types 2022-01-13 00:34:53 +08:00
yuanjm
372b323535 mqtt_client: Fix mqtt send long data error
Closes https://github.com/espressif/esp-mqtt/issues/214
2021-12-21 15:31:56 +08:00
yuanjm
df8dc92870 Client: Fix use esp_mqtt_client_enqueue API to send data, data dup flag will be set 1 2021-11-26 15:52:04 +08:00