Skip to content

Avoid returning 0, nil in netConn.Read #367

@MarcoPolo

Description

@MarcoPolo

When we reach the end of the frame we currently return 0, nil (https://github.com/nhooyr/websocket/blob/master/netconn.go#L118). The io.Reader docs discourage this:

Implementations of Read are discouraged from returning a zero byte count with a nil error, except when len(p) == 0.

This seems to have confused other folks as well: #353

My recommendation is we don't return 0, nil and instead block until we get data or a proper error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy