code: func commonRead(ep tcpip.Endpoint, wq *waiter.Queue, deadline <-chan struct{}, addr *tcpip.FullAddress, errorer opErrorer, dontWait bool) ([]byte, error) {
  	select {
  	case <-deadline:
  		return nil, errorer.newOpError("read", &timeoutError{})
  	default:
  	}
  
  	read, _, err := ep.Read(addr)
  
  	if err == tcpip.ErrWouldBlock {
  		if dontWait {
  			return nil, errWouldBlock
  		}
  		// Create wait queue entry that notifies a channel.
  		waitEntry, notifyCh := waiter.NewChannelEntry(nil)
  		wq.EventRegister(&waitEntry, waiter.EventIn)
  		defer wq.EventUnregister(&waitEntry)
  		for {
  			read, _, err = ep.Read(addr)
  			if err != tcpip.ErrWouldBlock {
  				break
  			}
  			select {
  			case <-deadline:
  				return nil, errorer.newOpError("read", &timeoutError{})
  			case <-notifyCh:
  			}
  		}
  	}
  
  	if err == tcpip.ErrClosedForReceive {
  		return nil, io.EOF
  	}
  
  	if err != nil {
  		return nil, errorer.newOpError("read", errors.New(err.String()))
  	}
  
  	return read, nil
  }
docs: // commonRead implements the common logic between net.Conn.Read and
  // net.PacketConn.ReadFrom.