| 80 | |
| 81 | |
| 82 | class _SSLProtocolTransport(transports._FlowControlMixin, |
| 83 | transports.Transport): |
| 84 | |
| 85 | _start_tls_compatible = True |
| 86 | _sendfile_compatible = constants._SendfileMode.FALLBACK |
| 87 | |
| 88 | def __init__(self, loop, ssl_protocol): |
| 89 | self._loop = loop |
| 90 | self._ssl_protocol = ssl_protocol |
| 91 | self._closed = False |
| 92 | |
| 93 | def get_extra_info(self, name, default=None): |
| 94 | """Get optional transport information.""" |
| 95 | return self._ssl_protocol._get_extra_info(name, default) |
| 96 | |
| 97 | def set_protocol(self, protocol): |
| 98 | self._ssl_protocol._set_app_protocol(protocol) |
| 99 | |
| 100 | def get_protocol(self): |
| 101 | return self._ssl_protocol._app_protocol |
| 102 | |
| 103 | def is_closing(self): |
| 104 | return self._closed or self._ssl_protocol._is_transport_closing() |
| 105 | |
| 106 | def close(self): |
| 107 | """Close the transport. |
| 108 | |
| 109 | Buffered data will be flushed asynchronously. No more data |
| 110 | will be received. After all buffered data is flushed, the |
| 111 | protocol's connection_lost() method will (eventually) called |
| 112 | with None as its argument. |
| 113 | """ |
| 114 | if not self._closed: |
| 115 | self._closed = True |
| 116 | self._ssl_protocol._start_shutdown() |
| 117 | else: |
| 118 | self._ssl_protocol = None |
| 119 | |
| 120 | def __del__(self, _warnings=warnings): |
| 121 | if not self._closed: |
| 122 | self._closed = True |
| 123 | _warnings.warn( |
| 124 | "unclosed transport <asyncio._SSLProtocolTransport " |
| 125 | "object>", ResourceWarning) |
| 126 | |
| 127 | def is_reading(self): |
| 128 | return not self._ssl_protocol._app_reading_paused |
| 129 | |
| 130 | def pause_reading(self): |
| 131 | """Pause the receiving end. |
| 132 | |
| 133 | No data will be passed to the protocol's data_received() |
| 134 | method until resume_reading() is called. |
| 135 | """ |
| 136 | self._ssl_protocol._pause_reading() |
| 137 | |
| 138 | def resume_reading(self): |
| 139 | """Resume the receiving end. |
no outgoing calls
no test coverage detected
searching dependent graphs…