1
0
mirror of https://github.com/FreeRTOS/coreMQTT synced 2025-05-28 20:14:02 +08:00

30 Commits

Author SHA1 Message Date
Archit Aggarwal
b581fc4172
Bugfix: Fix interrupted network read operation (#120)
### Problem

The `MQTT_ProcessLoop` and `MQTT_ReceiveLoop` read incoming MQTT packet payload over the network by calling the `recvExact` function. The `recvExact` function can be called multiple times to read the expected number of bytes for the MQTT packet but it also implements a timeout functionality of receiving the expected number of payload within the timeout value passed to the function.
This causes problems when the `Transport_Recv` call returns less than requested number of bytes, and there is a timeout (for example, when calling `MQTT_ProcessLoop` with 0ms duration) which causes the function to assume failure instead of reading the remaining payload of the MQTT packet by calling `Transport_Recv` again. Thus, in such cases, the MQTT connection is severed prematurely even though there is a high probability of receiving the remaining bytes of the MQTT packet over the network.

### Solution
Instead of implementing a timeout on the entire duration of receiving the expected number of remaining MQTT packet bytes in `recvExact`, the use of timeout is being changed to be relevant only on the total time of receiving 0 bytes over the network over multiple calls to `Transport_Recv`.
As this modified meaning of the timeout duration is now unrelated to the timeout duration that the `MQTT_ProcessLoop` or `MQTT_ReceiveLoop` functions are called, a new configuration constant for the `recvExact` timeout value, `MQTT_RECV_POLLING_TIMEOUT_MS`, has been added to the library which will carry a default value of 10ms. 

Co-authored-by: Sarena Meas <sarem@amazon.com>
2020-12-04 19:49:40 -08:00
Muneeb Ahmed
73472634c6
Use stdbool.h always(#118)
* Add custom stdbool.readme file

* Add custom stdint.readme file

* Add GitHub Action to test .readme headers

* Tested GA by pushing an invalid file
2020-12-04 10:26:49 -08:00
Oscar Michael Abrina
8de05fa001
Fix typo in MQTT_Unsubscribe code example (#122)
This fixes a typo in the code example that was raised in issue #119
2020-12-04 10:00:31 -08:00
Muneeb Ahmed
ca492a40f0
Fix incorrect size compiler warning (#116) 2020-12-01 19:17:48 -08:00
Muneeb Ahmed
e1b81ae409
Remove %.*s format specifier from logs (#117) 2020-12-01 18:16:53 -08:00
Oscar Michael Abrina
de4edcd578
Cast variable type based on format identifier (#113)
Update logs to only ever use base format specifiers and cast to the standard C type to minimize compilation warnings.
2020-11-24 14:34:28 -08:00
SarenaAWS
4b8674a806
Update all references from master to main. (#110) 2020-11-18 12:27:01 -08:00
SarenaAWS
66a35e4213
Update version v1.0.0 to v1.0.1. (#97) 2020-11-02 12:11:10 -08:00
Muneeb Ahmed
1bb7a23f5c
Align wording of Init with porting guide (#95)
* Align wording of Init with porting guide

* Also add notes for connect, processloop, and receiveloop
2020-10-30 11:30:00 -07:00
SarenaAWS
93c15bdab8
Move transport_interface.h from portable/ to interface/ (#91)
* Move transport_interface.h to interface/ folder.

* Replace all paths to portable with interface.
2020-10-28 14:53:06 -07:00
Oscar Michael Abrina
7f0478d13a
Remove const qualifier from send/recv in transport interface (#86)
This follows changes from FreeRTOS/FreeRTOS@398abba. The const qualifier is removed from send/recv because there are transport implementations that require a member of the network context to be modified such as in the case of mbedtls.
2020-10-21 11:12:28 -07:00
Oscar Michael Abrina
c0fadc4339
Resend PUBACK and PUBREC irrespective of the DUP flag (#83)
This updates the coreMQTT library so as to resend a PUBACK and PUBREC for an incoming duplicate publish packet, irrespective of the broker setting the DUP flag.
2020-10-07 13:47:33 -07:00
Muneeb Ahmed
38f24af76c
Set NULL payloads and fix unit test (#71)
* Set publish payload to NULL when zero length

* Add unit test for zero length payload

* Fix unit tests for deserialize publish

* Rename setupWillInfo to setupPublishInfo

* Remove void * from memset
2020-09-18 17:40:33 -07:00
Archit Aggarwal
227c31e53e
Update versioning case (#66) 2020-09-16 11:36:03 -07:00
Oscar Michael Abrina
0e1f5fb728
Add version number and missing @file tags (#53)
* Add version numbers

* Add missing @file tags

* Update lexicon.txt

* Update @brief tag for MQTT cbmc state

Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com>
2020-09-14 16:54:24 -07:00
abhidixi11
9e62b8daac
Session present flag fix. (#56)
Update deserializeConnack private function to set output parameter flag when session present bit is not set in CONNACK response
2020-09-12 13:12:28 -07:00
SarenaAWS
e8f8c5394c
Update the transport_interface for multiple page and section definition warnings in the CSDK hub (#46) 2020-09-10 16:31:37 -07:00
SarenaAWS
76cd50a135
Add documentation for MQTT_DO_NOT_USE_CUSTOM_CONFIG (#42)
Co-authored-by: Archit Aggarwal <architag@amazon.com>
2020-09-09 13:22:02 -07:00
SarenaAWS
ea7d08f9bd
Move lexicon.txt to the top level. (#41) 2020-09-09 09:16:19 -07:00
Archit Aggarwal
9fc6f76b6d
Hygiene update of logging interface macro docs in config defaults (#33) 2020-09-08 14:51:17 -07:00
SarenaAWS
6631dde60d
Add doxygen docs to transport_interface.h (#40) 2020-09-08 12:49:53 -07:00
Archit Aggarwal
d410251813
Add config to allow MQTT build without custom config (#22) 2020-09-04 13:33:54 -07:00
Archit Aggarwal
d355bfa259
Re-brand lightweight MQTT as MQTT serializer (#29)
Rename all instance of "lightweight" MQTT with "serializer" in files and documentation
2020-09-03 14:56:32 -07:00
Muneeb Ahmed
e914df6d22
Fix MISRA 10.3 violation (#31)
* Change a UL to a U for a uint32_t
2020-09-03 11:26:14 -07:00
Archit Aggarwal
d0cc7ba5b3
Add spell check support to repository (#21)
* Add spell check scripts under tools/spell
* Break lexicon file into specific files for source/ and test/unit-test directories
2020-09-01 16:17:53 -07:00
Muneeb Ahmed
f0a8b3c1b3
Fix doxygen build due to renamed files (#20)
* Fix doxygen build due to renamed files

* ci: combine doxygen stderr into stdout
2020-09-01 12:25:24 -07:00
Muneeb Ahmed
54b54e78ad
Add define guards and change spellings (#15)
* Add checks for definition of false and true

* Prefer American spellings for optimize and acknowledgment
2020-08-31 14:51:21 -07:00
Muneeb Ahmed
b6bf2005ca
Fix bug that may sometimes disable keep alive (#7)
* Reset the waitingForPingResp flag in every MQTT_Connect
2020-08-31 12:45:46 -07:00
Archit Aggarwal
e83fadcfc7
Rename MQTT files, and Relocate CBMC and unit-test files (#12)
* Relocate CBMC to test/cbmc and unit test files to test/unit-test

* Rename all library and test files to use "core_" prefix
2020-08-31 10:02:38 -07:00
Archit Aggarwal
f2581e5da5
Re-structure files (#3)
* Relocate library, test and doc files

* Add transport interface from C-SDK

* Update file path in mqttFilePaths.cmake
2020-08-27 16:29:26 -07:00