forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev_disconnect.h
36 lines (29 loc) · 1.06 KB
/
dev_disconnect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef LIGHTNING_COMMON_DEV_DISCONNECT_H
#define LIGHTNING_COMMON_DEV_DISCONNECT_H
#include "config.h"
#include <stdbool.h>
#if DEVELOPER
enum dev_disconnect {
/* Do nothing. */
DEV_DISCONNECT_NORMAL = '=',
/* Close connection before sending packet (and fail write). */
DEV_DISCONNECT_BEFORE = '-',
/* Close connection after sending packet. */
DEV_DISCONNECT_AFTER = '+',
/* Close connection after dropping packet. */
DEV_DISCONNECT_DROPPKT = '@',
/* Swallow all writes from now on, and do no more reads. */
DEV_DISCONNECT_BLACKHOLE = '0',
};
/* Force a close fd before or after a certain packet type */
enum dev_disconnect dev_disconnect(int pkt_type);
/* Make next write on fd fail as if they'd disconnected. */
void dev_sabotage_fd(int fd);
/* No more data to arrive, what's written is swallowed. */
void dev_blackhole_fd(int fd);
/* For debug code to set in daemon. */
void dev_disconnect_init(int fd);
/* Hack for channeld to do DEV_DISCONNECT_SUPPRESS_COMMIT. */
extern bool dev_suppress_commit;
#endif /* DEVELOPER */
#endif /* LIGHTNING_COMMON_DEV_DISCONNECT_H */