fix(gateway): reject unknown rpc methods instead of crashing (#2238)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-31 14:34:35 +02:00
1 parent 0e73346c5f
commit 2dd35c0d6e
4 files changed
+34 -8

No files matched your search

@@ -33,7 +33,9 @@ execute_method(<<"process.voice_state_counts">>, _Params) ->
gateway_rpc_misc_presence:collect_and_aggregate_voice_state_counts(ActiveNodes);
execute_method(<<"process.active_voice_rooms">>, _Params) ->
ActiveNodes = gateway_node_router:active_nodes(),
gateway_rpc_misc_push:collect_and_aggregate_active_voice_rooms(ActiveNodes).
gateway_rpc_misc_push:collect_and_aggregate_active_voice_rooms(ActiveNodes);
execute_method(Method, _Params) ->
gateway_rpc_error:raise(<<"Unknown method: ", Method/binary>>).
-spec get_local_node_id() -> binary().
get_local_node_id() ->
@@ -20,7 +20,9 @@ execute_method(<<"presence.terminate_all_sessions">>, P) -> handle_terminate_all
execute_method(<<"presence.has_active">>, P) -> handle_has_active(P);
execute_method(<<"presence.add_temporary_guild">>, P) -> handle_add_temp_guild(P);
execute_method(<<"presence.remove_temporary_guild">>, P) -> handle_remove_temp_guild(P);
execute_method(<<"presence.sync_group_dm_recipients">>, P) -> handle_sync_dm_recipients(P).
execute_method(<<"presence.sync_group_dm_recipients">>, P) -> handle_sync_dm_recipients(P);
execute_method(Method, _Params) ->
gateway_rpc_error:raise(<<"Unknown method: ", Method/binary>>).
-spec handle_dispatch(map()) -> true.
handle_dispatch(#{<<"user_id">> := UserIdBin, <<"event">> := Event, <<"data">> := Data}) ->
@@ -17,7 +17,9 @@ execute_method(<<"push.invalidate_badge_counts">>, P) ->
execute_method(<<"push.clear_channel_notifications">>, P) ->
do_clear_channel_notifications(P);
execute_method(<<"push.invalidate_subscriptions">>, P) ->
do_invalidate_subscriptions(P).
do_invalidate_subscriptions(P);
execute_method(Method, _Params) ->
gateway_rpc_error:raise(<<"Unknown method: ", Method/binary>>).
-spec do_sync_user_guild_settings(map()) -> true.
do_sync_user_guild_settings(#{