Ensure ProcessMessages and SendMessages is called on this connection
(self, *, timeout=60)
| 712 | self.sync_with_ping(timeout=timeout) |
| 713 | |
| 714 | def sync_with_ping(self, *, timeout=60): |
| 715 | """Ensure ProcessMessages and SendMessages is called on this connection""" |
| 716 | # Sending two pings back-to-back, requires that the node calls |
| 717 | # `ProcessMessage` twice, and thus ensures `SendMessages` must have |
| 718 | # been called at least once |
| 719 | self.send_without_ping(msg_ping(nonce=0)) |
| 720 | self.send_without_ping(msg_ping(nonce=self.ping_counter)) |
| 721 | |
| 722 | def test_function(): |
| 723 | return self.last_message.get("pong") and self.last_message["pong"].nonce == self.ping_counter |
| 724 | |
| 725 | self.wait_until(test_function, timeout=timeout) |
| 726 | self.ping_counter += 1 |
| 727 | |
| 728 | |
| 729 | # One lock for synchronizing all data access between the network event loop (see |