mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-12-28 17:44:47 +01:00
eff53495db
First, connectd tells us the peer has connected, and we call the connected hook, and if it says it's fine, we are actually connected and we fire off notifications. Of course, we could be disconnected while in the connected hook, and that would mean we tell people about a connection which is no longer current. Make this clear with a tristate: if we're not marked disconnected by the time the hooks finish, we're good. It also gives us a cleaner "connect" command return when we connected but disconnected before processing. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
29 lines
937 B
C
29 lines
937 B
C
#ifndef LIGHTNING_LIGHTNINGD_CONNECT_CONTROL_H
|
|
#define LIGHTNING_LIGHTNINGD_CONNECT_CONTROL_H
|
|
#include "config.h"
|
|
#include <ccan/short_types/short_types.h>
|
|
#include <ccan/tal/tal.h>
|
|
|
|
struct lightningd;
|
|
struct peer;
|
|
struct pubkey;
|
|
struct wireaddr_internal;
|
|
|
|
/* Returns fd for gossipd to talk to connectd */
|
|
int connectd_init(struct lightningd *ld);
|
|
void connectd_activate(struct lightningd *ld);
|
|
|
|
void try_reconnect(const tal_t *ctx,
|
|
struct peer *peer,
|
|
u32 seconds_delay,
|
|
const struct wireaddr_internal *addrhint);
|
|
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);
|
|
|
|
/* Disconnect a peer (if no subds want to talk any more) */
|
|
void maybe_disconnect_peer(struct lightningd *ld, struct peer *peer);
|
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_CONNECT_CONTROL_H */
|