-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install a hook to filter messages being buffered #3654
Conversation
small_tests_24 / small_tests / a77cd96 small_tests_23 / small_tests / a77cd96 dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / a77cd96 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / a77cd96 dynamic_domains_mysql_redis_24 / mysql_redis / a77cd96 ldap_mnesia_23 / ldap_mnesia / a77cd96 ldap_mnesia_24 / ldap_mnesia / a77cd96 dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / a77cd96 pgsql_mnesia_23 / pgsql_mnesia / a77cd96 internal_mnesia_24 / internal_mnesia / a77cd96 elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / a77cd96 pgsql_mnesia_24 / pgsql_mnesia / a77cd96 mysql_redis_24 / mysql_redis / a77cd96 mssql_mnesia_24 / odbc_mssql_mnesia / a77cd96 pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription{error,
{{badmatch,
[{xmlel,<<"message">>,
[{<<"from">>,
<<"alice_unsubscribe_after_presence_unsubscription_1912@localhost">>},
{<<"to">>,
<<"bob_unsubscribe_after_presence_unsubscription_1912@localhost/res1">>},
{<<"type">>,<<"headline">>}],
[{xmlel,<<"event">>,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub#event">>}],
[{xmlel,<<"items">>,
[{<<"node">>,<<"LNqNXCx+EBWgDE21fZ0gPQ==">>}],
[{xmlel,<<"item">>,
[{<<"id">>,<<"salmon">>}],
[{xmlel,<<"entry">>,
[{<<"xmlns">>,
<<"http://www.w3.org/2005/Atom">>}],
[]}]}]}]},
{xmlel,<<"headers">>,
[{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
[]}]}]},
[{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
[{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
{line,384}]},
{escalus_story,story,4,
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,72}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1292}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1224}]}]}} riak_mnesia_24 / riak_mnesia / a77cd96 |
Codecov Report
@@ Coverage Diff @@
## master #3654 +/- ##
==========================================
- Coverage 81.09% 81.07% -0.02%
==========================================
Files 433 433
Lines 31938 31941 +3
==========================================
- Hits 25900 25897 -3
- Misses 6038 6044 +6
Continue to review full report at Codecov.
|
src/ejabberd_c2s.erl
Outdated
re_route_packets(Buffer, StateData) -> | ||
[reroute(Acc, StateData) || Acc <- lists:reverse(Buffer)], | ||
re_route_packets(Buffer, #state{jid = Jid, host_type = HostType} = StateData) -> | ||
FilteredBuffer = mongoose_hooks:filter_unacknowledged_messages(HostType, Jid, Buffer), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a good idea to pass already reversed input into filter_unacknowledged_messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one
This can be used to insert handlers that would filter out stanzas with a `no-copy` hint, or any other desired condition. The handler will have access to the full buffer and can return an entirely new one, preferably, by only filtering whichever stanza is to be undesired.
a77cd96
to
632e4f8
Compare
small_tests_24 / small_tests / 632e4f8 small_tests_23 / small_tests / 632e4f8 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 632e4f8 dynamic_domains_mysql_redis_24 / mysql_redis / 632e4f8 dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 632e4f8 ldap_mnesia_23 / ldap_mnesia / 632e4f8 dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 632e4f8 muc_SUITE:hibernation:hibernated_room_can_be_queried_for_archive{error,{{assertion_failed,assert,is_groupchat_message,
[<<"Restorable message">>],
undefined,"undefined"},
[{escalus_new_assert,assert_true,2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
{line,84}]},
{muc_SUITE,wait_for_mam_result,3,
[{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
{line,4383}]},
{muc_SUITE,'-hibernated_room_can_be_queried_for_archive/1-fun-0-',3,
[{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
{line,4124}]},
{escalus_story,story,4,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,72}]},
{muc_SUITE,hibernated_room_can_be_queried_for_archive,1,
[{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
{line,4120}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1292}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1224}]}]}} ldap_mnesia_24 / ldap_mnesia / 632e4f8 internal_mnesia_24 / internal_mnesia / 632e4f8 elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 632e4f8 pgsql_mnesia_23 / pgsql_mnesia / 632e4f8 mysql_redis_24 / mysql_redis / 632e4f8 pgsql_mnesia_24 / pgsql_mnesia / 632e4f8 service_domain_db_SUITE:db:db_keeps_syncing_after_cluster_join{error,{test_case_failed,{[<<"example1.com">>,<<"example2.com">>,
<<"example3.com">>],
[<<"example1.com">>,<<"example2.com">>,
<<"example3.com">>,<<"example4.com">>]}}} mssql_mnesia_24 / odbc_mssql_mnesia / 632e4f8 riak_mnesia_24 / riak_mnesia / 632e4f8 pgsql_mnesia_24 / pgsql_mnesia / 632e4f8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
This can be used to insert handlers that would filter out stanzas with a
no-copy
hint, or any other desired condition. The handler will haveaccess to the full buffer and can return an entirely new one,
preferably, by only filtering whichever stanza is to be undesired.