Connect to a remote socket at address. This method is a coroutine.
(self, sock, address)
| 626 | fut.set_result(n) |
| 627 | |
| 628 | async def sock_connect(self, sock, address): |
| 629 | """Connect to a remote socket at address. |
| 630 | |
| 631 | This method is a coroutine. |
| 632 | """ |
| 633 | base_events._check_ssl_socket(sock) |
| 634 | if self._debug and sock.gettimeout() != 0: |
| 635 | raise ValueError("the socket must be non-blocking") |
| 636 | |
| 637 | if sock.family == socket.AF_INET or ( |
| 638 | base_events._HAS_IPv6 and sock.family == socket.AF_INET6): |
| 639 | resolved = await self._ensure_resolved( |
| 640 | address, family=sock.family, type=sock.type, proto=sock.proto, |
| 641 | loop=self, |
| 642 | ) |
| 643 | _, _, _, _, address = resolved[0] |
| 644 | |
| 645 | fut = self.create_future() |
| 646 | self._sock_connect(fut, sock, address) |
| 647 | try: |
| 648 | return await fut |
| 649 | finally: |
| 650 | # Needed to break cycles when an exception occurs. |
| 651 | fut = None |
| 652 | |
| 653 | def _sock_connect(self, fut, sock, address): |
| 654 | fd = sock.fileno() |
nothing calls this directly
no test coverage detected