mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-12 14:45:09 -05:00
Call taskYIELD after calling FreeRTOS_send in Plaintext_FreeRTOS_send (#491)
FreeRTOS_send adds the packet to be sent to the IP task's queue for later processing. The packet is sent later by the IP task. When FreeRTOS is used in collaborative mode (i.e. configUSE_PREEMPTION is 0), the Plaintext_FreeRTOS_send function returns without actually sending the packet as the IP task never gets a chance to run. The fact that Plaintext_FreeRTOS_send returns without actually sending the packet causes an issue in the MQTT_Connect which expects the CONNECT packet to be actually sent and waits for CONNACK. This commit adds a taskYIELD call after calling FreeRTOS_send to ensure that the IP task gets a chance to run and send the packet before the Plaintext_FreeRTOS_send function returns.
This commit is contained in:
parent
748a701b91
commit
52c9756f21
1 changed files with 22 additions and 9 deletions
|
|
@ -29,6 +29,9 @@
|
|||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#if ( configUSE_PREEMPTION == 0 )
|
||||
#include "task.h"
|
||||
#endif
|
||||
|
||||
/* FreeRTOS+TCP includes. */
|
||||
#include "FreeRTOS_IP.h"
|
||||
|
|
@ -182,5 +185,15 @@ int32_t Plaintext_FreeRTOS_send( NetworkContext_t * pNetworkContext,
|
|||
socketStatus = 0;
|
||||
}
|
||||
|
||||
#if ( configUSE_PREEMPTION == 0 )
|
||||
{
|
||||
/* FreeRTOS_send adds the packet to be sent to the IP task's queue for later processing.
|
||||
* The packet is sent later by the IP task. When FreeRTOS is used in collaborative
|
||||
* mode (i.e. configUSE_PREEMPTION is 0), call taskYIELD to give IP task a chance to run
|
||||
* so that the packet is actually sent before this function returns. */
|
||||
taskYIELD();
|
||||
}
|
||||
#endif
|
||||
|
||||
return socketStatus;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue