mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
3c6eec87e3
This is a bit messier than I'd like, but we want to clearly remove all dev code (not just have it uncalled), so we remove fields and functions altogether rather than stub them out. This means we put #ifdefs in callers in some places, but at least it's explicit. We still run tests, but only a subset, and we run with NO_VALGRIND under Travis to avoid increasing test times too much. See-also: #176 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
#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 */
|