Description
_start_tls_compatible = True - так как это обёртка, убираем подобную логику
self._loop = loop - будет ли работать класс, если указать loop, отличный от текущего?
asyncio: SSLProtocol and _SSLProtocolTransport are heavily coupled so need merging
Analyzing how asyncio internals work, I was puzzled by a role of asyncio.sslproto._SSLProtocolTransport
, its domain relation to asyncio.sslproto.SSLProtocol
, and why the latter is a thin shell that just redirects all function calls back to SSLProtocol
.
After spending some time matching the ends I found out that both classes are actually two faces of the same object. One is the plaintext side looking at user-supplied Protocol, and another is the cyphertext side looking at the actual data source. Thus, they are extremely coupled and cannot be seen independently.
As a result, these two objects need to be turned into two interfaces of a single asyncio.sslproto.SSLProtocol
. In other words:
class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
...
class SSLProtocol(protocols.BufferedProtocol):
...
should be converted into:
class SSLProtocol(protocols.BufferedProtocol, transports._FlowControlMixin, transports.Transport):
...
for easier understanding of what's happening and elimination of an excessive entity that requires understanding.