Browse Source

common: peer_billboard() helper for updating the billboard.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
d4a172e221
  1. 1
      common/Makefile
  2. 17
      common/peer_billboard.c
  3. 9
      common/peer_billboard.h
  4. 2
      common/status.c
  5. 1
      common/status.h

1
common/Makefile

@ -25,6 +25,7 @@ COMMON_SRC_NOGEN := \
common/keyset.c \ common/keyset.c \
common/memleak.c \ common/memleak.c \
common/msg_queue.c \ common/msg_queue.c \
common/peer_billboard.c \
common/peer_failed.c \ common/peer_failed.c \
common/permute_tx.c \ common/permute_tx.c \
common/ping.c \ common/ping.c \

17
common/peer_billboard.c

@ -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

@ -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 */

2
common/status.c

@ -57,7 +57,7 @@ void status_setup_async(struct daemon_conn *master)
setup_logging_sighandler(); setup_logging_sighandler();
} }
static void status_send(const u8 *msg TAKES) void status_send(const u8 *msg TAKES)
{ {
if (status_fd >= 0) { if (status_fd >= 0) {
int type =fromwire_peektype(msg); int type =fromwire_peektype(msg);

1
common/status.h

@ -51,5 +51,6 @@ void status_failed(enum status_failreason code,
* msg NULL == read failure. */ * msg NULL == read failure. */
void master_badmsg(u32 type_expected, const u8 *msg) NORETURN; 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; void status_send_fatal(const u8 *msg TAKES, int fd1, int fd2) NORETURN;
#endif /* LIGHTNING_COMMON_STATUS_H */ #endif /* LIGHTNING_COMMON_STATUS_H */

Loading…
Cancel
Save