| 1889 | } |
| 1890 | |
| 1891 | static 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: |
nothing calls this directly
no test coverage detected