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