aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/asyncio/sslproto.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-02-07 09:25:06 +0300
committershadchin <shadchin@yandex-team.com>2024-02-07 09:40:03 +0300
commit3139d9ab6df2a7014d19b87582466d17b4f496e2 (patch)
tree7fcb26a72dac212aa26beaaa7cd769fb1e396b5e /contrib/tools/python3/src/Lib/asyncio/sslproto.py
parent4c04a8d1e278e6ca7ff16c11b74b2f16fc144253 (diff)
downloadydb-3139d9ab6df2a7014d19b87582466d17b4f496e2.tar.gz
Update Python 3 to 3.11.8
Diffstat (limited to 'contrib/tools/python3/src/Lib/asyncio/sslproto.py')
-rw-r--r--contrib/tools/python3/src/Lib/asyncio/sslproto.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/contrib/tools/python3/src/Lib/asyncio/sslproto.py b/contrib/tools/python3/src/Lib/asyncio/sslproto.py
index 488e17d8bc..e51669a2ab 100644
--- a/contrib/tools/python3/src/Lib/asyncio/sslproto.py
+++ b/contrib/tools/python3/src/Lib/asyncio/sslproto.py
@@ -1,3 +1,7 @@
+# Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.0
+# SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0)
+# SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io
+
import collections
import enum
import warnings
@@ -243,13 +247,12 @@ class _SSLProtocolTransport(transports._FlowControlMixin,
The protocol's connection_lost() method will (eventually) be
called with None as its argument.
"""
- self._closed = True
- if self._ssl_protocol is not None:
- self._ssl_protocol._abort()
+ self._force_close(None)
def _force_close(self, exc):
self._closed = True
- self._ssl_protocol._abort(exc)
+ if self._ssl_protocol is not None:
+ self._ssl_protocol._abort(exc)
def _test__append_write_backlog(self, data):
# for test only
@@ -576,6 +579,7 @@ class SSLProtocol(protocols.BufferedProtocol):
peercert = sslobj.getpeercert()
except Exception as exc:
+ handshake_exc = None
self._set_state(SSLProtocolState.UNWRAPPED)
if isinstance(exc, ssl.CertificateError):
msg = 'SSL handshake failed on verifying the certificate'
@@ -614,7 +618,7 @@ class SSLProtocol(protocols.BufferedProtocol):
if self._app_transport is not None:
self._app_transport._closed = True
if self._state == SSLProtocolState.DO_HANDSHAKE:
- self._abort()
+ self._abort(None)
else:
self._set_state(SSLProtocolState.FLUSHING)
self._shutdown_timeout_handle = self._loop.call_later(
@@ -661,10 +665,10 @@ class SSLProtocol(protocols.BufferedProtocol):
else:
self._loop.call_soon(self._transport.close)
- def _abort(self):
+ def _abort(self, exc):
self._set_state(SSLProtocolState.UNWRAPPED)
if self._transport is not None:
- self._transport.abort()
+ self._transport._force_close(exc)
# Outgoing flow