peer_fail_permanent: handle take() arg.

We assume this in at least one caller.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-06-27 13:21:05 +09:30
committed by Christian Decker
parent ee9ebbc184
commit 4881129f54
2 changed files with 3 additions and 1 deletions

View File

@@ -106,6 +106,8 @@ void peer_fail_permanent(struct peer *peer, const u8 *msg)
(int)tal_len(msg), (char *)msg); (int)tal_len(msg), (char *)msg);
peer->error = towire_error(peer, &all_channels, msg); peer->error = towire_error(peer, &all_channels, msg);
peer->owner = NULL; peer->owner = NULL;
if (taken(msg))
tal_free(msg);
if (peer_persists(peer)) if (peer_persists(peer))
drop_to_chain(peer); drop_to_chain(peer);

View File

@@ -150,7 +150,7 @@ void add_peer(struct lightningd *ld, u64 unique_id,
/* Peer has failed, but try reconnected. */ /* Peer has failed, but try reconnected. */
PRINTF_FMT(2,3) void peer_fail_transient(struct peer *peer, const char *fmt,...); PRINTF_FMT(2,3) void peer_fail_transient(struct peer *peer, const char *fmt,...);
/* Peer has failed, give up on it. */ /* Peer has failed, give up on it. */
void peer_fail_permanent(struct peer *peer, const u8 *msg); void peer_fail_permanent(struct peer *peer, const u8 *msg TAKES);
/* Permanent error, but due to internal problems, not peer. */ /* Permanent error, but due to internal problems, not peer. */
void peer_internal_error(struct peer *peer, const char *fmt, ...); void peer_internal_error(struct peer *peer, const char *fmt, ...);