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

Function recv_req

connectd/connectd.c:2347–2473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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