MCPcopy Create free account
hub / github.com/ElementsProject/lightning / recv_req

Function recv_req

connectd/connectd.c:1891–1968  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1889}
1890
1891static struct io_plan *recv_req(struct io_conn *conn,
1892 const u8 *msg,
1893 struct daemon *daemon)
1894{
1895 enum connectd_wire t = fromwire_peektype(msg);
1896
1897 /* Demux requests from lightningd: we expect INIT then ACTIVATE, then
1898 * connect requests and disconnected messages. */
1899 switch (t) {
1900 case WIRE_CONNECTD_INIT:
1901 connect_init(daemon, msg);
1902 goto out;
1903
1904 case WIRE_CONNECTD_ACTIVATE:
1905 connect_activate(daemon, msg);
1906 goto out;
1907
1908 case WIRE_CONNECTD_CONNECT_TO_PEER:
1909 connect_to_peer(daemon, msg);
1910 goto out;
1911
1912 case WIRE_CONNECTD_DISCARD_PEER:
1913 peer_discard(daemon, msg);
1914 goto out;
1915
1916 case WIRE_CONNECTD_PEER_FINAL_MSG:
1917 peer_final_msg(conn, daemon, msg);
1918 goto out;
1919
1920 case WIRE_CONNECTD_PING:
1921 send_manual_ping(daemon, msg);
1922 goto out;
1923
1924 case WIRE_CONNECTD_SEND_ONIONMSG:
1925 onionmsg_req(daemon, msg);
1926 goto out;
1927
1928 case WIRE_CONNECTD_CUSTOMMSG_OUT:
1929 send_custommsg(daemon, msg);
1930 goto out;
1931
1932 case WIRE_CONNECTD_PEER_CONNECT_SUBD:
1933 /* This comes with an fd */
1934 return daemon_conn_read_with_fd(conn, daemon->master,
1935 recv_peer_connect_subd, daemon);
1936
1937 case WIRE_CONNECTD_DEV_MEMLEAK:
1938#if DEVELOPER
1939 dev_connect_memleak(daemon, msg);
1940 goto out;
1941#endif
1942 case WIRE_CONNECTD_DEV_SUPPRESS_GOSSIP:
1943#if DEVELOPER
1944 dev_suppress_gossip(daemon, msg);
1945 goto out;
1946#endif
1947 /* We send these, we don't receive them */
1948 case WIRE_CONNECTD_INIT_REPLY:

Callers

nothing calls this directly

Calls 14

connect_initFunction · 0.85
connect_activateFunction · 0.85
connect_to_peerFunction · 0.85
peer_discardFunction · 0.85
peer_final_msgFunction · 0.85
send_manual_pingFunction · 0.85
onionmsg_reqFunction · 0.85
send_custommsgFunction · 0.85
dev_connect_memleakFunction · 0.85
dev_suppress_gossipFunction · 0.85
tal_hexFunction · 0.85
daemon_conn_read_nextFunction · 0.85

Tested by

no test coverage detected