Skip to content

Commit e7ca765

Browse files
jasonpcarrollJason CarrollSoren PtakAniruddhaKanhere
authored
Fixes to timeout of sendMessageVector and refactor of sendBuffer for consistency (#224)
* Fixes to timeout of sendMessageVector and refactor of sendBuffer for consistency. * Update size table. * Fixing some small MISRA related issues * Formatting fix * Minor fixes for CBMC. * Updated logical flow to break instead. * Revert "Updated logical flow to break instead." This reverts commit 0ac1c6a. * Updated unit tests for coverage. * Fix MQTT_Publish Proof * Fix proofs for connect/sub/unsub API functions * New timing scheme. * Update config defaults to reflect new timing change. * Fix doxygen. Fix formatting. Fix memory table. * Doxygen fixes. * Fix CBMC proofs * Added License identifier back. * Swapped from warning to error for Visual Studio. Co-authored-by: Jason Carroll <[email protected]> Co-authored-by: Soren Ptak <[email protected]> Co-authored-by: Aniruddha Kanhere <[email protected]>
1 parent dafa7c8 commit e7ca765

File tree

11 files changed

+257
-138
lines changed

11 files changed

+257
-138
lines changed

docs/doxygen/pages.dox

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ which is defined by @ref MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT.
114114
For @ref mqtt_processloop_function and @ref mqtt_receiveloop_function, the timeout value represents the <i>minimum</i> duration that will be spent in the function, provided there are no network errors.
115115
Should the timeout be set to 0, then the loop will run for a single iteration. A single iteration of a loop consists of an attempt to receive a single byte from the network, and
116116
if the single byte receive was successful, then attempt(s) to receive the rest of the packet (with retry attempts governed by @ref MQTT_RECV_POLLING_TIMEOUT_MS), followed by sending acknowledgement response, if needed
117-
(with retry attempts governed by @ref MQTT_SEND_RETRY_TIMEOUT_MS), and then, finally deserialization of the packet received and a call to the application callback.
117+
(with retry attempts governed by @ref MQTT_SEND_TIMEOUT_MS), and then, finally deserialization of the packet received and a call to the application callback.
118118
If the first read did not succeed, then instead the library checks if a ping request needs to be sent (only for the process loop).
119119

120120
See the below diagrams for a representation of the above flows:
@@ -154,8 +154,8 @@ Some configuration settings are C pre-processor constants, and some are function
154154
@section MQTT_RECV_POLLING_TIMEOUT_MS
155155
@copydoc MQTT_RECV_POLLING_TIMEOUT_MS
156156

157-
@section MQTT_SEND_RETRY_TIMEOUT_MS
158-
@copydoc MQTT_SEND_RETRY_TIMEOUT_MS
157+
@section MQTT_SEND_TIMEOUT_MS
158+
@copydoc MQTT_SEND_TIMEOUT_MS
159159

160160
@section MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT
161161
@copydoc MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT

docs/doxygen/timeouts.dox

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The timeouts and the recommended configurations are listed below.
99
2. [MQTT Keep Alive interval](@ref mqtt_timeouts_keep_alive)
1010
3. [MQTT Ping Response timeout](@ref mqtt_timeouts_ping_response)
1111
4. [MQTT Receive Polling timeout](@ref mqtt_timeouts_receive_polling)
12-
5. [MQTT Send Retry timeout](@ref mqtt_timeouts_send_retry)
12+
5. [MQTT Send timeout](@ref mqtt_timeouts_send)
1313
6. [Timeouts for MQTT_ProcessLoop and MQTT_ReceiveLoop APIs](@ref mqtt_timeouts_process_receive_loop)
1414
7. [Timeout for MQTT_Connect](@ref mqtt_timeouts_connect)
1515

@@ -67,10 +67,8 @@ without any data received, we recommend using a value larger than the Transport
6767

6868
The MQTT Receive Polling timeout can be set by defining the configuration @ref MQTT_RECV_POLLING_TIMEOUT_MS.
6969

70-
@section mqtt_timeouts_send_retry MQTT Send Retry timeout
71-
MQTT Send Retry timeout is the maximum duration between non-empty network transmissions while sending an MQTT packet via the
72-
@ref mqtt_processloop_function or @ref mqtt_receiveloop_function API functions. This timeout represents the maximum duration
73-
that is allowed for no data transmission over the network through the Transport Send function.
70+
@section mqtt_timeouts_send MQTT Send timeout
71+
MQTT Send timeout is the maximum duration allowed to send an MQTT packet over the transport interface.
7472

7573
It is important to note that having this timeout too short will result in MQTT being disconnected due to the possibility
7674
of partial data being sent. If you have small TCP buffers and a high latency network, the optimum value for the timeout
@@ -80,7 +78,7 @@ hitting a timeout of Transport Send before any data could be sent to transport l
8078
than the Transport Send timeout. If a dummy implementation of the @ref MQTTGetCurrentTimeFunc_t timer function,
8179
that always returns 0, is used, then this timeout must be set to 0.
8280

83-
The MQTT Send Retry timeout can be set by defining the configuration @ref MQTT_SEND_RETRY_TIMEOUT_MS.
81+
The MQTT Send timeout can be set by defining the configuration @ref MQTT_SEND_TIMEOUT_MS.
8482

8583
@section mqtt_timeouts_process_receive_loop Timeouts for MQTT_ProcessLoop and MQTT_ReceiveLoop APIs
8684
This timeout is passed as an argument to @ref mqtt_processloop_function or @ref mqtt_receiveloop_function API functions.

0 commit comments

Comments
 (0)