modules/federation/send: Check for self-sends here.

This commit is contained in:
Jason Volk 2018-09-04 23:41:29 -07:00
parent bfa4d704cc
commit 11e14bbb37
1 changed files with 10 additions and 0 deletions

View File

@ -130,6 +130,16 @@ handle_put(client &client,
pdu_failures.count()
};
// Don't accept sends to ourself for whatever reason (i.e a 127.0.0.1
// leaked into the target list). This should be a 500 so it's not
// considered success or cached as failure by the sender's state.
if(unlikely(my_host(request.origin)))
throw m::error
{
"M_SEND_TO_SELF", "Tried to send %s from myself to myself.",
txn_id
};
for(const auto &pdu_failure : pdu_failures)
handle_pdu_failure(client, request, txn_id, pdu_failure);