| 785 | } |
| 786 | |
| 787 | static void send_ping(struct peer *peer) |
| 788 | { |
| 789 | /* If it's still sending us traffic, maybe ping reply is backed up? |
| 790 | * That's OK, ping is just to make sure it's still alive, and clearly |
| 791 | * it is. */ |
| 792 | if (timemono_before(peer->last_recv_time, |
| 793 | timemono_sub(time_mono(), time_from_sec(60)))) { |
| 794 | /* Already have a ping in flight? */ |
| 795 | if (peer->expecting_pong != PONG_UNEXPECTED) { |
| 796 | status_peer_debug(&peer->id, "Last ping unreturned: hanging up"); |
| 797 | if (peer->to_peer) |
| 798 | io_close(peer->to_peer); |
| 799 | return; |
| 800 | } |
| 801 | |
| 802 | inject_peer_msg(peer, take(make_ping(NULL, 1, 0))); |
| 803 | peer->ping_start = time_mono(); |
| 804 | peer->expecting_pong = PONG_EXPECTED_PROBING; |
| 805 | } |
| 806 | |
| 807 | set_ping_timer(peer); |
| 808 | } |
| 809 | |
| 810 | void set_custommsgs(struct daemon *daemon, const u8 *msg) |
| 811 | { |
nothing calls this directly
no test coverage detected