uvloop icon indicating copy to clipboard operation
uvloop copied to clipboard

Can't peek at paused bytes (socket behind TCPTransport unavailable)

Open rwarren opened this issue 5 years ago • 1 comments

  • uvloop version: 0.14.0
  • Python version: 3.8.2
  • Platform: linux
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: n/a (this is an api thing)
  • Does uvloop behave differently from vanilla asyncio? How?:
    • vanilla asyncio: the underlying socket is available in transport._sock for consenting coders aware of the risks using "private" members
    • uvloop: the underlying socket is not available to python at all (or at least I can't find it via introspection)

FWIW, one reason I'm running into this right now is that I have a case where the transport is paused for reading (transport.pause_reading()), but I would still like to peek at the bytes with sock.recv(n, socket.MSG_PEEK).

rwarren avatar Mar 23 '20 14:03 rwarren

vanilla asyncio: the underlying socket is available in transport._sock for consenting coders aware of the risks using "private" members

This won't be the case soon, as asyncio adopts the same proxy-socket object design choice that uvloop made.

Ideally we need to add new API to asyncio for peeking.

1st1 avatar Mar 31 '20 00:03 1st1