webclient: Report unexpected connection loss as an explicit error

Otherwise, it can end up with mysterious results in user apps.
This commit is contained in:
YAMAMOTO Takashi 2021-01-14 10:08:49 +09:00 committed by Xiang Xiao
parent eceaeb926a
commit ebe3b0d302

View File

@ -896,6 +896,13 @@ int webclient_perform(FAR struct webclient_context *ctx)
}
else if (ws->datend == 0)
{
if (ws->state != WEBCLIENT_STATE_DATA)
{
nerr("Connection lost unexpectedly\n");
ret = -ECONNABORTED;
goto errout_with_errno;
}
ninfo("Connection lost\n");
break;
}