MCPcopy Index your code
hub / github.com/python/cpython / _real_connect

Method _real_connect

Lib/ssl.py:1427–1451  ·  view source on GitHub ↗
(self, addr, connect_ex)

Source from the content-addressed store, hash-verified

1425 self.settimeout(timeout)
1426
1427 def _real_connect(self, addr, connect_ex):
1428 if self.server_side:
1429 raise ValueError("can't connect in server-side mode")
1430 # Here we assume that the socket is client-side, and not
1431 # connected at the time of the call. We connect it, then wrap it.
1432 if self._connected or self._sslobj is not None:
1433 raise ValueError("attempt to connect already-connected SSLSocket!")
1434 self._sslobj = self.context._wrap_socket(
1435 self, False, self.server_hostname,
1436 owner=self, session=self._session
1437 )
1438 try:
1439 if connect_ex:
1440 rc = super().connect_ex(addr)
1441 else:
1442 rc = None
1443 super().connect(addr)
1444 if not rc:
1445 self._connected = True
1446 if self.do_handshake_on_connect:
1447 self.do_handshake()
1448 return rc
1449 except (OSError, ValueError):
1450 self._sslobj = None
1451 raise
1452
1453 def connect(self, addr):
1454 """Connects to remote ADDR, and then wraps the connection in

Callers 2

connectMethod · 0.95
connect_exMethod · 0.95

Calls 4

do_handshakeMethod · 0.95
superClass · 0.85
connect_exMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected