MCPcopy Index your code
hub / github.com/RustPython/RustPython / _real_connect

Method _real_connect

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

Source from the content-addressed store, hash-verified

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

Callers 2

connectMethod · 0.95
connect_exMethod · 0.95

Calls 5

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

Tested by

no test coverage detected