Closed es-kaga closed 2 years ago
@es-kaga Thank you for your feedback. We will look into this problem and reply later.
@es-kaga I reproduced the problem you described by adding delay before this line.
Socket connected URC should only be received after successfully sending the AT command to modem. PR #92 move the line to set CONNECTING state before sending the AT command. The state is reverted if the AT command failed.
Once this PR is merged. I will update the issue again.
The PR is merged. Thank you for your feedback. If there is further question related to this issue, please reopen this issue.
Hi. I am using Sara R4 module with the FreeRTOS library I noticed that when I am opening the socket using
Cellular_SocketConnect
then I got URC callback registered by theCellular_SocketRegisterSocketOpenCallback
before exitingCellular_SocketConnect
which leads to race condition on the socket statesocketHandle->socketState
since it is set toSOCKETSTATE_CONNECTING
despite the fact that socket is already connected. I am not able to send any data on the socket because send function has a check against socket state.I checked that it happens when cellular module return URC(+UUSOCO: 0,0) just right after response to the
AT+USOCO=
and the calling thread has lower priorioty then the cellular library receive thread then the URC handler is executed before exitingCellular_SocketConnect
and socket state is invalid.The temporary workaround seems to be increasing the priority of thread calling
Cellular_SocketConnect
and setting it back after this function execution.Could you take a look into this issue ?