Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #33144

Closed (moved)
(moved)
Open
Created Feb 03, 2020 by David Fifield@dcf

Overhaul websocketconn.Conn; implement net.Conn

In the turbotunnel branch I found it convenient to have websocketconn.Conn implement net.Conn, not only io.ReadWriteCloser. While implementing the additional methods, I found some ways that websocketconn.Conn's existing methods do not satisfy the requirements of net.Conn:

  • there are data races when multiple goroutines call Read or Write.
    • this is partly because Read assigns to the shared field conn.r, and partly because the underlying websocket.Conn doesn't permit concurrent access.
  • when a websocketconn.Conn is closed, it starts returning some kind of websocket.CloseError, not io.EOF.

This branch

  1. adds tests that expose the above issues
  2. rewrites websocketconn.Conn to serialize Reads and Writes using my favorite io.Pipe-with-goroutine trick
  3. transforms websocket.CloseError with code CloseNormalClosure or CloseNoStatusReceived to io.EOF
  4. implements the remaining net.Conn methods
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking