(self, addr, connect_ex)
| 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 |
no test coverage detected