mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
30f08cc2b0
We used to separate implicit connection requests (ie. timed retries for important peers) and explicit ones, and send a WIRE_CONNECTCTL_CONNECT_TO_PEER_RESULT for the latter. In the success case, that's now redundant, since we hand the connected peer to the master using WIRE_CONNECT_PEER_CONNECTED; we just need a message for the failure case. And we might as well tell the master every failure, so we don't have to distinguish internally. This also solves a race we had before: connectd would send WIRE_CONNECTCTL_CONNECT_TO_PEER_RESULT which completes the incoming JSON connect command, then send WIRE_CONNECT_PEER_CONNECTED. So there's a window where the JSON command can return, but the peer isn't known to lightningd yet. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2.5 KiB
2.5 KiB
1 | #include <common/cryptomsg.h> |
---|---|
2 | #include <common/wireaddr.h> |
3 | #include <lightningd/gossip_msg.h> |
4 | connectctl_init,2000 |
5 | connectctl_init,,id,struct pubkey |
6 | connectctl_init,,gflen,u16 |
7 | connectctl_init,,gfeatures,gflen*u8 |
8 | connectctl_init,,lflen,u16 |
9 | connectctl_init,,lfeatures,lflen*u8 |
10 | connectctl_init,,num_wireaddrs,u16 |
11 | connectctl_init,,wireaddrs,num_wireaddrs*struct wireaddr_internal |
12 | connectctl_init,,listen_announce,num_wireaddrs*enum addr_listen_announce |
13 | connectctl_init,,reconnect,bool |
14 | connectctl_init,,tor_proxyaddr,?struct wireaddr |
15 | connectctl_init,,use_tor_proxy_always,bool |
16 | connectctl_init,,dev_allow_localhost,bool |
17 | connectctl_init,,use_dns,bool |
18 | connectctl_init,,tor_password,wirestring |
19 | # Connectd->master, here are the addresses I bound, can announce. |
20 | connectctl_init_reply,2100 |
21 | connectctl_init_reply,,num_bindings,u16 |
22 | connectctl_init_reply,,bindings,num_bindings*struct wireaddr_internal |
23 | connectctl_init_reply,,num_announcable,u16 |
24 | connectctl_init_reply,,announcable,num_announcable*struct wireaddr |
25 | # Activate the connect daemon, so others can connect. |
26 | connectctl_activate,2025 |
27 | # Do we listen? |
28 | connectctl_activate,,listen,bool |
29 | # Connectd->master, I am ready. |
30 | connectctl_activate_reply,2125 |
31 | # connectd->master: disconnect this peer please (due to reconnect). |
32 | connect_reconnected,2112 |
33 | connect_reconnected,,id,struct pubkey |
34 | # Master -> connectd: Optional hint for where to find peer. |
35 | connectctl_peer_addrhint,2014 |
36 | connectctl_peer_addrhint,,id,struct pubkey |
37 | connectctl_peer_addrhint,,addr,struct wireaddr_internal |
38 | # Master -> connectd: connect to a peer. |
39 | connectctl_connect_to_peer,2001 |
40 | connectctl_connect_to_peer,,id,struct pubkey |
41 | # Connectd->master: connect failed. |
42 | connectctl_connect_failed,2020 |
43 | connectctl_connect_failed,,id,struct pubkey |
44 | connectctl_connect_failed,,failreason,wirestring |
45 | # Master -> connectd: try to always maintain connection to this peer (or not) |
46 | connectctl_peer_important,2010 |
47 | connectctl_peer_important,,id,struct pubkey |
48 | connectctl_peer_important,,important,bool |
49 | # Connectd -> master: we got a peer. Two fds: peer and gossip |
50 | connect_peer_connected,2002 |
51 | connect_peer_connected,,id,struct pubkey |
52 | connect_peer_connected,,addr,struct wireaddr_internal |
53 | connect_peer_connected,,crypto_state,struct crypto_state |
54 | connect_peer_connected,,gflen,u16 |
55 | connect_peer_connected,,gfeatures,gflen*u8 |
56 | connect_peer_connected,,lflen,u16 |
57 | connect_peer_connected,,lfeatures,lflen*u8 |
58 | # master -> connectd: peer has disconnected. |
59 | connectctl_peer_disconnected,2015 |
60 | connectctl_peer_disconnected,,id,struct pubkey |