(self, fut, sock, address)
| 651 | fut = None |
| 652 | |
| 653 | def _sock_connect(self, fut, sock, address): |
| 654 | fd = sock.fileno() |
| 655 | try: |
| 656 | sock.connect(address) |
| 657 | except (BlockingIOError, InterruptedError): |
| 658 | # Issue #23618: When the C function connect() fails with EINTR, the |
| 659 | # connection runs in background. We have to wait until the socket |
| 660 | # becomes writable to be notified when the connection succeed or |
| 661 | # fails. |
| 662 | self._ensure_fd_no_transport(fd) |
| 663 | handle = self._add_writer( |
| 664 | fd, self._sock_connect_cb, fut, sock, address) |
| 665 | fut.add_done_callback( |
| 666 | functools.partial(self._sock_write_done, fd, handle=handle)) |
| 667 | except (SystemExit, KeyboardInterrupt): |
| 668 | raise |
| 669 | except BaseException as exc: |
| 670 | fut.set_exception(exc) |
| 671 | else: |
| 672 | fut.set_result(None) |
| 673 | finally: |
| 674 | fut = None |
| 675 | |
| 676 | def _sock_write_done(self, fd, fut, handle=None): |
| 677 | if handle is None or not handle.cancelled(): |
no test coverage detected