| 75 | } |
| 76 | |
| 77 | enum dev_disconnect_in dev_disconnect_in(const struct node_id *id, int pkt_type) |
| 78 | { |
| 79 | if (dev_disconnect_fd == -1) |
| 80 | return DEV_DISCONNECT_IN_NORMAL; |
| 81 | |
| 82 | if (!dev_disconnect_count) |
| 83 | next_dev_disconnect(); |
| 84 | |
| 85 | if (dev_disconnect_line[0] != DEV_DISCONNECT_IN_AFTER_RECV |
| 86 | || !streq(peer_wire_name(pkt_type), dev_disconnect_line+1)) |
| 87 | return DEV_DISCONNECT_IN_NORMAL; |
| 88 | |
| 89 | if (--dev_disconnect_count != 0) { |
| 90 | return DEV_DISCONNECT_IN_NORMAL; |
| 91 | } |
| 92 | |
| 93 | if (lseek(dev_disconnect_fd, dev_disconnect_len+1, SEEK_CUR) < 0) { |
| 94 | err(1, "lseek failure"); |
| 95 | } |
| 96 | |
| 97 | status_peer_debug(id, "dev_disconnect: %s (%s)", |
| 98 | dev_disconnect_line, |
| 99 | peer_wire_name(pkt_type)); |
| 100 | return dev_disconnect_line[0]; |
| 101 | } |
| 102 | |
| 103 | void dev_sabotage_fd(int fd, bool close_fd) |
| 104 | { |
no test coverage detected