This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit ee1f4fdcdbbfbb02f4e9e9970b27e45a95a724e7 Author: YAMAMOTO Takashi <yamam...@midokura.com> AuthorDate: Thu Jan 14 12:25:05 2021 +0900 webclient: Don't call the sink callback if no data is available This happened frequently for me with Docker Desktop's /var/run/docker.sock on macOS. But I believe it can happen on other environments, even with TCP. Alternatively, this case can be handled by the callback implementations. But it's simpler to handle the corner case here. --- netutils/webclient/webclient.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c index 73c18dc..539c7a8 100644 --- a/netutils/webclient/webclient.c +++ b/netutils/webclient/webclient.c @@ -982,7 +982,11 @@ int webclient_perform(FAR struct webclient_context *ctx) * received file. */ - if (ctx->sink_callback) + if (ws->offset == ws->datend) + { + /* We don't have data to give to the client yet. */ + } + else if (ctx->sink_callback) { ret = ctx->sink_callback(&ws->buffer, ws->offset, ws->datend, &ws->buflen,