| 1007 | } |
| 1008 | |
| 1009 | static bool handle_custommsg(struct daemon *daemon, |
| 1010 | struct peer *peer, |
| 1011 | const u8 *msg) |
| 1012 | { |
| 1013 | enum peer_wire type = fromwire_peektype(msg); |
| 1014 | |
| 1015 | /* Messages we expect to handle ourselves. */ |
| 1016 | if (peer_wire_is_internal(type)) |
| 1017 | return false; |
| 1018 | |
| 1019 | /* We log it, since it's not going to a subdaemon */ |
| 1020 | status_peer_io(LOG_IO_IN, &peer->id, msg); |
| 1021 | |
| 1022 | /* Even unknown messages must be explicitly allowed */ |
| 1023 | if (type % 2 == 0 && !find_custom_msg(daemon->custom_msgs, type)) { |
| 1024 | send_warning(peer, "Invalid unknown even msg %s", |
| 1025 | tal_hex(msg, msg)); |
| 1026 | /* We "handled" it... */ |
| 1027 | return true; |
| 1028 | } |
| 1029 | |
| 1030 | /* The message is not part of the messages we know how to |
| 1031 | * handle. Assuming this is a custommsg, we just forward it to the |
| 1032 | * master. */ |
| 1033 | daemon_conn_send(daemon->master, |
| 1034 | take(towire_connectd_custommsg_in(NULL, |
| 1035 | &peer->id, |
| 1036 | msg))); |
| 1037 | return true; |
| 1038 | } |
| 1039 | |
| 1040 | void custommsg_completed(struct daemon *daemon, const u8 *msg) |
| 1041 | { |
no test coverage detected