lightningd/channel.c: Transfer peer to connectd only if connectd alive.

Fixes: #2677
This commit is contained in:
ZmnSCPxj 2019-05-30 14:59:23 +00:00 committed by Christian Decker
parent 37440e9447
commit 3466261b20
1 changed files with 13 additions and 3 deletions

View File

@ -32,9 +32,19 @@ void channel_set_owner(struct channel *channel, struct subd *owner,
if (old_owner) {
subd_release_channel(old_owner, channel);
if (channel->connected && !connects_to_peer(owner)) {
u8 *msg = towire_connectctl_peer_disconnected(NULL,
&channel->peer->id);
subd_send_msg(channel->peer->ld->connectd, take(msg));
/* If shutting down, connectd no longer exists,
* and we should not transfer peer to connectd.
* Only transfer to connectd if connectd is
* there to be transferred to.
*/
if (channel->peer->ld->connectd) {
u8 *msg;
msg = towire_connectctl_peer_disconnected(
NULL,
&channel->peer->id);
subd_send_msg(channel->peer->ld->connectd,
take(msg));
}
}
if (reconnect) {