mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-30 12:24:26 +01:00
lightningd: provide peer address for reconnect if connect fails.
It usually works out due to other reconnections, but I noticed this diagnosing another test. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
c57a5a0a06
commit
e15e55190b
@@ -366,10 +366,12 @@ static void connect_failed(struct lightningd *ld,
|
||||
}
|
||||
}
|
||||
|
||||
void connect_failed_disconnect(struct lightningd *ld, const struct node_id *id)
|
||||
void connect_failed_disconnect(struct lightningd *ld,
|
||||
const struct node_id *id,
|
||||
const struct wireaddr_internal *addrhint)
|
||||
{
|
||||
connect_failed(ld, id, CONNECT_DISCONNECTED_DURING,
|
||||
"disconnected during connection", 1, NULL);
|
||||
"disconnected during connection", 1, addrhint);
|
||||
}
|
||||
|
||||
static void handle_connect_failed(struct lightningd *ld, const u8 *msg)
|
||||
|
||||
@@ -20,7 +20,9 @@ void try_reconnect(const tal_t *ctx,
|
||||
void connect_succeeded(struct lightningd *ld, const struct peer *peer,
|
||||
bool incoming,
|
||||
const struct wireaddr_internal *addr);
|
||||
void connect_failed_disconnect(struct lightningd *ld, const struct node_id *id);
|
||||
void connect_failed_disconnect(struct lightningd *ld,
|
||||
const struct node_id *id,
|
||||
const struct wireaddr_internal *addr);
|
||||
|
||||
/* Disconnect a peer (if no subds want to talk any more) */
|
||||
void maybe_disconnect_peer(struct lightningd *ld, struct peer *peer);
|
||||
|
||||
@@ -1540,11 +1540,12 @@ void peer_disconnect_done(struct lightningd *ld, const u8 *msg)
|
||||
/* If there are literally no channels, might as well
|
||||
* free immediately. */
|
||||
if (!p->uncommitted_channel && list_empty(&p->channels))
|
||||
tal_free(p);
|
||||
p = tal_free(p);
|
||||
}
|
||||
|
||||
/* If you were trying to connect, it failed. */
|
||||
connect_failed_disconnect(ld, &id);
|
||||
connect_failed_disconnect(ld, &id,
|
||||
p && !p->connected_incoming ? &p->addr : NULL);
|
||||
|
||||
/* Fire off plugin notifications */
|
||||
notify_disconnect(ld, &id);
|
||||
|
||||
@@ -148,7 +148,9 @@ struct command_result *command_success(struct command *cmd UNNEEDED,
|
||||
|
||||
{ fprintf(stderr, "command_success called!\n"); abort(); }
|
||||
/* Generated stub for connect_failed_disconnect */
|
||||
void connect_failed_disconnect(struct lightningd *ld UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
void connect_failed_disconnect(struct lightningd *ld UNNEEDED,
|
||||
const struct node_id *id UNNEEDED,
|
||||
const struct wireaddr_internal *addr UNNEEDED)
|
||||
{ fprintf(stderr, "connect_failed_disconnect called!\n"); abort(); }
|
||||
/* Generated stub for connect_succeeded */
|
||||
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct peer *peer UNNEEDED,
|
||||
|
||||
@@ -107,7 +107,9 @@ struct command_result *command_success(struct command *cmd UNNEEDED,
|
||||
|
||||
{ fprintf(stderr, "command_success called!\n"); abort(); }
|
||||
/* Generated stub for connect_failed_disconnect */
|
||||
void connect_failed_disconnect(struct lightningd *ld UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
void connect_failed_disconnect(struct lightningd *ld UNNEEDED,
|
||||
const struct node_id *id UNNEEDED,
|
||||
const struct wireaddr_internal *addr UNNEEDED)
|
||||
{ fprintf(stderr, "connect_failed_disconnect called!\n"); abort(); }
|
||||
/* Generated stub for connect_succeeded */
|
||||
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct peer *peer UNNEEDED,
|
||||
|
||||
Reference in New Issue
Block a user