mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
common: peer_billboard() helper for updating the billboard.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
cca0a5412e
commit
d4a172e221
@ -25,6 +25,7 @@ COMMON_SRC_NOGEN := \
|
||||
common/keyset.c \
|
||||
common/memleak.c \
|
||||
common/msg_queue.c \
|
||||
common/peer_billboard.c \
|
||||
common/peer_failed.c \
|
||||
common/permute_tx.c \
|
||||
common/ping.c \
|
||||
|
17
common/peer_billboard.c
Normal file
17
common/peer_billboard.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <common/gen_status_wire.h>
|
||||
#include <common/peer_billboard.h>
|
||||
#include <common/status.h>
|
||||
|
||||
void peer_billboard(bool perm, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *str;
|
||||
|
||||
va_start(ap, fmt);
|
||||
str = tal_vfmt(NULL, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
status_send(take(towire_status_peer_billboard(NULL, perm, str)));
|
||||
tal_free(str);
|
||||
}
|
9
common/peer_billboard.h
Normal file
9
common/peer_billboard.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef LIGHTNING_COMMON_PEER_BILLBOARD_H
|
||||
#define LIGHTNING_COMMON_PEER_BILLBOARD_H
|
||||
#include "config.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Key information for RPC display: perm means it outlasts this daemon. */
|
||||
void peer_billboard(bool perm, const char *fmt, ...);
|
||||
|
||||
#endif /* LIGHTNING_COMMON_PEER_BILLBOARD_H */
|
@ -57,7 +57,7 @@ void status_setup_async(struct daemon_conn *master)
|
||||
setup_logging_sighandler();
|
||||
}
|
||||
|
||||
static void status_send(const u8 *msg TAKES)
|
||||
void status_send(const u8 *msg TAKES)
|
||||
{
|
||||
if (status_fd >= 0) {
|
||||
int type =fromwire_peektype(msg);
|
||||
|
@ -51,5 +51,6 @@ void status_failed(enum status_failreason code,
|
||||
* msg NULL == read failure. */
|
||||
void master_badmsg(u32 type_expected, const u8 *msg) NORETURN;
|
||||
|
||||
void status_send(const u8 *msg TAKES);
|
||||
void status_send_fatal(const u8 *msg TAKES, int fd1, int fd2) NORETURN;
|
||||
#endif /* LIGHTNING_COMMON_STATUS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user