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

Function recv_req

connectd/connectd.c:2397–2524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2395}
2396
2397static struct io_plan *recv_req(struct io_conn *conn,
2398 const u8 *msg,
2399 struct daemon *daemon)
2400{
2401 enum connectd_wire t = fromwire_peektype(msg);
2402
2403 /* Demux requests from lightningd: we expect INIT then ACTIVATE, then
2404 * connect requests and disconnected messages. */
2405 switch (t) {
2406 case WIRE_CONNECTD_INIT:
2407 connect_init(daemon, msg);
2408 goto out;
2409
2410 case WIRE_CONNECTD_ACTIVATE:
2411 connect_activate(daemon, msg);
2412 goto out;
2413
2414 case WIRE_CONNECTD_CONNECT_TO_PEER:
2415 connect_to_peer(daemon, msg);
2416 goto out;
2417
2418 case WIRE_CONNECTD_DOWNGRADE_PEER:
2419 peer_downgrade(daemon, msg);
2420 goto out;
2421
2422 case WIRE_CONNECTD_DISCONNECT_PEER:
2423 peer_disconnect(daemon, msg);
2424 goto out;
2425
2426 case WIRE_CONNECTD_PEER_SEND_MSG:
2427 peer_send_msg(conn, daemon, msg);
2428 goto out;
2429
2430 case WIRE_CONNECTD_PING:
2431 send_manual_ping(daemon, msg);
2432 goto out;
2433
2434 case WIRE_CONNECTD_SEND_ONIONMSG:
2435 onionmsg_req(daemon, msg);
2436 goto out;
2437
2438 case WIRE_CONNECTD_CUSTOMMSG_OUT:
2439 send_custommsg(daemon, msg);
2440 goto out;
2441
2442 case WIRE_CONNECTD_PEER_CONNECT_SUBD:
2443 /* This comes with an fd */
2444 return daemon_conn_read_with_fd(conn, daemon->master,
2445 recv_peer_connect_subd, daemon);
2446
2447 case WIRE_CONNECTD_START_SHUTDOWN:
2448 start_shutdown(daemon, msg);
2449 goto out;
2450
2451 case WIRE_CONNECTD_SET_CUSTOMMSGS:
2452 set_custommsgs(daemon, msg);
2453 goto out;
2454

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