Skip to content

Commit

Permalink
lightningd/channel.c: Transfer peer to connectd only if connectd alive.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZmnSCPxj authored and cdecker committed May 31, 2019
1 parent 37440e9 commit 3466261
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lightningd/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3466261

Please sign in to comment.