Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function
Posted: Tue Oct 16, 2018 3:57 pm
I've seen sometimes the GSM returns "NO CARRIER" message (which indicates connection has been lost), but sometimes it doesn't return the message and program gets stuckYeah. something like that you need implement state machine for that
However I added to go to a Reset state when receiveing a "NO CARRIER" message
That's not all. My program have 2 tasks, one for downloading the file (https) and other for GSM communication.
The problem is when I lose connection when downloading a file (removing the SIM card), the https task gets stuck in mbedtls_ssl_read(), I use the typical do while() for reading from server:
Code: Select all
do
{
len = BUFFSIZE;
ret = mbedtls_ssl_read(&ssl, (unsigned char *)bufferRead, len);
if(ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE)
{
...
}
if(ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)
{
...
}
if( ret < 0 ) /* receive error */
{
...
}
else if( (ret > 0) && (!resp_body_start) ) /* reading header first and a piece of body */
{
...
}
else if( (ret > 0) && (resp_body_start) ) /* already read the header, reading body */
{
...
}
else if( ret == 0 ) /* packet over */
{
...
}
}
while(1);Tried to call pppapi_close() and pppapi_free() in the reset state of GSM, but https still gets stuck.
It's like somehow I have to tell to ssl layer that connection have been closed...
Do you have any clue about this?
Thanks again Ritesh, you've been very helpful.