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.
This commit is contained in:
parent
1131cbe14d
commit
ee1f4fdcdb
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user