| 52 | } |
| 53 | |
| 54 | enum dev_disconnect dev_disconnect(const struct node_id *id, int pkt_type) |
| 55 | { |
| 56 | if (dev_disconnect_fd == -1) |
| 57 | return DEV_DISCONNECT_NORMAL; |
| 58 | |
| 59 | if (!dev_disconnect_count) |
| 60 | next_dev_disconnect(); |
| 61 | |
| 62 | if (!dev_disconnect_line[0] |
| 63 | || !streq(peer_wire_name(pkt_type), dev_disconnect_line+1)) |
| 64 | return DEV_DISCONNECT_NORMAL; |
| 65 | |
| 66 | if (--dev_disconnect_count != 0) { |
| 67 | return DEV_DISCONNECT_NORMAL; |
| 68 | } |
| 69 | |
| 70 | if (lseek(dev_disconnect_fd, dev_disconnect_len+1, SEEK_CUR) < 0) { |
| 71 | err(1, "lseek failure"); |
| 72 | } |
| 73 | |
| 74 | status_peer_debug(id, "dev_disconnect: %s (%s)", dev_disconnect_line, |
| 75 | peer_wire_name(pkt_type)); |
| 76 | return dev_disconnect_line[0]; |
| 77 | } |
| 78 | |
| 79 | void dev_sabotage_fd(int fd, bool close_fd) |
| 80 | { |
no test coverage detected