| 801 | } |
| 802 | |
| 803 | static void send_ping(struct peer *peer) |
| 804 | { |
| 805 | /* If it's still sending us traffic, maybe ping reply is backed up? |
| 806 | * That's OK, ping is just to make sure it's still alive, and clearly |
| 807 | * it is. */ |
| 808 | if (timemono_before(peer->last_recv_time, |
| 809 | timemono_sub(time_mono(), time_from_sec(60)))) { |
| 810 | /* Already have a ping in flight? */ |
| 811 | if (peer->expecting_pong != PONG_UNEXPECTED) { |
| 812 | status_peer_debug(&peer->id, "Last ping unreturned: hanging up"); |
| 813 | if (peer->to_peer) |
| 814 | io_close(peer->to_peer); |
| 815 | return; |
| 816 | } |
| 817 | |
| 818 | inject_peer_msg(peer, take(make_ping(NULL, 1, 0))); |
| 819 | peer->ping_start = time_mono(); |
| 820 | peer->expecting_pong = PONG_EXPECTED_PROBING; |
| 821 | } |
| 822 | |
| 823 | set_ping_timer(peer); |
| 824 | } |
| 825 | |
| 826 | void set_custommsgs(struct daemon *daemon, const u8 *msg) |
| 827 | { |
nothing calls this directly
no test coverage detected