]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Get rid of TCPCrossProtocolQuerySender
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 2 Dec 2022 14:57:17 +0000 (15:57 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 6 Dec 2022 16:18:55 +0000 (17:18 +0100)
commit516a00075fa9da56992fbea0149d274cd4a6813c
tree3331ff838b6216f5d3833915b7600f7e0ea762b6
parentc222a568eeee2b5f39e819a3d02828b775d1b8fe
dnsdist: Get rid of TCPCrossProtocolQuerySender

We need this construct to deal with cross-protocol queries, like
queries received over TCP or DoT, but forwarded over DoH, because
the thread dealing with the client and the one dealing with the
backend will not be the same in that case, and we do not want to
have different threads touching the same TCP connections.
So we pass the query and response to the correct thread via pipes.
Until now we were allocating an additional object, TCPCrossProtocolQuerySender,
to deal with that case, but I noticed that the existing IncomingTCPConnectionState
object already does everything we need, except that it needs to
know that the response is a cross-protocol one in order to pass it
via the pipe instead of treating it in a different way. This can be
done by looking if the current thread ID differs from the one that
created this object: if it does, we are dealing with a cross-protocol
response and should pass it via the pipe, and if it does not we
can deal with it directly.
This change saves the need to allocate a new object wrapped in a
shared pointer for each cross-protocol query, which is quite nice.
pdns/dnsdist-tcp.cc
pdns/dnsdistdist/dnsdist-tcp-upstream.hh
pdns/dnsdistdist/dnsdist-tcp.hh