MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _real_connect

Method _real_connect

tools/python-3.11.9-amd64/Lib/ssl.py:1386–1410  ·  view source on GitHub ↗
(self, addr, connect_ex)

Source from the content-addressed store, hash-verified

1384 self.settimeout(timeout)
1385
1386 def _real_connect(self, addr, connect_ex):
1387 if self.server_side:
1388 raise ValueError("can't connect in server-side mode")
1389 # Here we assume that the socket is client-side, and not
1390 # connected at the time of the call. We connect it, then wrap it.
1391 if self._connected or self._sslobj is not None:
1392 raise ValueError("attempt to connect already-connected SSLSocket!")
1393 self._sslobj = self.context._wrap_socket(
1394 self, False, self.server_hostname,
1395 owner=self, session=self._session
1396 )
1397 try:
1398 if connect_ex:
1399 rc = super().connect_ex(addr)
1400 else:
1401 rc = None
1402 super().connect(addr)
1403 if not rc:
1404 self._connected = True
1405 if self.do_handshake_on_connect:
1406 self.do_handshake()
1407 return rc
1408 except (OSError, ValueError):
1409 self._sslobj = None
1410 raise
1411
1412 def connect(self, addr):
1413 """Connects to remote ADDR, and then wraps the connection in

Callers 2

connectMethod · 0.95
connect_exMethod · 0.95

Calls 3

do_handshakeMethod · 0.95
connect_exMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected