CLEANUP: resolvers: simplify resolv_link_resolution() regarding requesters
authorWilly Tarreau <w@1wt.eu>
Tue, 19 Oct 2021 09:59:25 +0000 (11:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 20 Oct 2021 15:54:01 +0000 (17:54 +0200)
commit239675e4a955b219e915fa11a1a03c7aacc13ccd
treeb108003bd4257363cd7ed7ea605cbb2ab9c7501c
parent48664c048d17486b80e58459d2d4fa41a36e579e
CLEANUP: resolvers: simplify resolv_link_resolution() regarding requesters

This function allocates requesters by hand for each and every type. This
is complex and error-prone, and it doesn't even initialize the list part,
leaving dangling pointers that complicate debugging.

This patch introduces a new function resolv_get_requester() that either
returns the current pointer if valid or tries to allocate a new one and
links it to its destination. Then it makes use of it in the function
above to clean it up quite a bit. This allows to remove complicated but
unneeded tests.
src/resolvers.c