File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -864,7 +864,7 @@ static int32_t sendBuffer( MQTTContext_t * pContext,
864
864
size_t bytesToSend )
865
865
{
866
866
int32_t sendResult ;
867
- uint32_t timeoutMs ;
867
+ uint32_t startTime ;
868
868
int32_t bytesSentOrError = 0 ;
869
869
const uint8_t * pIndex = pBufferToSend ;
870
870
@@ -874,7 +874,7 @@ static int32_t sendBuffer( MQTTContext_t * pContext,
874
874
assert ( pIndex != NULL );
875
875
876
876
/* Set the timeout. */
877
- timeoutMs = pContext -> getTime () + MQTT_SEND_TIMEOUT_MS ;
877
+ startTime = pContext -> getTime ();
878
878
879
879
while ( ( bytesSentOrError < ( int32_t ) bytesToSend ) && ( bytesSentOrError >= 0 ) )
880
880
{
@@ -909,7 +909,7 @@ static int32_t sendBuffer( MQTTContext_t * pContext,
909
909
}
910
910
911
911
/* Check for timeout. */
912
- if ( pContext -> getTime () >= timeoutMs )
912
+ if ( calculateElapsedTime ( pContext -> getTime (), startTime ) >= ( MQTT_SEND_TIMEOUT_MS ) )
913
913
{
914
914
LogError ( ( "sendBuffer: Unable to send packet: Timed out." ) );
915
915
break ;
You can’t perform that action at this time.
0 commit comments