2017-08-29 01:36:01 +09:30
|
|
|
#ifndef LIGHTNING_COMMON_PEER_FAILED_H
|
|
|
|
#define LIGHTNING_COMMON_PEER_FAILED_H
|
2017-02-24 16:22:55 +10:30
|
|
|
#include "config.h"
|
|
|
|
#include <ccan/compiler/compiler.h>
|
|
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
|
|
|
|
struct channel_id;
|
2019-06-04 03:41:25 +09:30
|
|
|
struct per_peer_state;
|
2017-02-24 16:22:55 +10:30
|
|
|
|
2022-12-01 15:36:06 -06:00
|
|
|
/* 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);
|
|
|
|
|
2017-02-24 16:22:55 +10:30
|
|
|
/**
|
2021-02-02 23:19:01 +10:30
|
|
|
* peer_failed_warn - Send a warning msg and close the connection.
|
2019-06-04 03:41:25 +09:30
|
|
|
* @pps: the per-peer state.
|
2021-02-02 23:19:01 +10:30
|
|
|
* @channel_id: channel with error, or NULL for no particular channel.
|
2018-02-19 11:36:14 +10:30
|
|
|
* @fmt...: format as per status_failed(STATUS_FAIL_PEER_BAD)
|
2017-02-24 16:22:55 +10:30
|
|
|
*/
|
2021-02-02 23:19:01 +10:30
|
|
|
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_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, ...)
|
2019-06-04 03:41:25 +09:30
|
|
|
PRINTF_FMT(3,4) NORETURN;
|
2018-02-19 11:36:15 +10:30
|
|
|
|
2018-08-02 16:19:55 +09:30
|
|
|
/* We're failing because peer sent us an error message: NULL
|
|
|
|
* channel_id means all channels. */
|
2019-06-04 03:41:25 +09:30
|
|
|
void peer_failed_received_errmsg(struct per_peer_state *pps,
|
2018-02-19 11:36:15 +10:30
|
|
|
const char *desc,
|
2019-12-13 20:46:14 +10:30
|
|
|
const struct channel_id *channel_id,
|
|
|
|
bool soft_error)
|
|
|
|
NORETURN;
|
2018-02-19 11:36:15 +10:30
|
|
|
|
|
|
|
/* I/O error */
|
|
|
|
void peer_failed_connection_lost(void) NORETURN;
|
|
|
|
|
2017-08-29 01:36:01 +09:30
|
|
|
#endif /* LIGHTNING_COMMON_PEER_FAILED_H */
|