mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
443082ba98
We generalize the current df-only "aborted" flag (and invert it) to a "disconnected" flag in the peer status message. We convert it back to the aborted flag for now inside subd.c, but that's next. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
57 lines
1.8 KiB
C
57 lines
1.8 KiB
C
#ifndef LIGHTNING_COMMON_PEER_FAILED_H
|
|
#define LIGHTNING_COMMON_PEER_FAILED_H
|
|
#include "config.h"
|
|
#include <ccan/compiler/compiler.h>
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
struct channel_id;
|
|
struct per_peer_state;
|
|
|
|
/* peer_fatal_continue - Send a message to master, we've failed */
|
|
void NORETURN peer_fatal_continue(const u8 *msg TAKES, const struct per_peer_state *pps);
|
|
|
|
/**
|
|
* peer_failed_warn - Send a warning msg and close the connection.
|
|
* @pps: the per-peer state.
|
|
* @channel_id: channel with error, or NULL for no particular channel.
|
|
* @fmt...: format as per status_failed(STATUS_FAIL_PEER_BAD)
|
|
*/
|
|
void peer_failed_warn(struct per_peer_state *pps,
|
|
const struct channel_id *channel_id,
|
|
const char *fmt, ...)
|
|
PRINTF_FMT(3,4) NORETURN;
|
|
|
|
/**
|
|
* peer_failed_warn_nodisconnect - Send a warning msg, don't close.
|
|
* @pps: the per-peer state.
|
|
* @channel_id: channel with error, or NULL for no particular channel.
|
|
* @fmt...: format as per status_failed(STATUS_FAIL_PEER_BAD)
|
|
*/
|
|
void peer_failed_warn_nodisconnect(struct per_peer_state *pps,
|
|
const struct channel_id *channel_id,
|
|
const char *fmt, ...)
|
|
PRINTF_FMT(3,4) NORETURN;
|
|
|
|
/**
|
|
* peer_failed_err - Send a warning msg and close the channel.
|
|
* @pps: the per-peer state.
|
|
* @channel_id: channel with error.
|
|
* @fmt...: format as per status_failed(STATUS_FAIL_PEER_BAD)
|
|
*/
|
|
void peer_failed_err(struct per_peer_state *pps,
|
|
const struct channel_id *channel_id,
|
|
const char *fmt, ...)
|
|
PRINTF_FMT(3,4) NORETURN;
|
|
|
|
/* We're failing because peer sent us an error message: NULL
|
|
* channel_id means all channels. */
|
|
void peer_failed_received_errmsg(struct per_peer_state *pps,
|
|
bool disconnect,
|
|
const char *desc)
|
|
NORETURN;
|
|
|
|
/* I/O error */
|
|
void peer_failed_connection_lost(void) NORETURN;
|
|
|
|
#endif /* LIGHTNING_COMMON_PEER_FAILED_H */
|