Skip to content

Commit

Permalink
lightningd/peer_control: reorder, move more functions out.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Feb 20, 2018
1 parent 372040b commit 36652a3
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 297 deletions.
13 changes: 13 additions & 0 deletions lightningd/connect_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ void peer_connection_failed(struct lightningd *ld, const u8 *msg)
connect_failed(ld, &id, error);
}

/* Gossipd tells us peer was already connected. */
void peer_already_connected(struct lightningd *ld, const u8 *msg)
{
struct pubkey id;

if (!fromwire_gossip_peer_already_connected(msg, NULL, &id))
fatal("Gossip gave bad GOSSIP_PEER_ALREADY_CONNECTED message %s",
tal_hex(msg, msg));

/* If we were waiting for connection, we succeeded. */
connect_succeeded(ld, &id);
}

static void json_connect(struct command *cmd,
const char *buffer, const jsmntok_t *params)
{
Expand Down
3 changes: 3 additions & 0 deletions lightningd/connect_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ void connect_failed(struct lightningd *ld, const struct pubkey *id,
/* Gossipd was unable to connect to the peer */
void peer_connection_failed(struct lightningd *ld, const u8 *msg);

/* This simply means we asked to reach a peer, but we already have it */
void peer_already_connected(struct lightningd *ld, const u8 *msg);

#endif /* LIGHTNING_LIGHTNINGD_CONNECT_CONTROL_H */
Loading

0 comments on commit 36652a3

Please sign in to comment.