File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 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,
864864 size_t bytesToSend )
865865{
866866 int32_t sendResult ;
867- uint32_t timeoutMs ;
867+ uint32_t startTime ;
868868 int32_t bytesSentOrError = 0 ;
869869 const uint8_t * pIndex = pBufferToSend ;
870870
@@ -874,7 +874,7 @@ static int32_t sendBuffer( MQTTContext_t * pContext,
874874 assert ( pIndex != NULL );
875875
876876 /* Set the timeout. */
877- timeoutMs = pContext -> getTime () + MQTT_SEND_TIMEOUT_MS ;
877+ startTime = pContext -> getTime ();
878878
879879 while ( ( bytesSentOrError < ( int32_t ) bytesToSend ) && ( bytesSentOrError >= 0 ) )
880880 {
@@ -909,7 +909,7 @@ static int32_t sendBuffer( MQTTContext_t * pContext,
909909 }
910910
911911 /* Check for timeout. */
912- if ( pContext -> getTime () >= timeoutMs )
912+ if ( calculateElapsedTime ( pContext -> getTime (), startTime ) >= ( MQTT_SEND_TIMEOUT_MS ) )
913913 {
914914 LogError ( ( "sendBuffer: Unable to send packet: Timed out." ) );
915915 break ;
You can’t perform that action at this time.
0 commit comments