(self, cdp_obj, _is_update=False)
| 900 | self._future.cancel() |
| 901 | |
| 902 | async def patched_send(self, cdp_obj, _is_update=False): |
| 903 | if _is_nodriver_connection_closed(self): |
| 904 | await self.connect() |
| 905 | if not _is_update: |
| 906 | await self._register_handlers() |
| 907 | |
| 908 | tx_id = next(self.__count__) |
| 909 | try: |
| 910 | transaction = nodriver_connection_module.Transaction(cdp_obj) |
| 911 | transaction.id = tx_id |
| 912 | except Exception: |
| 913 | transaction = _CompatTransaction(cdp_obj, tx_id) |
| 914 | self.mapper[tx_id] = transaction |
| 915 | |
| 916 | websocket = getattr(self, "websocket", None) |
| 917 | if websocket is None: |
| 918 | self.mapper.pop(tx_id, None) |
| 919 | if not transaction.done(): |
| 920 | transaction.cancel() |
| 921 | raise ConnectionError("nodriver websocket unavailable after connect") |
| 922 | |
| 923 | send_task = asyncio.create_task(websocket.send(transaction.message)) |
| 924 | send_task.add_done_callback( |
| 925 | lambda task, connection=self, tx=transaction, current_tx_id=tx_id: |
| 926 | _finalize_nodriver_send_task(connection, tx, current_tx_id, task) |
| 927 | ) |
| 928 | return await transaction |
| 929 | |
| 930 | connection_instance.send = types.MethodType(patched_send, connection_instance) |
| 931 | connection_instance._flow2api_send_patched = True |
nothing calls this directly
no test coverage detected