Skip to content

Commit

Permalink
document strong exception guarantee in rfc6724_sort
Browse files Browse the repository at this point in the history
Summary: Document that callers rely on strong exception guarantees. If find_src_addr throws an exception, the output vector must remain in a valid state.

Reviewed By: sharmafb

Differential Revision: D64720384

fbshipit-source-id: 2b5fd776fc8a26cd6e30202526cafe75e36943cf
  • Loading branch information
hanidamlaj authored and facebook-github-bot committed Oct 22, 2024
1 parent ae4f1eb commit 97801de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions proxygen/lib/dns/Rfc6724.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ namespace proxygen {

void rfc6724_sort(vector<SocketAddress>& addrs,
const SocketAddress* srcAddr /* = nullptr */) {
/**
* Some callers require strong exception safety guarentees. If `find_src_addr`
* throws an exception, the output (e.g. vector<SocketAddress>& addrs) must
* be left in a valid state; this is a note to prevent future developers from
* breaking this guarantee.
*/
vector<SortElement> sortVec;
for (size_t i = 0; i < addrs.size(); ++i) {
SortElement elem;
Expand Down

0 comments on commit 97801de

Please sign in to comment.