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

Function recv_req

connectd/connectd.c:2340–2466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2338}
2339
2340static struct io_plan *recv_req(struct io_conn *conn,
2341 const u8 *msg,
2342 struct daemon *daemon)
2343{
2344 enum connectd_wire t = fromwire_peektype(msg);
2345
2346 /* Demux requests from lightningd: we expect INIT then ACTIVATE, then
2347 * connect requests and disconnected messages. */
2348 switch (t) {
2349 case WIRE_CONNECTD_INIT:
2350 connect_init(daemon, msg);
2351 goto out;
2352
2353 case WIRE_CONNECTD_ACTIVATE:
2354 connect_activate(daemon, msg);
2355 goto out;
2356
2357 case WIRE_CONNECTD_CONNECT_TO_PEER:
2358 connect_to_peer(daemon, msg);
2359 goto out;
2360
2361 case WIRE_CONNECTD_DOWNGRADE_PEER:
2362 peer_downgrade(daemon, msg);
2363 goto out;
2364
2365 case WIRE_CONNECTD_DISCONNECT_PEER:
2366 peer_disconnect(daemon, msg);
2367 goto out;
2368
2369 case WIRE_CONNECTD_PEER_SEND_MSG:
2370 peer_send_msg(conn, daemon, msg);
2371 goto out;
2372
2373 case WIRE_CONNECTD_PING:
2374 send_manual_ping(daemon, msg);
2375 goto out;
2376
2377 case WIRE_CONNECTD_SEND_ONIONMSG:
2378 onionmsg_req(daemon, msg);
2379 goto out;
2380
2381 case WIRE_CONNECTD_CUSTOMMSG_OUT:
2382 send_custommsg(daemon, msg);
2383 goto out;
2384
2385 case WIRE_CONNECTD_PEER_CONNECT_SUBD:
2386 /* This comes with an fd */
2387 return daemon_conn_read_with_fd(conn, daemon->master,
2388 recv_peer_connect_subd, daemon);
2389
2390 case WIRE_CONNECTD_START_SHUTDOWN:
2391 start_shutdown(daemon, msg);
2392 goto out;
2393
2394 case WIRE_CONNECTD_SET_CUSTOMMSGS:
2395 set_custommsgs(daemon, msg);
2396 goto out;
2397

Callers

nothing calls this directly

Calls 15

fromwire_peektypeFunction · 0.85
connect_initFunction · 0.85
connect_activateFunction · 0.85
connect_to_peerFunction · 0.85
peer_downgradeFunction · 0.85
peer_disconnectFunction · 0.85
peer_send_msgFunction · 0.85
send_manual_pingFunction · 0.85
onionmsg_reqFunction · 0.85
send_custommsgFunction · 0.85
start_shutdownFunction · 0.85
set_custommsgsFunction · 0.85

Tested by

no test coverage detected