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