Skip to content
Commit 301243ed authored by Marcin Niestroj's avatar Marcin Niestroj Committed by Christopher Friedt
Browse files

drivers: wifi: esp_at: fix race condition when waiting for 'SEND OK'



This is more or less the flow of AT+CIPSEND:

  RX                         TX
  --                         --
                             AT+CIPSEND=<...>
  OK
  >
                             <data to be sent>
  SEND OK / SEND FAIL

'sem_response' semaphore is released by receiving 'OK'. Then after
receiving '>' (which releases 'sem_tx_ready' semaphore) actual data is
sent. Waiting for 'SEND OK' or 'SEND FAIL' is implemented by waiting on
'sem_response' (the same as for 'OK'), which mean that resetting this
semaphore just after sending all data is racy.

Fix that race condition by resetting 'sem_response' just after receiving
'OK', so that neither 'SEND OK' nor 'SEND FAIL' will appear yet (they
will not be sent as long as we won't send whole payload).

Signed-off-by: default avatarMarcin Niestroj <m.niestroj@grinn-global.com>
parent 01852138
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment