| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | 8 | from . import base_events | |
| 9 | 9 | from . import compat | |
| 10 | - from . import futures | ||
| 11 | 10 | from . import protocols | |
| 12 | 11 | from . import transports | |
| 13 | 12 | from .log import logger | |
@@ -413,7 +412,7 @@ class SSLProtocol(protocols.Protocol): | |||
| 413 | 412 | ||
| 414 | 413 | def __init__(self, loop, app_protocol, sslcontext, waiter, | |
| 415 | 414 | server_side=False, server_hostname=None, | |
| 416 | - call_connection_made=True, shutdown_timeout=5.0): | ||
| 415 | + call_connection_made=True): | ||
| 417 | 416 | if ssl is None: | |
| 418 | 417 | raise RuntimeError('stdlib ssl module not available') | |
| 419 | 418 | ||
@@ -444,8 +443,6 @@ def __init__(self, loop, app_protocol, sslcontext, waiter, | |||
| 444 | 443 | self._session_established = False | |
| 445 | 444 | self._in_handshake = False | |
| 446 | 445 | self._in_shutdown = False | |
| 447 | - self._shutdown_timeout = shutdown_timeout | ||
| 448 | - self._shutdown_timeout_handle = None | ||
| 449 | 446 | # transport, ex: SelectorSocketTransport | |
| 450 | 447 | self._transport = None | |
| 451 | 448 | self._call_connection_made = call_connection_made | |
@@ -560,15 +557,6 @@ def _start_shutdown(self): | |||
| 560 | 557 | self._in_shutdown = True | |
| 561 | 558 | self._write_appdata(b'') | |
| 562 | 559 | ||
| 563 | - if self._shutdown_timeout is not None: | ||
| 564 | - self._shutdown_timeout_handle = self._loop.call_later( | ||
| 565 | - self._shutdown_timeout, self._on_shutdown_timeout) | ||
| 566 | - | ||
| 567 | - def _on_shutdown_timeout(self): | ||
| 568 | - if self._transport is not None: | ||
| 569 | - self._fatal_error( | ||
| 570 | - futures.TimeoutError(), 'Can not complete shitdown operation') | ||
| 571 | - | ||
| 572 | 560 | def _write_appdata(self, data): | |
| 573 | 561 | self._write_backlog.append((data, 0)) | |
| 574 | 562 | self._write_buffer_size += len(data) | |
@@ -696,22 +684,12 @@ def _fatal_error(self, exc, message='Fatal error on transport'): | |||
| 696 | 684 | }) | |
| 697 | 685 | if self._transport: | |
| 698 | 686 | self._transport._force_close(exc) | |
| 699 | - self._transport = None | ||
| 700 | - | ||
| 701 | - if self._shutdown_timeout_handle is not None: | ||
| 702 | - self._shutdown_timeout_handle.cancel() | ||
| 703 | - self._shutdown_timeout_handle = None | ||
| 704 | 687 | ||
| 705 | 688 | def _finalize(self): | |
| 706 | 689 | self._sslpipe = None | |
| 707 | 690 | ||
| 708 | 691 | if self._transport is not None: | |
| 709 | 692 | self._transport.close() | |
| 710 | - self._transport = None | ||
| 711 | - | ||
| 712 | - if self._shutdown_timeout_handle is not None: | ||
| 713 | - self._shutdown_timeout_handle.cancel() | ||
| 714 | - self._shutdown_timeout_handle = None | ||
| 715 | 693 | ||
| 716 | 694 | def _abort(self): | |
| 717 | 695 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -96,40 +96,6 @@ def test_connection_lost(self): | |||
| 96 | 96 | test_utils.run_briefly(self.loop) | |
| 97 | 97 | self.assertIsInstance(waiter.exception(), ConnectionAbortedError) | |
| 98 | 98 | ||
| 99 | - def test_close_abort(self): | ||
| 100 | - # From issue #bpo-29406 | ||
| 101 | - # abort connection if server does not complete shutdown procedure | ||
| 102 | - ssl_proto = self.ssl_protocol() | ||
| 103 | - transport = self.connection_made(ssl_proto) | ||
| 104 | - ssl_proto._on_handshake_complete(None) | ||
| 105 | - ssl_proto._start_shutdown() | ||
| 106 | - self.assertIsNotNone(ssl_proto._shutdown_timeout_handle) | ||
| 107 | - | ||
| 108 | - exc_handler = mock.Mock() | ||
| 109 | - self.loop.set_exception_handler(exc_handler) | ||
| 110 | - ssl_proto._shutdown_timeout_handle._run() | ||
| 111 | - | ||
| 112 | - exc_handler.assert_called_with( | ||
| 113 | - self.loop, {'message': 'Can not complete shitdown operation', | ||
| 114 | - 'exception': mock.ANY, | ||
| 115 | - 'transport': transport, | ||
| 116 | - 'protocol': ssl_proto} | ||
| 117 | - ) | ||
| 118 | - self.assertIsNone(ssl_proto._shutdown_timeout_handle) | ||
| 119 | - | ||
| 120 | - def test_close(self): | ||
| 121 | - # From issue #bpo-29406 | ||
| 122 | - # abort connection if server does not complete shutdown procedure | ||
| 123 | - ssl_proto = self.ssl_protocol() | ||
| 124 | - transport = self.connection_made(ssl_proto) | ||
| 125 | - ssl_proto._on_handshake_complete(None) | ||
| 126 | - ssl_proto._start_shutdown() | ||
| 127 | - self.assertIsNotNone(ssl_proto._shutdown_timeout_handle) | ||
| 128 | - | ||
| 129 | - ssl_proto._finalize() | ||
| 130 | - self.assertIsNone(ssl_proto._transport) | ||
| 131 | - self.assertIsNone(ssl_proto._shutdown_timeout_handle) | ||
| 132 | - | ||
| 133 | 99 | def test_close_during_handshake(self): | |
| 134 | 100 | # bpo-29743 Closing transport during handshake process leaks socket | |
| 135 | 101 | waiter = asyncio.Future(loop=self.loop) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,10 +56,6 @@ Library | |||
| 56 | 56 | support for ContextManager on all versions. Original PRs by Jelle Zijlstra | |
| 57 | 57 | and Ivan Levkivskyi | |
| 58 | 58 | ||
| 59 | - - bpo-29406: asyncio SSL contexts leak sockets after calling close with | ||
| 60 | - certain servers. | ||
| 61 | - Patch by Nikolay Kim | ||
| 62 | - | ||
| 63 | 59 | - bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl | |
| 64 | 60 | implementation. Patch by Michaël Sghaïer. | |
| 65 | 61 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments