| 715 | } |
| 716 | |
| 717 | static void send_ping(struct peer *peer) |
| 718 | { |
| 719 | /* If it's still sending us traffic, maybe ping reply is backed up? |
| 720 | * That's OK, ping is just to make sure it's still alive, and clearly |
| 721 | * it is. */ |
| 722 | if (timemono_before(peer->last_recv_time, |
| 723 | timemono_sub(time_mono(), time_from_sec(60)))) { |
| 724 | /* Already have a ping in flight? */ |
| 725 | if (peer->expecting_pong != PONG_UNEXPECTED) { |
| 726 | status_peer_debug(&peer->id, "Last ping unreturned: hanging up"); |
| 727 | if (peer->to_peer) |
| 728 | io_close(peer->to_peer); |
| 729 | return; |
| 730 | } |
| 731 | |
| 732 | inject_peer_msg(peer, take(make_ping(NULL, 1, 0))); |
| 733 | peer->ping_start = time_mono(); |
| 734 | peer->expecting_pong = PONG_EXPECTED_PROBING; |
| 735 | } |
| 736 | |
| 737 | set_ping_timer(peer); |
| 738 | } |
| 739 | |
| 740 | void set_custommsgs(struct daemon *daemon, const u8 *msg) |
| 741 | { |
nothing calls this directly
no test coverage detected