Skip to content

WiFiClient improperly treats zero data available for read as an error #4435

Closed
@MHotchin

Description

@MHotchin

In "arduino-esp32/libraries/WiFi/src/WiFiClient.cpp".

If the client has run out of data that has been received, it will return an error, instead of returning 0 (indicating no data available right now).

Starting line 106:

    int read(uint8_t * dst, size_t len){
        if(!dst || !len || (_pos == _fill && !fillBuffer())){
            return -1;

Change to:

    int read(uint8_t * dst, size_t len){
        if(!dst || !len || (_pos == _fill && !fillBuffer())){
            return _failed ? -1: 0;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions