[issue23749] asyncio missing wrap_socket

Antoine Pitrou report at bugs.python.org
Tue Apr 28 20:26:09 CEST 2015


Antoine Pitrou added the comment:

> As for replacing the protocol but keeping the transport, what would
> be the semantics of that?

The protocol is not really replaced, it's wrapped.

Before:

  SocketTransport <- UserProtocol

After:

  SocketTransport <- (asyncio.sslproto.SSLProtocol
     <- asyncio.sslproto._SSLProtocolTransport) <- UserProtocol

That way, the same SocketTransport (but it could be something else, e.g. a pipe transport) is always bound to the event loop; we simply insert a processing layer in the chain between the original transport and the final protocol.  There are two distinct objects so that the SocketTransport sees a protocol and the UserProtocol sees a transport; but those two objects work hand in hand.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23749>
_______________________________________


More information about the Python-bugs-list mailing list