From ebe3b0d302edecb8e2fc900224dbc7c63248769f Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 14 Jan 2021 10:08:49 +0900 Subject: [PATCH] webclient: Report unexpected connection loss as an explicit error Otherwise, it can end up with mysterious results in user apps. --- netutils/webclient/webclient.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c index 45cd91de0..26b4d1b4a 100644 --- a/netutils/webclient/webclient.c +++ b/netutils/webclient/webclient.c @@ -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; }