| 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 | |
@@ -412,7 +411,7 @@ class SSLProtocol(protocols.Protocol): | |||
| 412 | 411 | ||
| 413 | 412 | def __init__(self, loop, app_protocol, sslcontext, waiter, | |
| 414 | 413 | server_side=False, server_hostname=None, | |
| 415 | - call_connection_made=True, shutdown_timeout=5.0): | ||
| 414 | + call_connection_made=True): | ||
| 416 | 415 | if ssl is None: | |
| 417 | 416 | raise RuntimeError('stdlib ssl module not available') | |
| 418 | 417 | ||
@@ -443,8 +442,6 @@ def __init__(self, loop, app_protocol, sslcontext, waiter, | |||
| 443 | 442 | self._session_established = False | |
| 444 | 443 | self._in_handshake = False | |
| 445 | 444 | self._in_shutdown = False | |
| 446 | - self._shutdown_timeout = shutdown_timeout | ||
| 447 | - self._shutdown_timeout_handle = None | ||
| 448 | 445 | # transport, ex: SelectorSocketTransport | |
| 449 | 446 | self._transport = None | |
| 450 | 447 | self._call_connection_made = call_connection_made | |
@@ -559,15 +556,6 @@ def _start_shutdown(self): | |||
| 559 | 556 | self._in_shutdown = True | |
| 560 | 557 | self._write_appdata(b'') | |
| 561 | 558 | ||
| 562 | - if self._shutdown_timeout is not None: | ||
| 563 | - self._shutdown_timeout_handle = self._loop.call_later( | ||
| 564 | - self._shutdown_timeout, self._on_shutdown_timeout) | ||
| 565 | - | ||
| 566 | - def _on_shutdown_timeout(self): | ||
| 567 | - if self._transport is not None: | ||
| 568 | - self._fatal_error( | ||
| 569 | - futures.TimeoutError(), 'Can not complete shitdown operation') | ||
| 570 | - | ||
| 571 | 559 | def _write_appdata(self, data): | |
| 572 | 560 | self._write_backlog.append((data, 0)) | |
| 573 | 561 | self._write_buffer_size += len(data) | |
@@ -695,22 +683,12 @@ def _fatal_error(self, exc, message='Fatal error on transport'): | |||
| 695 | 683 | }) | |
| 696 | 684 | if self._transport: | |
| 697 | 685 | self._transport._force_close(exc) | |
| 698 | - self._transport = None | ||
| 699 | - | ||
| 700 | - if self._shutdown_timeout_handle is not None: | ||
| 701 | - self._shutdown_timeout_handle.cancel() | ||
| 702 | - self._shutdown_timeout_handle = None | ||
| 703 | 686 | ||
| 704 | 687 | def _finalize(self): | |
| 705 | 688 | self._sslpipe = None | |
| 706 | 689 | ||
| 707 | 690 | if self._transport is not None: | |
| 708 | 691 | self._transport.close() | |
| 709 | - self._transport = None | ||
| 710 | - | ||
| 711 | - if self._shutdown_timeout_handle is not None: | ||
| 712 | - self._shutdown_timeout_handle.cancel() | ||
| 713 | - self._shutdown_timeout_handle = None | ||
| 714 | 692 | ||
| 715 | 693 | def _abort(self): | |
| 716 | 694 | 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 | |
|---|---|---|---|
@@ -69,10 +69,6 @@ Library | |||
| 69 | 69 | - bpo-29743: Closing transport during handshake process leaks open socket. | |
| 70 | 70 | Patch by Nikolay Kim | |
| 71 | 71 | ||
| 72 | - - bpo-29406: asyncio SSL contexts leak sockets after calling close with | ||
| 73 | - certain servers. | ||
| 74 | - Patch by Nikolay Kim | ||
| 75 | - | ||
| 76 | 72 | - bpo-27585: Fix waiter cancellation in asyncio.Lock. | |
| 77 | 73 | Patch by Mathieu Sornay. | |
| 78 | 74 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments